DSPRelated.com
Forums

Can a wav be pitch shifted multiple octaves?

Started by wbrown338 October 6, 2008
Greetings:  

I'm a programmer new to working with DSP related algorithms and have run
into an issue with my current project.  I need to ask the experts to get
some better understanding of this.

My question is can a wave file segment be pitch shifted multiple octaves
up or down?

I have a wave file segment with these (Java audio format) characteristics:

PCM_SIGNED 25000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian

The unaltered sound/pitch of this segment occurs on key/note 55 where
middle C is note 60.  

I need to use the samples from the wave segment to scale down to key/note
0 and up to note 67.  I have a second wave segment that needs to go from
key/not 67 - 96.  

With the authors permission, I am using the FFT routine found here
http://www.adetorres.com/keychanger/KeyChangerReadme.html to shift the
segment up 1 octave (12 half steps) or down 1 octave (12 half steps).  

This works fine for 1 octave in each direction and I am able to hear the
sound of the notes go lower 12 half steps and up 12 half steps.  This takes
me down to note 43 and up to 67.  After the octave has passed, the lower
and upper half steps become in audible.  I don't know how to shift the wave
segment, an octave lower so that I can use the FFT routine keep shifing it
downward.  Is this possible?  

I do not know if there is no more sound is because I have reached some
physical ceiling on the wave file properties or If I need to use some other
technique to change the wave segment down multiple octaves.

Is there someone in this DSP community who can comment on this issue or
suggest a way that I might be able to achieve the lower picth shift with
the original segment? 

Thanks.
Bill.
  


wbrown338 wrote:

> With the authors permission, I am using the FFT routine found > here http://www.adetorres.com/keychanger/KeyChangerReadme.html > to shift the segment up 1 octave (12 half steps) or down 1 > octave (12 half steps).
Do you mean "the pitch-change routine using FFT" or really just "the FFT part of that code"? I assume the former.
> This works fine for 1 octave in each direction and I am able to > hear the sound of the notes go lower 12 half steps and up 12 > half steps. This takes me down to note 43 and up to 67. After > the octave has passed, the lower and upper half steps become in > audible.
That page claims arbitrary shift amounts, which is certainly possible. Are you getting actual silence out? If so, I guess you have a debug session coming up to find at what stage the signal disappears. The result will answer your other question, whether you can continue using that code. Until that issue is cleared up, I don't think we can tell you anything definite. Martin -- Quidquid latine scriptum est, altum videtur.
On Oct 6, 12:27&#4294967295;pm, "wbrown338" <wbr...@colorfulsoftware.com> wrote:
> Greetings: &#4294967295; > > I'm a programmer new to working with DSP related algorithms and have run > into an issue with my current project. &#4294967295;I need to ask the experts to get > some better understanding of this. > > My question is can a wave file segment be pitch shifted multiple octaves > up or down?
by "pitch shifting", i presume you mean changing the pitch without changing the length or tempo of the sound. is my presumption correct? sometimes the term is used to mean shifting the pitch simply by speeding up or slowing down the entire sound file. this problem is easier and well-defined. it's the same as sample rate conversion. the other kind of pitch shifting is closely related to "time scaling" where an audio sound is sped up or slowed down without affecting the pitch. anyway, either kind of pitch shifting can exceed an octave, but when you go to extremes, watch out for artifacts (like aliasing when extreme upshifting and other nasties when extreme downshifting). if your original sound is a musical note that is reasonably harmonic (not bells), you need no FFT to do it. for that restricted class of "quasi- periodic" signals, time-domain methods (involving a good pitch detector and splicing) work well, perhaps even better than FFT methods (like the phase vocoder or sinusoidal modeling).
> I have a wave file segment with these (Java audio format) characteristics: > > PCM_SIGNED 25000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian > > The unaltered sound/pitch of this segment occurs on key/note 55 where > middle C is note 60. &#4294967295; > > I need to use the samples from the wave segment to scale down to key/note > 0 and up to note 67. &#4294967295;I have a second wave segment that needs to go from > key/not 67 - 96. &#4294967295;
are you just playing the sound file and looping? r b-j
Thanks r-b-j for the information. 

> if your original sound is a musical note that is reasonably harmonic
(not
>bells), you need no FFT to do it. for that restricted class of "quasi- >periodic" signals, time-domain methods (involving a good pitch >detector and splicing) work well, perhaps even better than FFT methods >(like the phase vocoder or sinusoidal modeling).
I was not aware that there are other methods besides using FFT (average magnitude difference function AMDF) to change the pitch of audio samples. I have an audio sample (set of pcm bytes) with reasonably harmonic sounds likes bass guitars so I think this AMDF method can work. I've read a description of the algorithm for this type of technique here: http://cnx.org/content/m11714/latest/ but is not making much sense yet. I'm also not sure what you mean by splicing, Can you describe splicing a little more here or point me in the direction of some pseudo code or working example that I can study to try to understand it better for my project?
>are you just playing the sound file and looping? >
These samples are coming from a soundfont file and are looped when a given key is pressed. I have the loop points and keyboard note for the raw sample at hand but am not sure how to use them to shift the pitch up or down and need more clues. Thanks again for you insights. Bill.