I'm given given a stream of sound, as a serie of little buffers .

Is it possible to make this stream sound one octave up ? Or an arbitrary number of semitones up ? My goal is to add it to the original sound and to pass this through a reverb to create a "shimmer" effect .

My research so far was in the direction of doubling the frequency by creating a new buffer, and copying every other sample of the old one. This works, but I have a lot of noise and artefacts. I guess this is because the buffer length is not an exact multiple of the frequency but I can't change the buffer length and I have no prior knowledge of the frequency of the sound.

I don't think this is the place to post C/C++ code so I won't do it but I guess you get my idea.

I'm not looking for a high quality sound at all, i.e, a perfect, one octave up, reproduction of the sound,but at least something decent.

Any ideas please ?

  • $\begingroup$ Can you please expand a bit on what this "shimmer" effect sounds like with an example? If it is what I think that you mean then there is an effect (a specific processing pipeline) that will give you exactly that. In the meantime, yes, what you are referring to (pitch shifting) can be done and the way you have proceeded to do it (write to a buffer, read at a different speed) is one of the most basic ways to achieve it.. $\endgroup$ – A_A Dec 26 '16 at 17:59
  • $\begingroup$ to have prior knowledge of the frequency (or period) of the tone in your sound, you need something like a pitch detector. autocorrelation or AMDF or ASDF might be the way to do it. $\endgroup$ – robert bristow-johnson Dec 26 '16 at 18:23
  • $\begingroup$ @A_A: the effect I'm refering to can be heard here for example : youtube.com/watch?v=jhgFQbZ3p90 . Thanks for your help. And Robert, yes but it sounds like a bit overkill at this point :) $\endgroup$ – Dinaiz Dec 26 '16 at 18:40
  • $\begingroup$ I was going to suggest flanging but this "shimmer" thing is different indeed. To be honest, when I first heard it, I thought it was doing re-synthesizing but going through the specs, it doesn't seem to have an onboard little synth chipset. This is not just pitch shifting though. There is ADSR modification (to cut the strumming and only pick up the "whole" chord) followed by time stretching and pitch-shifting to create the voices followed by another ADSR to modulate the voices. $\endgroup$ – A_A Dec 26 '16 at 19:07
  • $\begingroup$ And following up with your buffer explanation (write to a buffer, read at a different speed), I have to read it faster than it's filled so I don't know what to put on the other half of the buffer ! $\endgroup$ – Dinaiz Dec 26 '16 at 19:11

After loads of research, I found a really good article about Short Time Fourier Transform (STFT), which can apply FT to a really small buffer, change it's frequency and apply IFT. There's even an implementation in C. You can find it here : http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/

As a "side effect", you also know the pitch of your signal in almost real time



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.