📄 readme
字号:
Tue Feb 13 10:47:25 CST 1996Andy Fingerhut (jaf@arl.wustl.edu)File formats:.auSun/NeXT audio file format. These have headers specifying thesampling rate, number of channels, sample format, and perhaps a fewother things..spdExtension of the sample audio files that came with the LPC10distribution. They are raw audio data (i.e., no header), sampled at8000 samples/sec, 1 channel, where the samples are 16 bit 2'scomplement signed values, with the most significant byte first. Thisappears to be the same as Sun's .au format with the same parameters,except that it doesn't have the .au header..dspAn extension that appears to be common for Linux audio files, becausethe device name for recording and playing audio is /dev/dsp. They arealso raw audio data (i.e., no header). They might have any of severalsampling rates, numbers of channels, or sample formats. When workingwith the LPC10 coder, it is desirable to use the same raw .spd formatas the sample sound data files are.Unfortunately, when I have compiled the Fortran version of lpcsimusing f2c and GCC on my Linux machine, it appears to expect 16 bitsamples with the least significant byte first for input filesspecified with lpcsim's -is option, and to produce such files foroutput files specified with lpcsim's -os option. This might havesomething to do with the "endian-ness" of the Sun machine architecturevs. the Intel machine architecture.Similarly, the programs srec and splay for recording and playing soundwith 16 bit samples on Linux machines (using the -b 16 option of thosecommands) also use files in this byte order. It is easy to convertbetween .spd and .dsp files using the following command to swap bytes(that it what the 'swab' abbreviation means):dd conv=swab < dam9.spd > dam9.dsp----------------------------------------------------------------------spd2au - convert LPC10 .spd files to Sun .au files----------------------------------------------------------------------Example of use:spd2au < dam9.spd > dam9.auThe shell script spd2au contains a command that may be used to convertthe raw audio files used by the LPC10 coder (with extension .spd) toSun format audio files (with extension .au), with the same sampleformat (8000 samples/sec, 1 channel, 16 bit linear samples encoded as2's complement signed numbers).It uses the program audioconvert, which is available on at least someSun machines. I have found it on siesta.wustl.edu, a Solaris 5.3machine, but not on leia.wustl.edu, which runs SunOS 4.1.4. It mightbe merely a difference in the optional Sun software installed, ratherthan the OS version difference.I created this command, and then when I found that audioconvertdoesn't exist on the machine on my desk, I dug a little deeper intowhat audioconvert actually does, and created playspd. See thedescription for that command. I leave this script around mostly fordocumentation purposes, and for others that can use it.----------------------------------------------------------------------playspd - play LPC10 .spd file(s) on a Sun workstation----------------------------------------------------------------------Example of use:playspd dam9.spd dam9_lpc55.spdWhile siesta.wustl.edu has the audioconvert program, its audio speakerdoes not sit on my desk. The audio speaker of leia.wustl.edu does.From my own simple testing, it appears that all the spd2au commandabove does is prepend the data with a 32 byte header, which is thesame for all audio files with the same sampling rate, channels, andsample format. Therefore, I put these 32 bytes into a file called:8khz-16bit-1channel-sun-au-headerand created a small shell script called playspd that prepends thisheader to the raw audio samples, and pipes the output to the play(1)command available on Sun's. This can be used to play the raw audiofiles on leia.wustl.edu, without having to go over the network toseista.wustl.edu, run audioconvert, copy the result back, and thenplay it. Much more convenient.It would be even nicer to have one command that works on any of thefile formats .dsp, .spd, and .au, distinguishing between them by theirextensions (or, for .au files, by their "magic number", i.e., thefirst four bytes of the file), and for Linux, Solaris, and SunOSmachines (using splay for Linux, and play for Solaris or SunOS, andusing some environment variable or command to determine what kind ofmachine it is running on). I'll probably do something like this inthe near future. That command could be called just 'play', or maybesome other name that isn't already taken.----------------------------------------------------------------------dump-spd - show decimal values of LPC10 .spd file samples----------------------------------------------------------------------Example of use:dump-spd dam9.spdThis command merely runs the GNU version of od with the appropriateoptions.Note: This command also appears to use the 'native' byte ordering ofthe machine on which it is run. Running this command on a .spd fileon a Sun machine produces the desired results, but running it on a.spd file on a Linux/Intel machine produces bad results (i.e., the2-byte words are interpreted in the wrong order). It would be nice tohave this command work on all desired machines with all of the .spd,.dsp, and .au extensions.It is becoming clear to me that a nice solution would be to make playand record programs for Linux that use Sun/NeXT .au files, withheaders, and store 16-bit samples with the same byte order that Sunworkstations do. Then, I could also modify the lpcsim source code sothat it used .au files, and performed byte-swapping internally (ifnecessary) on Linux/Intel machines. This would mean that all audiofiles would be in the same format on both types of machine, and couldbe FTP'd between them with no harm done. Plus, I wouldn't have to putcase-checking code in all of these short little scripts to handle thedifferent formats.----------------------------------------------------------------------s2bits - Compress a .spd or .dsp file with lpcsim to a .bits file----------------------------------------------------------------------Example of use:s2bits dam9.spdThis script has a bit of case-checking code in it to determine whattype of machine it is on, and to determine the extension of the inputfile. It performs byte-swapping on the input file, if necessary, intoa temporary file, and then runs lpcsim to produce a compressedbitstream file (using lpcsim's -ob option).If I modified lpcsim to accept .au files, all of this case checkingwould go into the LPC source code, and out of this script. That wouldbe nice.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -