I need to speed up audio playback for certain sound effects, so that NPCs talk faster in the game.
This effect works great in-game, apart from the muffle and echo effect it causes.
It kind of sounds like the character is in a bathroom.
Here’s some example code, (using hardcoded values currently):
float default_frequency = 0;
pSoundEffect->getDefaults( &default_frequency, NULL, NULL, NULL );
float frequency_update = (default_frequency * (190/100.0f));
pChannel->setFrequency( frequency_update );
FMOD::DSP *pDSP = NULL;
FMODsystem->createDSPByType( FMOD_DSP_TYPE_PITCHSHIFT, &pDSP);
pDSP->setParameter( FMOD_DSP_PITCHSHIFT_FFTSIZE, 1024 );
pDSP->setParameter( FMOD_DSP_PITCHSHIFT_PITCH, 0.5 );
Again, the above code does actually work to speed up the audio playback. It’s just that it sounds distorted.
I’m only using this effect minimally, but it is important.
Any help would be appreciated.
- SCSniper asked 6 years ago
AVI download here (h.264 encoded):
http://www.svencoop.com/davemcd/dsp_pit … _issue.avi
Audio is 256kbps mp3, almost identical to in-game.
The scientist on the left (bright fellow) has the above code (frequency + dsp pitch shift) applied to speed up his audio.
The scientist on the right (hazardous materials suit) uses the same speech files, but does not have the effect applied.
I can see what you’re talking about now, that effect is due to the artifacts introduced by the pitch shift dsp. A pitch of 0.5 is the absolute boundary which will introduce the most artifacts, perhaps try using a less extreme value. In my tests I have found that increasing the FFT size will increase the echo-iness of the pitch shift which makes sense. Have an FFT size which is too small reduces the quality of the pitch shift. I suggest tweaking all the pitch shift parameter until you find the effect you’re looking for.
Thank you for looking into this.
I tried messing with the parameters quite a bit, but I couldn’t get rid of the echo and such.
Could the issue be related to the source audio quality perhaps?
The sound effects for most NPCs in the game use the wave format @ 11025 hz.
I tried speeding up the audio playback by using a combination of getPosition() and setPosition( + 10 ).
While that did work, it caused sound artifacts (clicks and pops). I’m guessing I might need to look into writing a plugin.
It would probably sound better with higher sample rate audio. Something that might be worth trying is putting the DSPs on a channel group instead of the channel so it’s after the resampler upsamples it to 48 kHz. I doubt it would make much difference but it might be worth a try. Instead of using setFrequency, you would use ChannelGroup::setPitch which is the same thing except the units are multiplier so pitch = 1 is no change, pitch = 0.5 is half speed.
Please login first to submit.