ref: 1d09da3a87e43eee7a345f970378c37312a71895
dir: /test/README/
Here are some helper programs for checking filter and rate conversion accuracy of sox. The programs in the test subdirectory which I (Stanley J. Brooks) wrote are covered by the GPL. See the Copyright file for details. Sox itself is not covered by the GPL, but something similar. To use this stuff, first cd to this test subdirectory and run make, which should produce the ding,lding, model, and lmodel executables. Now to test something... Say you want to compare the 'band' effect to the 'filter' effect... ./ltest band 800 200 >A ./ltest filter 600-1000 >B gnuplot responseAB plots the response curves with y being power-gain in dB, and x the frequency. For another, say to compare response and error of resample rate conversion from 8000 ->22050 samples per second, with linear (default) interpolation versus -qs quadratic interpolation with Nuttall window... ./ltest -l resample >A ./ltest -l resample -qs 0.80 0 >B gnuplot plotAB ------------------------------------------------------------------- About ltest: -l means use 32-bit signed samples, otherwise 16-bit signed is used. The other parameters are fed into sox as the 'effect' with parameters. The rates 8000:22050 are in the script, but you can edit a perl script, I hope. just change the ($rate0,$rate1)=(8000,22050) line near the top. What ltest does: It uses the 'ding' program to synthesize a sineusoid input file for the frequencies 0.00 0.01 ... 0.99 of the Nyquist frequency. This input has: 400 samples samples of silence, 4000 samples with smooth envelope rising to volume -v0.5 16000 samples at -v0.5 4000 samples with smooth envelope falling to 0, 400 sample more of silence. The rising/falling envelopes are shaped like rising, falling portions of the (1-cos(x)) function. Then the filter or rate-change effect is applied to this i0.xx.xx file to give an output file. The output file is examined by the 'model' or 'lmodel' program to analyse response level and error level. model works as follows: step 1: the entire sample file is read in, and the center-of-gravity of the squared samples is found. This is the time offset which should correspond to the center of the filtered/resampled tone-pulse. step 2: let N = 16000*(rate1/rate0) be the number of samples at output rate which would correspond to the 16000 sample duration at max volume. We focus on the samples between (center - 0.3*N) and (center + 0.9*N) where the transient effects of attack/release envelope should be small. We do a least-squares fit of a sinusoid at the adjusted frequency to this segment of 0.6*N samples, and print out the component s2max which can be explained, and also the rms level of the 'error' or unexplained part. That's pretty much it... the ltest perl-script glues it together and outputs adjusted data which the gnuplot will like. Modify the perl and gnuplot scripts to suit your needs. SoX: Sound eXchange SoX (also known as Sound eXchange) translates sound samples between different file formats, and optionally performs various sound effects. This release understands: o Raw files in various binary formats o Raw textual data o Microsoft .WAV files o PCM, u-law, a-law o MS ADPCM (Read only) o IMA ADPCM (Read only) o MAUD files o Sound Blaster .VOC files o IRCAM SoundFile files o SUN .au files o PCM, u-law, a-law o G7xx ADPCM files (read only) o mutant DEC .au files o Apple/SGI AIFF files o CD-R (music CD format) o Macintosh HCOM files o Sounder files o NeXT .snd files o Soundtool (DOS) files o Psion (palmtop) A-law files o AVR files The sound effects include: o Channel Averaging o Band-pass filter o Chorus effect o Cut out loop samples o Add an echo o Add a sequence of echos o Apply a flanger effect o Apply a high-pass filter o Apply a low-pass filter o Display a list of loops in a file o Add masking noise to a signal o Apply a phaser effect o Convert from stereo to mono o Change sampling rates using several different algorithms. o Apply a reverb effect o Reverse the sound samples (to search for Satanic messages ;-) o Convert from mono to stereo o Swap stereo channels o Display general stats on a sound sample o Add the world-famous Fender Vibro-Champ effect Big news! Lots of new effects have been added. This includes most the popular "Guitar Effects" talked about in the same named FAQ available. The 'resample' and 'polyphase' effect does high-grade signal rate changes using real signal theory. Yes, it's very slow. History: This is the 12th release, Patchlevel 17 of the Sound Tools. SoX was originally written and maintained by Lance Norskog but unfortunetly he has stopped maintaining it since 1995. I, Chris Bagwell (cbagwell@sprynet.com), have started maintaining it since 1996 to the present. Caveats: SoX is intended as the Swiss Army knife of sound processing tools. It doesn't do anything very well, but sooner or later it comes in very handy. SoX is really only usable day-to-day if you hide the wacky options with one-line shell scripts. Installing: Unless your using a precompiled binary version, you will need to compile SoX as described in the INSTALL file. Please read that file for further instructions. Now, read TIPS, CHEAT.eft and CHEAT. These give a background on how SoX deals with sound files and how to convert this format to that format, and apply various effects. SoX uses file suffices to determine the nature of a sound sample file. If it finds the suffix in its list, it uses the appropriate read or write handler to deal with that file. You may override the suffix by giving a different type via the '-t type' argument. See the manual page for more information. SoX has an auto-detect feature that attempts to figure out the nature of an unmarked sound sample. It works very well. This feature is used if you specify '-t auto' for the file type. I hope to inspire the creation of a common base of sound processing tools for computer multimedia work, similar to the PBM toolkit for image manipulation. Sound Tools may be used for any purpose. Source distributions must must include the copyright notices, and (lack of) warranty information. Binary distributions must include acknowledgements to the creators. Files are copyright by their respective authors. If you have bug fixes/enhancements, please send it to me as I would like to coordinate the releases. Please document your changes. I don't possess every kind of computer currently sold, and SoX is now beyond the phase where I can understand and test most of your contributions. The majority of SoX features and source code are contributed by you the user. Thank you very much for making SoX a success! Creator: Lance Norskog thinman@meer.net (inactive currently) Mantainer: Chris Bagwell cbagwell@sprynet.com Contributors: Juergen Mueller jmueller@uia.ua.ac.be chorus, echo, echos, flanger, phaser, and reverb effects. Guido Van Rossum guido@cwi.nl AU, AIFF, AUTO, HCOM, reverse, many bug fixes Jef Poskanzer jef@well.sf.ca.us original code for u-law and delay line Bill Neisius bill%solaria@hac2arpa.hac.com DOS port, 8SVX, Sounder, Soundtool formats Apollo fixes, stat with auto-picker Rick Richardson rick@digibd.com WAV and SB driver handlers, fixes David Champion dgc3@midway.uchicago.edu Amiga port Pace Willisson pace@blitz.com Fixes for ESIX Leigh Smith leigh@psychokiller.dialix.oz.au SMP and comment movement support. AIFF Loop/MIDI support David Sanderson dws@ssec.wisc.edu AIX3.1 fixes Glenn Lewis glewis@pcocd2.intel.com AIFF chunking fixes Brian Campbell brianc@quantum.qnx.com QNX port and 16-bit fixes Chris Adams gt8741@prism.gatech.edu DOS port fixes John Kohl jtkohl@kolvir.elcr.ca.us BSD386 port, VOC stereo support Ken Kubo ken@hmcvax.claremont.edu VMS port, VOC stereo support Frank Gadegast <phade@cs.tu-berlin.de> Microsoft C 7.0 & C Borland 3.0 ports David Elliot <dce@scmc.sony.com> CD-R format support David Sears <dns@essnj3.essnjay.com> Linux support Tom Littlejohn <tlit@seq1.loc.gov> Raw textual data Boisy G. Pitre boisy@microware.com OS9 port Sun Microsystems, Guido Van Rossum CCITT G.711, G.721, G.723 implementation Graeme Gill graeme@labtam.labtam.oz.au A-LAW format, Good .WAV handling, avg channel expansion Allen Grider grider@hfsi.hfsi.com VOC stereo mode, WAV file handling Michel Fingerhut Michel.Fingerhut@ircam.fr Upgrade 'sf' format to current IRCAM format. Float file support. Chris Knight Achimedes Acorn support Richard Caley R.Caley@ed.ac.uk Psion WVE handler Lutz Vieweg lkv@mania.RoBIN.de MAUD (Amiga) file handler Tim Gardner timg@tpi.com Windows NT port for V7 Jimen Ching jiching@wiliki.eng.hawaii.edu Libst porting bugs Lauren Weinstein lauren@vortex.com DOS porting, scripts, professional use Stan Brooks stabro@megsinet.net Rewrite of resample and polyphase code. DSP filter effect. Some test code/scripts. Chris Bagwell cbagwell@sprynet.com OSS and Sun players, bugfixes, ADPCM support, patch collection and maintance. (your name could be here, too) (I've probably lost a few, and several people fixed the same bugs.)