Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this document? Why not share!

- Pds 2011 3-balotario de preguntas pc2 by jcbenitezp 9902 views
- Syllabus procesamiento digital de ... by jcbenitezp 5263 views
- Utp pds_s5y6_sistemas_lit by jcbenitezp 802 views
- Utp pds_l5_transformada discreta d... by jcbenitezp 3743 views
- Utp pds_s7y8_dft y fft by jcbenitezp 6104 views
- Utp pds_s11_filtros [modo de compa... by jcbenitezp 3049 views

723 views

Published on

No Downloads

Total views

723

On SlideShare

0

From Embeds

0

Number of Embeds

4

Shares

0

Downloads

97

Comments

0

Likes

1

No embeds

No notes for slide

- 1. ECE 4680 DSP Laboratory 2: Speech Signal Processing Using MATLAB Sound FunctionsThis lab is to be worked in teams of most two. Each team will submit a lab report describing theirresults. An E-mail ZIP package containing .wav files will also be turned in or a lab demo to theinstructor, to allow evaluation of the processing algorithms. The lab due date is 4:30 PM Thurs-day, September 17, 2009.IntroductionUsing a basic PC sound system and MATLAB wave file processing functions, near real-time audiosignal processing can be investigated. In this experiment you will become familiar with *.wavfiles and MATLAB functions for reading and writing wave files from the MATLAB work space. The basic investigation for this experiment will be the use of butt splicing to either speed up orslow down the playing time (delivery) of a recorded speech signal (in MATLAB a vector), withoutaltering the pitch. Think about this for a moment. If a signal is played back at a sampling rate oftwice the original record value, the play back time is cut in half, and the pitch is doubled. Likewiseif a signal is played back at a sampling rate of one half the original record value, the play backtime is doubled, and the pitch is halved. Using butt splicing of speech segments it is possible tomaintain the recorded pitch while either slowing down or speeding up the play back time.Digital Signal Processing and Windows Wave FilesWith the multimedia enhancements to Windows came the ability to handle digitized audio signalsin what is known as the wave (*.wav) file format. A Wave audio file is a binary file format forstoring continuous-time audio source material, in sampled data form, as a result analog-to-digital(A/D) conversion. A sound system equipped PC generally includes two channels for recordingand two digital-to-analog (D/A) converters for play back. The block diagram of Figure 1 depictsthe DSP capability that a sound system equipped PC typically has. The current DSP capability connected with wave file manipulation is not geared toward real-time processing. It is best suited to what one might call near real-time signal processing. Signalscan be processed after being initially recorded, then saved as a new wave file for play back atanother time.Wave Files and Sound in MATLABThe vector signal processing capabilities of MATLAB make it ideally suited for post processing, orIntroduction 1
- 2. ECE 4680 DSP Laboratory 2: Speech Signal Processing Using MATLAB Sound Functions Near Real-Time DSP Using C/C++, multimedia tool, other, e.g., MATLAB A/D D/A Conversion Conversion 8 or 16 bits 8 or 16 bits RAM or Hard Disk From PC Fs Storage as Fs To PC Microphone *.wav Speakers File A/D D/A Conversion Conversion 8 or 16 bits 8 or 16 bits Fs Fs Sampling Rate Choices: Fs = 8, 11.025, 22.05, or 44.1 kHz Figure 1: DSP capability of the typical sound card equipped PC.if you wish, near real-time processing, of windows wave files. There are four sound processingfunctions for a windows PC. Two functions are used in the playing of MATLAB vectors (matrices)through the PC sound board, while the other two are used to read and write wave files to and fromthe MATLAB workspace. The functions are summarized in Table 1. Table 1: MATLAB sound functions for Win/Mac/Linux OS’s. MATLAB Sound Related Functions sound(y,Fs) Convert a vector into sound and play at sampling rate Fs. Amplitude values must lie between -1 and +1. soundsc(y,Fs) Convert a vector into sound and play at sampling rate Fs with automatic amplitude scaling. [y, Fs, nbits] = Load windows wav format sound file into workspace wavread(fname) variable y. Also returns sampling rate and bits/sample. wavwrite(y,Fs, Writes the data stored in the variable y to a WAVE file fname) called fname.As Figure 1 indicates *.wav files have many variations, ranging from single channel audioWave Files and Sound in MATLAB 2
- 3. ECE 4680 DSP Laboratory 2: Speech Signal Processing Using MATLAB Sound Functionsrecorded with 8-bits at F s = 8 ksps, up to the more memory intensive two channel (stereo) audiorecorded with 16-bits per channel at F s = 44.1 ksps. The MATLAB sound functions support all ofthis capability and allow a variable sample rate. To read a pre-recorded *.wav file simply type >>[y, Fs] = wavread(‘name.wav’;The audio signal is stored in the column vector y and sampling rate used to make the recording isreturned to variable Fs. To play the sound vector from within the MATLAB environment simplytype >> sound(y, Fs)where Fs may be altered from the nominal record value to speed up or slow down the vector play-ing time. For this experiment a nominal sampling rate of 11.025 kHz is recommended. An interesting feature of the sound function is that it will also play MATLAB matrices, column-by-column. This capability will be useful, and you will verify this in the experiments.Simple Rate Changing Independent of PitchWithout getting too detailed this section explains a simple technique for either increasing ordecreasing the playing time of a sound vector, without altering the sound pitch. Increasing the raterefers to decreasing the playing time, while decreasing the rate implies increasing the playingtime. Both operations can be solved in an approximate way by butt splicing speech segments ofsay 45 ms or so. Butt splicing in DSP is analogous to adding or removing segments of magneticrecording tape by end-to-end taping them together to form a new edited tape. Butt splicing ofspeech sequences thus implies that no transition smoothing is used, just a hard end-to-end connec-tion.Decreasing Playback TimeTo decrease the playback time, yet retain the proper pitch, all we need do is to periodically removeshort segments of the original speech vector, butt splice the remaining pieces back together, thenplay it back at the original recording rate. If the pattern is save 45 ms, discard 45 ms, save 45 ms,etc., the new sound vector will be half as long as the original, thus it will play in half the time. Agraphical description of the operation in terms of MATLAB matrices is shown in Figure 2. The seg-ment length may need to be adjusted for best sound quality.Increasing Playback TimeTo increase the playback time, yet retain the proper pitch, all we need do is to periodically repeatshort segments of the original speech vector, again using a butt splicing technique, then play itback at the original recording rate. If the pattern is say 45 ms, repeat previous 45 ms, save next 45ms, etc., the new sound vector will be twice as long as the original, thus it will play in twice thetime. A graphical description of the operation in terms of MATLAB matrices is shown in Figure 3.Again, the segment length may need to be adjusted for best sound quality.Simple Rate Changing Independent of Pitch 3
- 4. ECE 4680 DSP Laboratory 2: Speech Signal Processing Using MATLAB Sound Functions Input tstart =0 Speech 1 Vector y 45 ms 2 Reshape 1 2 3 4 ... M 3 Parse 4 ... 1 3 5 7 ... M M tstop Figure 2: Butt splicing to decreasing playing time yet maintain sound pitch.MATLAB Hint:>> A = [1 2; 3 4]A = 1 2 3 4>> [A A]ans = 1 2 1 2 3 4 3 4>> [A A]ans = 1 3 1 3 2 4 2 4>> [A A]ans = 1 2 3 4 1 2 3 4Simple Rate Changing Independent of Pitch 4
- 5. ECE 4680 DSP Laboratory 2: Speech Signal Processing Using MATLAB Sound Functions Input tstart =0 Speech 1 Vector y 45 ms 2 Reshape 1 2 3 4 ... M 45 ms 3 Concat. 4 ... 45 ms 1 2 3 4 M ... M 45 ms 1 2 3 4 M tstop 90 ms Figure 3: Butt splicing to increase playing time yet maintain sound pitch.Experiments 1. Create a short wave file using 16 bits per sample resolution, F s = 11.025 ksps, and dura- tion of about 30 seconds, using GoldWave or a similar wave recording application. 2. Import the wave file into the MATLAB workspace using the function >> [y, Fs] = wavread(‘name.wav’); 3. Verify that sound(y,Fs) plays the vector through the sound system, and that raising or lowering Fs changes both the duration and pitch of the message. Using the length of y and Fs determine the exact time duration of the played sound vector. 4. Verify that MATLAB plays a matrix by columns. First convert the vector y into a matrix using >> reshape(y, M, N), where M*N = length(y). Then play the matrix using sound. Verify that scrambled speech is heard if you play the transpose of your matrix. 5. Butt splice y by removing alternate 45 ms speech segments to halve the delivery time and maintain the same pitch. Export your modified speech vector back into a wave file and ver-Experiments 5
- 6. ECE 4680 DSP Laboratory 2: Speech Signal Processing Using MATLAB Sound Functions ify that it is playable. 6. Butt splice y by inserting redundant 45 ms speech segments to double the delivery time and maintain the same pitch. Export your modified speech vector back into a wave file and ver- ify that it is playable. 7. Try variations on 5 and 6 to improve the quality, or further alter the rate change. 8. Analyze your speech waveforms using the spectrogram function >> spectrogram(y,FFTLENGTH,Fs,[WIND],OVERLAP) Recall from ECE 2610 that a spectrogram is a frequency spectrum versus time plot. 9. Summarize your findings. 10. Prepare for instructor demo.Bibliography/References[1] Tim Kientzle, A Programmers Guide to Sound, Addison-Wesley, Reading, Ma, 1998.Bibliography/References 6

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment