Question

In Android, the SoundPool.play API allows for playing sound effects. I'm wondering how I should alter the parameters to achieve a doppler effect:

public final int  play (
    int soundID,
    float leftVolume,
    float rightVolume,
    int priority,
    int loop,
    float rate) 
Was it helpful?

Solution

Doppler frequency shift formula is: f = f0 * (c + vr) / (c + vs), where vs/vr -- speed of sender and receiver, and c is the speed of the sound (300m/s for air), you may use (c+vr)/(c+vs) as your rate parameter in play().

Here's additional info on Doppler shift, if you need it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top