Download vu-1.4.tar.gz

vu version 1.4

vu is a command line filter for audio sample data. It reads samples from standard input, copies the data to standard output, and spits out useful time and amplitude information to the standard error.

example:

	record | vu > mysound.wav


vu version 1.4

vu is a command line filter for audio sample data.
It reads samples from standard input, copies the
data to standard output, and spits out useful time
and amplitude information to the standard error.

example:

	record | vu > mysound.wav

vu understands .WAV files, and will adjust itself
to the header information, copying the header to
its output.  There are various flags for describing
raw or other types of sound files to vu so that it
can respond to them properly.  They are:

	-b <bits>
		Specify the sample width in bits.
		Must be 8 or 16. Default 16

	-c <channels>
		Specify the number of channels in
		the data.  Must be 1 or 2. Default 1

	-s <Hz value>
		The sample rate of the sound.  Must
		be an integer.  Default 44100.

And the other recognized flags are:

	-d <Hz value>
		The rate at which vu will output
		its display information. The default
		is twice per second.
	
	-i [0l1r]*
		Inverts sample data.  If no channels
		are specified, then channel 0 is 
		inverted.  Otherwise the specified
		channels are toggled for inversion each
		time the corresponding arguments are 
		encountered.  A '0' or 'l' specifies
		the first channel, while a '1' or 'r'
		specifies the second.  So, for example:
		'-i lr0' will leave the first channel
		unchanged (inverted twice) while the
		second channel will be inverted.

	-g<threshold>:<gate_length>
		This is the "spy" option.  You figure
		out why.  No samples pass until
		the percent field reaches <threshold>
		at which time all samples will pass until
		<gate_length> seconds have passed.  The
		<gate_length> timer is reset each time
		<threshold> is hit in the amplitude, so
		that the entire sample would pass through
		so long as the <threshold> is hit at least
		every <gate_length> seconds.  Otherwise,
		there will be gaps in the output and display.
		Display time skips over blank spots and so
		reveals the original time in the input rather
		than actual time elapsed in the output.  Does
		all of that make sense?

		just go:
			record | vu -g40:10 > what_my_wife_does_while_I_work.wav
		But that would be wrong.

	-m<gain>
		Change the scale of the output graph so that
		the sample seems <gain> times larger than it 
		would otherwise.  The numeric fields are not 
		affected.  <gain> must be a positive
		integer.


If there is a header on the soundfile that is something other than
WAV, then vu will copy it to standard out, preserving the file, but
would probably misrepresent the initial amplitudes of the file, as
it would attempt to interpret the header as sample data.  

Here is a sample of vu's standard error output:
	
WAVE file: 16 bits per sample, Stereo
OOOOOOOOOOO   |    |    |    |    |    |    |    > T:0.5     23% 1857 
OOOOOOOOOOOOOOO    |    |    |    |    |    |    > T:1       30% 2954 
OOOOOOOO |    |    |    |    |    |    |    |    > T:1.5     17% 992 
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO   |    |    > T:2       72% 17047 
OOOOOOOOOOOOOOOOOOOOOOOOO    |    |    |    |    > T:2.5     50% 8472 
OOOOOOO  |    |    |    |    |    |    |    |    > T:3       15% 832 
OOOOOOOOOOOOOOOOOOOOOOOOOOO  |    |    |    |    > T:3.5     54% 9754 
OOOOOOOOOOOOOOOOOOOOOOO |    |    |    |    |    > T:4       46% 6936 
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO |    |    > T:4.5     77% 19685 
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO   |    |    > T:5       72% 17383 
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO T:5.5     ***** CLIP *****  
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO T:6       ***** CLIP *****  
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|    > T:6.5     89% 26308 
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|    |    > T:7       79% 20661 
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO|    |    |    > T:7.5     68% 15212 
OOOOOOOOOOOOOOOOOOOOOOOOOOOO |    |    |    |    > T:8       56% 10614 
OOOOOOOOOOOOOOOOOOOOOOOO|    |    |    |    |    > T:8.5     48% 7672 
OOOOOOOOOOOOOOOOOOOOO   |    |    |    |    |    > T:9       42% 6018 
OOOOOOOOOOOOOOOOOO |    |    |    |    |    |    > T:9.5     36% 4431 
OOOOOOOOOOOOOOOO   |    |    |    |    |    |    > T:10      33% 3672 
OOOOOOOOOOOOOO|    |    |    |    |    |    |    > T:10.5    28% 2714 


There are four sections for each output line.  All of the sections
are displayed by default, but each one may be toggled on or off by
issuing its corresponding flag on the command line:
	
	(-B)	Bar graph of amplitude 
		This graph really represents the relative values 
		of the square root of the raw amplitude.  This 
		gives a display that seems to correspond more 
		closely to how I perceive the loudness of the sounds.
		
	(-T)	Time elapsed 

	(-P)	Percent of maximum amplitude. 
		This is just a numeric version of the information
		found in the bar graph.

	(-R)	Raw sample value. 
		This is simply an indication of the actual sample data's
		maximum value.  Max will be 32767 for 16 bit sounds, and
		127 for 8 bit sounds.


Each display line gives information about the absolute largest sample value
during that time span, from any channel.  vu can't split channels, nor does
it do any fancy averaging or RMS calculations or anything like that.
I just use it to find out whether my sound is clipping while I am recording.


Toby Shepard
toby@rcsreg.com

I decided to change the definition of 'clipping' with this version because of the -i feature. For now, with a 16 bit sample, clipping is tagged for any sample reaching +/- 32767. Soon I will redefine this as a minimum number of consecutive 'clipping' samples, which will create a new command line option. For instance, one might specify that clipping has not happened until three consecutive samples have read +32767. For now just one at that level will trigger the clip. When this happens, vu omits any -P or -R information, and outputs the string "***** CLIP *****"
Toby Shepard toby@tobiah.org Toby Shepard
toby@rcsreg.com
Tue Jun 15 18:05:56 PDT 1999