I was looking for a way to timestretch, and found this in an old post: http://22.214.171.124/forum/viewtopic.php … imestretch
If I understand it correctly, basically says to double the pitch, then half the frequency. However what I am seeing is that the doubling the pitch and cutting the frequency in half yeilds the original audio with no time stretching, even if incressing the pitch 10x and dividing the frequency 10x, I get the same results.
Perhaps am doing this wrong, or a different way to accomplish this:
system->createSound(buffer, FMOD_DEFAULT, NULL, &sound2); system->createChannelGroup("Group A", &groupA); system->getMasterChannelGroup(&masterGroup); masterGroup->addGroup(groupA); channel->setChannelGroup(masterGroup); system->playSound(FMOD_CHANNEL_FREE, sound2, true, &channel); masterGroup->setPitch(10.0); channel->setFrequency(4410); channel->setPaused(false);
Thanks for any advice.
- bobtoms asked 8 years ago
Hi there bobtoms,
Event::setPitch is a time variant pitch shift effect (the same thing as Channel::setFrequency with a different interface). You need to use the pitch shift DSP unit which will do a time [i:159zd7zn]invariant [/i:159zd7zn]shift.
- Guest answered 8 years ago
Thanks, this works rather nicley, excellent smooth sound even with 50% slowdown!
One question: on a low end device like the iphone you get cpu bound. Setting the fft window to 512 you can get about 1/2 second of clear sound, then the gargled throat effect but no clicks, going to 1024, you get clear sound with clicks, i assume the cpu cant keep up at 1024. Same results with wav or mp3, 44100 or 22050, buffer sizes.
Since we only need about 5-7 seconds of timestretched sound at a time, would it make sense to somehow render 2-3 seconds into a buffer, then start playing, so there is no need to keep up(as long as you dont run out of buffer) and dont have to wait 7 seconds either for an ofline render?
And if so, is there an example how to set that up, roughly speaking?
Or any other possibilities?
Thanks so much, this is really nice software, and easy to use, even the low level api.
Let me ask this a little more intelligently:
Using the streaming API on the iPhone, so pre-buffering is built-in, but when using the dsp effects, is that still the case?
I think the effect I’m getting is called stuttering. Reading the faq, I verified the cpu at 75% sustained, according to instrument. I set FSOUND_SetStreamBufferSize to 500, 1000 & 2000. No difference.
I can not find the mixer buffer FSOUND_SetBufferSize api, so couldnt try that, and I read the DSP buffer is fixed in the iPhone.
To reduce this to the bare minimum, I am using the playsound sample app, with the timepitch dsp effect to test this, and a 22050hz mp3 file, but same results with a 22050 and 44100 wav file(no better or worse).
Also, the iphone is the 3G, not the newer 3Gs.
I cant help but think there must be somether factor. Should the timepitch effect work on the iphone without stuttering?
Please login first to submit.