Soundinfo ========= Soundinfo is a CLI tool that reads IFF 8SVX samples and gives a brief one-line description of length, sampling rate, running time and channel and compression status. It can also examine the amplitude distribution and create a GnuPlot datafile of it. Usage ----- soundinfo [options] Where options are: -q be *q*uiet if the input file isn't 8SVX -x e*x*amine amplitude distribution -p implies -x and in addition creates a *p*lotfile -d perform -x/-p not on the samples themselves but on the *d*ifferences s[i]-s[i-1] Soundinfo is a plain C program and happily ignorant of pattern matching. So if you want to specify a pattern for , you need to use "SPat" (the standard DOS script, it should be in your S: directory). See the examples for more details. Examples (I) ------------ First of all, the reason why I wrote this program: I had a directory full of (pretty large) samples, some of them sampled at 22 kHz (too much ;-), some even in stereo (don't need that, either). And I wanted an overview to show me which samples were worth crunching (using "AmiSOX" or my own tool: "resample"). The command to create such a listing is spat soundinfo #? and it creates output like this: mono 8SVX, 0:33 at 11025 Hz, size 372858 (C0): Jeopardy.iff mono 8SVX, 0:46 at 14074 Hz, size 647820 (C0): Blossom.iff not an IFF file ( 3452 bytes): histogram.plt mono 8SVX, 2:13 at 14700 Hz, size 1955296 (C0): Lorena.iff mono 8SVX, 0:39 at 22448 Hz, size 879544 (C0): Promises.iff stereo 8SVX, 0:00 at 15480 Hz, size 13522 (C1): WhosBad.iff mono 8SVX, 2:33 at 14700 Hz, size 2249296 (C0): ThroughWLove.iff ^ ^ number of bytes --+ +-- compression method, in the BODY chunk 0=none, 1=delta fib. If you don't want non-8SVX files to be listed, use the -q option: spat soundinfo #? -q Please note that 'spat soundinfo -q #?' would fail, because SPat expects its arguments to be command, pattern, extra options, in this order. (However, 'spat "soundinfo -q" #?' would work. What quotes can do ... %-) Redirecting output to a file is possible with SPat, too: spat "soundinfo -q >>foo" #? Please note that "soundinfo >>foo" MUST be in quotes this time, so that the redirection is applied on soundinfo, not on SPat itself. Also note that it makes no sense to say "soundinfo >foo", as this will overwrite foo every time soundinfo is executed, always leaving a file with only one line in it. Examples (II) ------------- Soundinfo can also be used to examine a single sound sample more closely: soundinfo -x mysample.iff The output (after some time) will somehow look like this: mono 8SVX, 0:46 at 14074 Hz, size 647820 (C0): mysample.iff read 647820 bytes = 100 % volume ± 8: 179291 samples volume ± 16: 129271 samples volume ± 24: 100558 samples volume ± 32: 75148 samples volume ± 40: 54150 samples volume ± 48: 37855 samples volume ± 56: 26424 samples volume ± 64: 17693 samples volume ± 72: 11808 samples volume ± 80: 6783 samples volume ± 88: 4054 samples volume ± 96: 2329 samples volume ±104: 1284 samples volume ±112: 658 samples volume ±120: 289 samples volume ±128: 225 samples Experience shows that this is indeed a typical volume distribution: higher sample values appear less and less frequently, but are nevertheless present. (This phenomenon might be approximately described as n ~ exp(-abs(y)).) Empty intervals (0 samples) would indicate that the 8 bit sampling resolution is not fully utilized. On the other hand, if the highest interval (±128) contains significantly more samples than its neighbour (±120), you may assume that the recording is overmodulated. If you want a more detailed listing, counting each sample value -128..127 seperately, soundinfo -p mysample.iff will do the job, creating a file "histogram.plt". Look at it or use GnuPlot to plot it (start GnuPlot, then say: 'plot "histogram.plt" with impulses'). It is unlikely that you will ever need the -d option. I added it because I was curious how much damage Fibonacci Delta compression can do. (The sample is stored as a sequence of step sizes, allowing only sixteeen different steps: -34,-21,-13,-8,-5,-3,-2,-1,0,1,2,3,5,8,13,21.) Ouch. It can do a *lot* of damage. The range of step sizes present in your average sound sample is much wider than -34..21. :-( Credits ------- This program was written using EdWord and the GNU C compiler. If you like it, or if you have suggestions, send me E-Mail (well, standard mail is accepted, too ;): Wilhelm Noeker Hertastr. 8 44388 Dortmund Germany