On Fri, 17 Sep 2010, ronni montoya wrote:
Hello, i was wondering if somebody have implemented the doppler effect in pd? f' = f*c/(c-v)
You set a [vd~]'s delay to the distance of the sound source divided by c. A smooth change of delay will automatically switch the frequencies in the same manner that the doppler effect does (at low speeds).
You can also compute it from scratch, but note that you have to figure out the speed at which the source is going in _your_ direction, and that is radial.
If you stand at 10m from a straight road lane on which a car will pass at 40m/s, the car will be at the position 40*time on the road, and then draw a straight line from the road to you so that you have a right angle. Using Pythagore's theorem, (40*time)*(40*time) + 10*10 will equal to distance*distance :
[expr~ sqrt(pow(40*$v1,2)+pow(10,2))] gives the distance
but that's distance according to time, not distance-wise speed according to time. You can compute the latter using [rzero~], or you can use math (from grade 12) to do it all with one expr :
[expr~ 40*$v1 / sqrt(pow(40*$v1,2)+pow(10,2))]
But if you want to do it with [vd~], you do it with the first expr~.
And finally, note that the doppler effect formula that we use doesn't work well for the doppler effect observed in starlight, because it has to be corrected for very very high speeds (Lorentz/Einstein equation).
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC