urgent help with smbPitchShift

Discussion about the DSP Dimension's articles, tutorials and code.

Moderator: neuronaut

urgent help with smbPitchShift

Postby Cabrera » 31.01.2010 17:55

hello, I am very interested in the smbPitchShift code but I need help in understanding it...I have a few questions...
1) what fft algorithm is used in the smbFft?
2) what is the smbAtan2 function for?is it needed for the smbPitchShift to work?
3) and how is it that the tempo is not affected by the pitch shift?

- will appreciate your help very much. Thank you

-helen :D
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 31.01.2010 18:10

Cabrera wrote:hello, I am very interested in the smbPitchShift code but I need help in understanding it...I have a few questions...
1) what fft algorithm is used in the smbFft?


Cooley-Tukey. You can replace it with other (for example, non-power-of-2 FFTs) without affecting the actual algorithm, though.

Cabrera wrote:2) what is the smbAtan2 function for?is it needed for the smbPitchShift to work?


No. That function is there in case atan2() doesn't conform to the ANSI specification or the compiler throws a division by zero error - we have seen this with some compilers in the past. You can safely use the built-in atan2() of your compiler in all other cases.

Cabrera wrote:3) and how is it that the tempo is not affected by the pitch shift?


We're not changing tempo, we only change pitch. Please see the tutorial at http://www.dspdimension.com/admin/pitch ... ng-the-ft/ for details on how this is accomplished.

Best regards
--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 31.01.2010 18:52

thank you for the swift reply, its a big help...

so from what i understand, the smbPitchShift function incorporates the smbFft function which is a cooley algo. right?

but one more question...I read in dsp dimensions that the pitch shifting requires STFT, uhhm, what about it?

- thanks
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 31.01.2010 19:00

Not sure what you're getting at - could you be a bit more specific as to why you're asking this?

I'm not sure why you're specifically asking for the FFT algorithm used - how you calculate the result of the DFT is totally immaterial, you could as well use a straight DFT but you would get a very slow O(n^2) performance if you did.

STFT = Short Time Fourier Transform. A Fourier Transform applied to a short segment of the signal, typically using OLA or OLS to splice results together. That's exactly what we do in the tutorial.

HTH
--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 31.01.2010 19:16

uhhm, sorry if I'm not clear, hehe

uhhm, I was asking the algo because I am studying the code side by side with other fft tutorials and I just wanted to make sure if I am studying the right fft algo.
- so as I understand it the smbPitchShift function uses the smbFft function and also uses an STFT?

-btw i was also asking why it doesn't affect the tempo, because from my research, many pitch shifting codes and libraries affect the tempo because it is harder to design pitch shifting code that doesn't affect the tempo.

-thanks
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 31.01.2010 19:25

Cabrera wrote:I was asking the algo because I am studying the code side by side with other fft tutorials and I just wanted to make sure if I am studying the right fft algo.

If you're interested in learning about the DFT might I suggest this tutorial: http://www.dspdimension.com/admin/dft-a-pied/

Cabrera wrote:- so as I understand it the smbPitchShift function uses the smbFft function and also uses an STFT?

No, it uses smbFft() to achieve an STFT representation of the signal. These terms are not mutually exclusive (see http://en.wikipedia.org/wiki/Short-time ... _transform for more details).

Cabrera wrote:-btw i was also asking why it doesn't affect the tempo, because from my research, many pitch shifting codes and libraries affect the tempo because it is harder to design pitch shifting code that doesn't affect the tempo.

Pitch shifting never changes tempo. Sample rate conversion does - it can be used to change pitch and speed at the same time (like playing a record faster or slower). These two processes are sometimes (incorrectly) both called pitch shifting in some textbooks.

HTH
--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 31.01.2010 19:36

oww, I really got it mixed up...good thing you are very patient in answering my questions...
Now that things are much clearer, I am going to study the code closer.

-thank you, you are a lot of help :D
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 31.01.2010 19:55

No problem, you're welcome.

--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 14.02.2010 12:04

hello smb,

I have been studying the article on pitch shifting using the fourier transform but below are some things that i cant understand.
- i was confused on what technique on phase shifting was used (phase vocoder, etc?)
- how exactly was the magnitude and true frequency attained from the bin mag, bin freq, bin phase?
- i also can't understand the concept of overlapping an wrapping?
These were well explained in your article but I can't fully understand it.

thanks :D

-helen
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 14.02.2010 12:23

Hmm, if they are well explained then what exactly is it that you don't understand? I'm not being cynical here, just curious as to what aspects are still unclear to you. If you would post specific questions I'd be happy to answer them here.

The questions you're asking are too general - they would just make me cite from the article which explains the process which I guess would not be helpful to you if you have difficulties understanding it in the first place.

Thanks
--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 14.02.2010 12:42

uhhm, let me start with how i understand the pitch shifting is going to happen.hehe......

- so we split the signal into frames to be able to do stft. and the fourier transform provides us with bin freq, phase and magnitude (how?)
- from shift in phase, we know that there is a shift in frequency so just take the true frequency instead? also, is the magnitude the bin magnitude?
.....ill stop at this point for the mean time....

-thanks :D
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 14.02.2010 12:48

(1) yes and yes. Frequency is the first derivative of phase, which we exploit to calculate the bin's instantaneous frequency. Bin phase and magnitude are obtained by converting the Fourier transform coeffs from rect to polar coordinates.

(2) yes

--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 14.02.2010 12:59

- uhhhm, where do we get the fourier transform coefficients?
- silly question but i just want to make sure: are the bins the frames?
- moving on, when solving the true frequency...i cant understand how the wrapping and the overlapping is done?(this is in relation to the tables of pass 1 to 5 in the article)


-thanks :D
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Re: urgent help with smbPitchShift

Postby neuronaut » 14.02.2010 13:12

Cabrera wrote:- uhhhm, where do we get the fourier transform coefficients?

from smbFft()

Cabrera wrote:- silly question but i just want to make sure: are the bins the frames?

No. Please see our article on the Fourier transform for a more detailed explanation of the Fourier transform and how it works.

Cabrera wrote: - moving on, when solving the true frequency...i cant understand how the wrapping and the overlapping is done?(this is in relation to the tables of pass 1 to 5 in the article)

These are two separate issues both of which are covered in the literature quite extensively so I won't repeat them here. Some pointers:

Overlap: see any article on the STFT, windowing and OLA/OLS for details on how this works and why we need to have overlapping transform frames when we process a signal using the Fourier transform.

Phase (un)wrapping: see http://en.wikipedia.org/wiki/Instantaneous_phase for a good summary on how this works and why it is needed.

HTH
--smb
Free DSP tutorials by Stephan M. Bernsee at http://www.dspdimension.com
"There are 10 types of people in this world: those who understand binary, those who don't"
--Unknown
neuronaut
 
Posts: 1096
Joined: 17.11.2005 09:15
Location: Mainz, Germany

Re: urgent help with smbPitchShift

Postby Cabrera » 14.02.2010 13:34

okay. thanks for the good pointers...

if you don't mind...i have a few more questions regarding the code this time :D
- how does the code split the signal into frames?
- how does the fftFrameSize affect the output?
- how many samples are exactly needed (the article on dft says that only 2 samples are needed, i got this from the "nail" discussion)
- also, why do we only compute for the k-th partials true frequency?(is k the last partial?)

-thank you very much
Cabrera
 
Posts: 11
Joined: 31.01.2010 17:34

Next

Return to The DSP Dimension

Who is online

Users browsing this forum: No registered users and 1 guest

cron