![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: Rotary doppler expression? |
dan.dan Member |
![]() ![]() ![]() I've been thinking about trying to put together a good model of a leslie organ speaker. The first challenge seems to be building a mathematical model of the distance of the virtual speaker from the virtual microphone, which would be used to create the doppler effect. I came up with this expression: If r is the radius of the circle of rotation, and md is the distance of the microphone from the edge of the circle, and w represents angular velocity, or 2 * pi * f, and f is rotations per unit time, then the distance of the microphone from the speaker is given by: sqrt((((1-cos(w*t))*r) + md)^2 + (abs(sin(w*t)*r))^2) This is based on dividing the problem into the distance in the front-to-back direction, which varies sinusoidally as ((1-cos(w*t))*r) + md, and the distance side to side, which varies as abs(sin(w*t)*r). The two are combined by the Pythagorean Theorem to get the resulting expression above. After going through this exercise, I have two questions: Firstly, is there a simpler way? It seems like rotary movement is pretty fundamental, so I was wondering if there is already some primitive in Kyma's Smalltalk, or else some sound class that already provides this functionality. I'm having fun trying to model it, but I was just wondering. Also, my trigonometry is rusty, so maybe the expression can be simplified, and thus be made more efficient computationally. Secondly, how do I create this expression in Kyma? I'll eventually get that far in the manual, but I was wondering if somebody who is already there could help jump start me on this one. Once I have the function for distance by rotary motion as a fundamental thing, combined with the simpler function for the speaker's angle with respect to the microphone, which simply varies with (w*t) modulus (2*pi), I can use delays, level scaling, and time varying filtering to build the rest. Thanks in advance, IP: Logged |
pete Member |
![]() ![]() ![]() Hi Dan I Know you wanted to use less DSP juice, but this is a way that uses more DSP juice but thats because it does it at sample rate and not control rate. If you start with two similar osc modules feading a chanel join module One of the oscilators shold have a a sin wave and the other one should have a the cosine wave. Make sure that the controls are the same and that the level is reduced. This level represents the diamiter of the spin. This channel join feeds a mixer and the mixer also has a "constant" module with the distance control in it. For most cases the control rate will do, as the delay line module can smooth out the steps. But if you had to do it at full sample rate you would probably need petes modules with wrap around maths and then to consruct your own delay line useing ram readers and writer. Probably not that useful but gives you something to think about. Pete [This message has been edited by pete (edited 14 May 2004).] IP: Logged |
dan.dan Member |
![]() ![]() ![]() Thanks. This gives me somewhere to start. Regards, IP: Logged |
SSC Administrator |
![]() ![]() ![]() Interesting problem! The Doppler shifts in the Kyma Sound Library are based on the idea of using a delay line as a physical model of the waveform in the air (and then moving faster or more slowly through that delay line to simulate an approaching or receding sound source). The DelayScale parameter is the "position" of the sound source. You should be able to use your function for distance in that parameter field for the Doppler shift. The attenuation, however, should probably be controlled by sinusoidal function (not the linear function that is used for the side-to-side Doppler shift example in the library). Now, for how to translate your trigonometric expression into a CapyTalk expression for the DelayScale field. I think you might be able to simplify your expression using the Law of Cosines. Imagine a circle with the speaker on the circle and the microphone some distance off to the right of the circle. Draw a line from the center of the circle out to the microphone and label it 'a'. Draw a line from the center of the circle up to the speaker at some point on the circle and label it 'b' (it should be the same length as the radius). Then draw a line from the speaker on the circle out to the microphone and label that one 'c' (your distance from speaker to microphone). The angle, theta is angle between a and b. Then you can use the Law of cosines (a more general version of the Pythagorean theorem because it works for *all* angles, not just right triangles), to get c = sqrt (a^2 + b^2 - (2ab * cos(theta))) You could paste a sinusoidal oscillator into the parameter field for the cos(theta) part of the expression. Also, since the parameter field expects a value between 0 and 1, you should rescale the expression by dividing by the largest distance: a + b. The CapyTalk expression should look something like this: (!MicToCtr ** 2 + !Radius ** 2 - (2 * !MicToCtr * !Radius * [Oscil] L)) sqrt / (!MicToCtr + !Radius) I *think* the attenuation function could just be controlled by a Cosine oscillator * 0.5 and plus 0,5 so it is offset to be all positive values. It's an interesting problem. Please let us know how you get on with your experiment! Thanks. IP: Logged |
dan.dan Member |
![]() ![]() ![]() Thanks! I thought somebody might be more up on their trigonometry so as to be able to provide a simpler formula. I'll try this as soon as I get a chance. (We are away from home for a couple of weeks at the moment.) As far as the attenuation, I was thinking it would be modeled by relating it to distance by the inverse square law. One thought would be using a "constant" sound to encapsulate the distance formula you provided, and then pasting that into an expression like ((!MicToCtr - !Radius) ** 2) / ([Distance] ** 2) The numerator should serve to scale the expression so it is 1 at the closest possible distance of speaker to microphone, and it should decrease in square proportion to distance from there. That leaves the problem of the time-varying frequency response of a real rotary speaker. On axis, the horn would probably have a resonant peak somewhere in the 2 kHz range that would diminish off axis. In an actual rotary speaker, the high and low components go through a crossover, and there are two different rotary components. But I thought I could simplify the model simply by adding a peak that varies axially between some level of boost and flat. The peak level would vary with the incidence angle, so a triangle function that is carefully synchronized with the distance function seems like it would do the trick. Some kind of resonator would probably be a reasonable model, such as a two-pole filter where the pole radius is varied between zero and something less than one by the triangle function (scaled). This would be an approximation, but probably a pretty good starting place. One last consideration is that the ambient field would actually be excited constantly by the speaker without respect to its rotational position. There is probably a lot of complexity to how that really looks (since the reflections still involve doppler shifts), but I thought I could model it by feeding the input signal through a time invariant filter into a reverb and mixing a little of that into the result to simulate the fact that the mics will pick up some little bit of ambient sound along with the direct. Thanks for your help. Any more ideas would be welcomed. I will put all of this into practice when I get home, and, if I can get it to work out, will happly post the result for anyone interested in using it. Regards, [This message has been edited by dan.dan (edited 18 May 2004).] IP: Logged |
pete Member |
![]() ![]() ![]() Hi Dan When trying to model what happens in the rotary speaker, we can try to be totally accurate or cut corners with the less important bits. I suspect that the formula to determine the distorted sine (the exact distance) is one of the less important bits. Consider the mic at a very long distance away from the speaker, then the left and right movement adds next to nothing to the distance, and the forward back movement (which determines the doppler shift) will be a simple sine wave. I suspect that when you make the final model, you could replace the complex distance formula with a simple sine wave and not really notice any difference. What is important is that while the speaker is moving towards you and causing a rise in pitch, the speaker can at the same time be moving away from the wall that is reflecting the sound back to you (causing a lowering in pitch). This means that you can hear both pitches at the same time and this is something our ears are very sensitive to. And even more, the speaker could be pointing straight at the wall and not towards us so that the reflected sound could be brighter than the direct sound for this instant of time. If the model were made by simply using one controlled delay which became brighter as the pitch changed from high to low, and then that signal were then put through a reverb, this would not emulate the times when the source signal had a loud transient (Snare drum) which sounded while the speak was pointing away from the listener. This is because the reverb could not brighten up the times in the signal that already been dulled down by it's one and only input sound. Maybe a better way to emulate the rotary speaker would be to use a delay under the control of a sine wave going through a filter under the control of the same sine wave that had been off set and clipped such that only the upper peaks of the sine wave allowed the treble through. Then repeat this model a few times but with different phases of the sine. It probably wouldn't need that many delays to sound quite real. Does this make sense? Pete IP: Logged |
dan.dan Member |
![]() ![]() ![]() Hi Pete, I think I understand what you are saying. I was planning to deal with that problem by essentially emulating a stationary speaker into the reverb and mixing the result in with the moving speaker dry. That doesn't cover the doppler shifts in the ambient field, but it is an approximation. In most cases where I have worked with leslie cabinets, the mics were placed a few inches away from the circle of rotation. In that scenario, the shape of the distance curve will be quite a bit different from a sine--approaching a full-wave rectified sine. When the speaker passes the microphone, the derivative flips dramatically, with the motion changing instantly from approaching to moving away from the microphone. (I tried some plots in Octave to visualize it.) You may be right about not hearing a difference, but I was going to approach it by trying to make the most detailed model I can in a short period of time and see how it comes out. I'm "punting" on the doppler shifts in the ambience because I want to keep the scope of this work under control. Thanks, [This message has been edited by dan.dan (edited 19 May 2004).] IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() ![]() |
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.