Best way to get a numbers out of a signal generator
I'm trying to create a Doppler Effect plug using Max/MSP. I've worked out the pitch shifting (using gizmo~, which I assume is better than freqshift~), and now I want to adjust the pitch using a sine wave (if this makes sense), so the pitch goes up as the sine wave goes up and the pitch goes down as the sine wave goes down.
Now, I can make a sine wave using cycle~, and display it as a number using number~, but the gizmo~ code requires either an integer or floating point input, and I can't find any way to get a continuously going sine wave first as a number, and secondly into my gizmo~ code.
Any help gratefully received. I can post example code if necessary. Thanks very much.
you should try using tapin~ tapout~ instead.
it might look like a cheapo solution but in fact it is
very close to the physical reality of the doppler effect.
tapout~ will allow signal input for the time value.
-110
To answer your question directly, [cycle~]--[number~]-right outlet--[flonum]. Try it with a low freq for cycle~ (0.1) and a fast refresh interval on number (say, 10 ms), and you will get a good result.
However, as always, Roman's response is very much to the point. Using cycle~ as a LFO added to the time input to tapout~ gives a very good doppler effect, as demonstrated in the MSP tutorials.
Tim
Thanks very much guys, that'll teach me to look at the documentation before fighting with a problem by myself. A little bit of fine tuning and hoping that Pluggo doesn't have a paddy with it, and everything will be fine. Thanks again.
Ed Schroeder wrote:
> Any help gratefully received. I can post example code if necessary.
> Thanks very much.
The easiest and most simple way to do a doppler shift is a variable
delay line. It does it exactly the same way as nature. Doppler effect in
nature is changing the distance and the speed for traveling the distance
is the delay time. Thus a tapin~ with an audio rate controlled tapout~
is the most natural way to do it. Absolutely no artefacts at all!!! And
the CPU is around 1% of any other method which sounds so much worse...
I know this doesn't answer your question, but it will help you to get
the most realistic doppler imaginable...
Stefan
--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com
Quote: Stefan Tiedje wrote on Fri, 27 October 2006 22:59
----------------------------------------------------
> is the delay time. Thus a tapin~ with an audio rate controlled tapout~
> is the most natural way to do it.
What exactly do you mean by audio rate controlled tapout~? Do you mean adjusting the delay time of the tapout~ using a cycle~ or similar?
This is what I've got so far, I basically used the MSP documentation and doubled it up for stereo. I've noticed artifacts when adjusting the sliders in Logic though.
I assume from what you said that there is a simpler way to do things.
Ed
Ed Schroeder wrote:
> What exactly do you mean by audio rate controlled tapout~? Do you
> mean adjusting the delay time of the tapout~ using a cycle~ or
> similar?
You would normally smooth the change of a delay parameter with line~
> This is what I've got so far, I basically used the MSP documentation
> and doubled it up for stereo. I've noticed artifacts when adjusting
> the sliders in Logic though.
Its because you jump (instead of moving) the values with the scheduler
controled parameters.
There is one *~ too much and one missing line~:
> I assume from what you said that there is a simpler way to do things.
It's not necessary simpler, look at the
./examples/spacialisation/doppler.pat how to do a distance based delay.
then modulate the distance (with a line~ ;-).
I do not quite get what you want to do with a cycle and doppler, do you
invision a moving leslie cabinet? Thats the only real world object which
would need something like that. But then I would call the effect "moving
leslie" and not doppler.... ;-)
A mod for the crucial part of your patch regarding the initial question:
(To get a doppler effect, you'd need to calculate the time based on the
jump in the delay time to translate it into a speed...)
--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com
Thanks very much indeed. My original intent was to use freqshift~ or gizmo~ to adjust the frequency, while using a sine wave or similar to control them to create a kind of 'fake' doppler shift effect.
Since however, we (you) have come up with a better way of simulating it, it's not something vital for this project, though I might well put the moving leslie cabinet thing to use in another plug in.
Also, thanks for the modification to the patch. It's not massively important to get the doppler effect mathmatically accurate if you catch my drift, just to recreate the general effect. If you've used the GRM Tools Doppler plug in, that's the kinda thing I'm eventually aiming to get towards.
yes, if you want it smoother when using parameters
manually in logic, you can only 1- interpolate using
line~ and 2. use bigger sliders (= higher resolution)
when modulating using cycle or other audio stuff
this is of course not an issue.