> From jpcampb@apl.jhu.edu Aug 1996 > > I'm a student of EE. I already download that CELP program and make it. > But I cannot listen those speech files(.spd files). Could you tell me > what should I do ? What have you tried? What tools do you have? What workstations do you have access to? If you have Sun workstations and Matlab, it's easy. If you have a PC, it may take some work (the SOX software may help). >1. The SOX doesn't support .spd file. The SOX documentation doesn't call it ".spd" format, but they support this 16-bit linear PCM format. >2. I tried to find some function about .spd file in Matlab 4.2c. > But I cannot get it. Same as above. See the Matlab code below. >3. I read the readme file from /celp_3.2a/diskio. It didn't mention > about the spd format. The diskio.c C function contains information about .spd in its comments. (The C code segment below is probably more informative.) > Can I use .wav file or .au file as input > of the celp code? I tried once but I failed. You're right, these don't work - I believe that .au is an 8-bit format and the samples are u-law encoded. >4. What sites or books I can read for these troubles? I tried net search > many times but I cannot find any doc about playing .spd files. The Audio Format FAQ might be helpful, but don't look for "spd" - just look for its characteristics. ######################################################################## >>> TO PLAY LINEAR AUDIO FILES (E.G., *.spd & TIMIT FILES) ON SUNS with LINEAR SUPPORT (E.G., Solaris 2.x SUN SPARC-10s) <<< Here's how I play .spd files on my Sun under Solaris, just drop this line in your .cshrc file: alias play 'audioconvert -i pcm16,mono,raw,r=8k -f sun \!* | audioplay' Then if you have a file called 3m3f.spd, just do: % play 3m3f.spd I don't recall if "audioconvert" and "audioplay" are optional under Solaris or if they're available under SunOS 4.x. If audioconvert is unavailable, I'm sure that SOX could be used instead (and perhaps redirecting the stream to /dev/audio could take the place of audioplay). ######################################################################## >>> TO PLAY LINEAR AUDIO FILES (E.G., *.spd & TIMIT FILES) ON SUNS with U-LAW SUPPORT (E.G., NonSolaris 2.x SUN SPARC-10s) <<< Using the Hidden Markov Model ToolKit (HTK) V1.4A (now sold by Entropic): HSLab ~/Speech/HTK_V1.4A/bin.dr_fell/HSLab ~/Speech/HTK_V1.4A/bin.dr_fell/HSLabRon ~/Speech/HTK_V1.4A/bin.dr_fell/HSLabTim USAGE: HSLab[V1.4] [options] waveformFile Option Default -n Create new transcription off -F fmt Set data file format to fmt HTK -G fmt Set label file format to fmt HTK -L s Directory to find label file(s) current -X s Extension for label files lab ------------------------------------------ Using Entropic's ESPS % eman splay SPLAY(1-ESPS) ENTROPIC RESEARCH LAB. NAME splay - send ESPS sampled data to the SPARCstation codec output. SYNOPSIS splay [ -x debug-level ] [ -{ps} range ] [ -g gain ] [ -R nrepeat ] [ -b shift-value ] [ -a ] [ -e ] [ -q ] file [ more-files ] DESCRIPTION Splay does a mu-law encoding of the data in one or more ESPS, SIGnal, NIST or headerless type SHORT sampled data files and sends the data to the SPARCstation 1 digital-to- analog converter. A subrange of data within the files may be chosen; this subrange may be specified in seconds or points. Furthermore, a repeat count, a scaling factor (gain), and a shift factor may be specified. ------------------------------------------ Use Waves To set the waves volume control type in: set play_prog splay -e -g .06 into the COMMAND (or @file): line in the waves control panel. See the eman page for splay for correct arguments. In this manner you can set the volume and/or external/internal speaker within waves. set play_prog splay -g 1.0 ------------------------------------------ Using u-law routines Another way to play spd files under SunOS 4.1.x is to use the Craig Reese conversion routines which we have. u2lin and convert (? name should be changed to lin2ulaw ?). Just pipe the original file through these filters and then into the standard play program. cat sound.spd | lin2ulaw | play This doesn't tie up an Entropics license. After trying lin2ulaw myself, it has some problems. The file must end in ".spd" and the play command must also have some options to tell it not to expect an audio header... Maybe it's not a good choice. :( ------------------------------------------ From within MatLab: >> help sound SOUND Convert vector into sound. SOUND(Y) sends the signal in vector Y out the speaker on SPARC, HP, SGI, PC, and Macintosh computers. The vector is autoscaled to provide maximum amplitude. The sound is played at the default sample rate. On the SPARC, the sample rate is fixed at 8192 Hz. On the Macintosh, the default sample rate is 22.255K Hz. SOUND(Y,FS), on the Macintosh, PC, and SGI, plays the sound at a sample frequency of FS Hz. Vector Y is automatically scaled so that the maximum and minimum values in Y correspond to the maximum and minimum input ranges allowed by the sound hardware. On the Macintosh and the SGI, the volume control on the Control Panel determines the final sound level. See also SAXIS, AUWRITE, AUREAD, WAVREAD, WAVWRITE. >> help auwrite AUWRITE Write mu-law encoded audio file. AUWRITE(Y,'filename') converts Y to mu-law encoded bytes and writes it to the specified audio file. If no file name is given, /dev/audio is used, either on the local machine, or on the remote machine specified by the environment variable DISPLAY. >> help matlab/speech Speech Processing Toolbox (jdendsl) File I/O loadspd - Loads a .spd file into MatLab vector savespd - Saves MatLab vector to .spd file play - Outputs MatLab vector to audio output ######################################################################## >>> TO PLAY U-LAW (U=255) ENCODED FILES (E.G., SUN "AU" FILES) <<< % man audiotool Reformatting page. Wait... done AUDIOTOOL(1) USER COMMANDS AUDIOTOOL(1) NAME audiotool - audio play/record tool SYNOPSIS audiotool [ -p ] [ generic-tool-argumens ] [ audio-file ... ] DESCRIPTION audiotool is an OpenLook program that allows recording, playing, and simple editing of audio data. ------------------------------------------ % man play Reformatting page. Wait... done PLAY(6) GAMES AND DEMOS PLAY(6) NAME play - play audio files SYNOPSIS play [ -i ] [ -V ] [ -d dev ] [ -v vol ] [ filename... ] AVAILABILITY This command is only available with the Demos software installation option. Refer to Installing SunOS 4.1 for information on how to install optional software. ------------------------------------------ From within MatLab: >> help auread AUREAD Read mu-law encoded audio file. Y = AUREAD('filename') reads the audio file in 'filename' and converts the data from mu-law encoded bytes to a signal in the range -1 <= Y <= 1. ######################################################################## Notes: Mathematica has audio+video capability ######################################################################## ---------------------------------------------------------------------------- Here's some C code that describes the format and it may help you: % cat spd.c float sn; int s_int; unsigned char hi_byte, lo_byte; /* "*.spd" speech data file format: 16-bit, 2's comp, hi|lo bytes */ hi_byte = getc(stdin); lo_byte = getc(stdin); s_int = (hi_byte<<8) + lo_byte; if (s_int > 32767) s_int -= 65536; sn = s_int/32768.0; /* real [-1, +1) speech sample */ ---------------------------------------------------------------------------- Here's some Matlab version 3.x code for UNIX Sun workstations (Matlab 4.x may have this capability built-in): function spchout = loadspd(name,arg); % % SPCHOUT = LOADSPD('filename w/o extension',arg) % % This function loads a .spd speech file into matlab. % The filename will be .spd. The filename passed must be % enclosed in ' ' since it is a string. The function searches % the current directory unless a second argument is given. % If arg = 0, then the function will load the .spd file % from $HOME/speech/data. % INPUT: % 'filename' - filename w/o .spd extension % arg - 0 search dir /usr/u/endsley/speech/data for .spd file % - 1 search dir $HOME/speech/data for .spd file % OUTPUT: % spchout - loaded speech. % % if (nargin == 1), eval(['!/usr/u/endsley/speech/bin/loadspd ',name]) end if (nargin == 2), if (arg == 0), eval(['!/usr/u/endsley/speech/bin/loadspd ','/usr/u/endsley/speech/data/',name]) elseif (arg == 1), eval(['!/usr/u/endsley/speech/bin/loadspd ','$HOME/speech/data/',name]) end end load loadspd; !rm loadspd.mat spchout = loadtmp; Good luck and thanks for your interest in CELP!, Joe ____________________________________________________________________________ |Dr. Campbell, US DoD, Johns Hopkins U, Ed. IEEE TSAP, Chair Bio Consortium| |Speaking for myself jpcampb@apl.jhu.edu | |Sun Mail Tool attachments |