MATLAB Answers

How to decrease the speed of an audio signal in MATLAB???

74 views (last 30 days)
Hello,
How can i decrease the speed of an audio signal??
is there any simle methode to do so?
should i alwayse use FFT ???
or it used only if I want to change the pitch of the voice?

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Dec 2018
For audible output purposes: use a lower Fs (sampling frequency) for the audio output.
If the sampling frequency is to be maintained: resample() as-if to a higher frequency, but play at the same frequency. For example if you were to duplicate every input sample, making the output twice as long, but play it at the same rate, then what used to appear 1/2 second in would appear 2*1/2=1 second in, so we can see that the output would have been effectively slowed down.

  4 Comments

Show 1 older comment
Walter Roberson
Walter Roberson on 12 Dec 2018
I tried to replace 'dsp.AudioFileReader' with 'audioDeviceReader' with same parameters
? With the same parameters? The first parameter is a file name, and audioDeviceReader would not accept a file name.
fatima alansari
fatima alansari on 13 Dec 2018
sorry, i forgot to tell that i removed that parameter..
this is what i did...
%{
reader = dsp.AudioFileReader('SpeechDFT-16-8-mono-5secs.wav'
, ...
'SamplesPerFrame',AnalysisLen, ...
'OutputDataType','double')
%}
reader = audioDeviceReader('SamplesPerFrame',AnalysisLen, ...
'OutputDataType','double');
Walter Roberson
Walter Roberson on 13 Dec 2018
If I hack at it and set the analysis length to 256, same as the frame length, and make some small fix-ups, then I can get it to execute without error -- but the gain it calculates is small enough that the signals come out too quiet to hear.
The idft object is configured to expect conjugate symmetric input. However, the phase correction that is being done is not producing exact conjugate symmetric. When I set the analysis length to 256 then the only point that was not properly symmetric was the middle one, point 129 of 256. For even length fft, the middle point needs to have a 0 imaginary component in order for conjugate symmetric to work out, but it was showing a small imaginary component. That was probably due to the fact that the representation of pi is truncated and that argument reduction is not perfect, so sin(N*pi) for integer N can turn out to not be an exact 0. In my version, I added a fix-up for that situation.
I do not know yet what is happening for the case where the analysis length is smaller than the window length. Problems with the lack of conjugate symmetry, yes, but I have not traced far enough to figure out would be reasonable.

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!