1

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) 
l33t
  • 13,497
  • 13
  • 77
  • 159
  • 1
    You'll probably not be able to do anything like this with the SoundPool. You'll probably have to compute and write the raw PCM data yourself with an [AudioTrack](http://developer.android.com/reference/android/media/AudioTrack.html) – Tim Nov 12 '12 at 21:48

1 Answers1

1

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.

lenik
  • 21,662
  • 4
  • 29
  • 38