Reputation: 19937
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)
Upvotes: 1
Views: 402
Reputation: 23498
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.
Upvotes: 1