openal pitch shift
Can anyone tell me why the volume becomes lower when I make the pitch higher in openal? The higher the pitch, the lower the volume.....
alSourcef(source, AL_PITCH, 1.2f); alSourcef(source, AL_GAIN, 1.0f);
with this setting, the volume is still very very low. is there a way to cheat it to make the gain above 1? Maybe this has some开发者_如何转开发thing to do with distance??
FYI, the source is a voice recorded from AVrecorder, so I cant set the source volume any higher.
Afaik it is not normal that the amplitude would change in function of pitch change. When pitch is set higher than original, openal speeds up the sample by the multiplier (afaik) using some sort of interpolation when the multiplier is not whole.
There might be some rare cases where the amplitude changes, but probably not for longer samples with lots of frequency content (as most natural sounds tend to be)
How loud we perceive that amplitude depends on the pitch, see equal loudness contour
Maybe that effect explains your question?
As workaround you could lower the gain for normal pitched sounds and use higher gain for higher pitched sounds.
Or multiply the source data by a multiplier before attaching/passing to a buffer.
精彩评论