• MATLAB Speech Processing Code • MATLAB GUI Implementations
Basic Functionality
• • • • • • • • • • • • read a speech file (i.e., open a .wav speech file and read the speech sample into a MATLAB array) write a speech file (i.e., write a MATLAB array of speech samples into a .wav speech file) play a MATLAB array of speech samples as an audio file play a sequence of MATLAB arrays of speech samples as a sequence of audio files record a speech file into a MATLAB array plot a speech file (MATLAB array) as a waveform using a strips plot format plot a speech file (MATLAB array) as one or more 4‐line plot(s) convert the sampling rate associated with a speech file (MATLAB array) to a different sampling rate highpass filter a speech file (MATLAB array) to eliminate hum and low frequency noise plot a frame of speech and its associated spectral log magnitude plot a spectrogram of a speech file (MATLAB array) plot multiple spectrograms of one or more speech files (MATLAB arrays)
Read a Speech File into a MATLAB Array
• • [xin, fs, nbits] = wavread(filename); [xin, fs] = loadwav(filename); – filename is ascii text for a .wav‐encoded file which contains a speech signal encoded using a 16‐bit integer format – xin is the MATLAB array in which the speech samples are stored (in double precision format) – fs is the sampling rate of the input speech signal – nbits is the number of bits in which each speech sample is encoded (16 in most cases) – program wavread scales the speech array, xin, to range −1≤xin≤1, whereas loadwav preserves sample values of the speech file and hence array xin is scaled to range −32767≤xin≤32767 [xin1, fs, nbits] = wavread(‘s5.wav’); [xin2, fs] = loadwav(‘s5.wav’);
• •
Read a Speech File into a MATLAB Array
• • • • • • • • • • • • • • • • • • • • • • % test_wavread.m % test waveread function % % read speech samples from file 'test_16k.wav' into array x1 using wavread % routine