Sync trigger for cycle~ object

Nov 14, 2011 at 8:16pm

Sync trigger for cycle~ object

Hello. I am trying to make a multi-wave oscillator.

Most of the standard features I have figured out (tuning, PW, etc.)

The one feature I haven’t quite figured is Sync control of a sine wave. (i.e. the wave of one sine wave controls the reset of another.)

I know the [tri~], [saw~], and [rect~] all have the sync input (sync trigger) and they seem to be working fine. my only issue is getting the sine wave [cycle~] to sync.

http://cycling74.com/forums/topic.php?id=16454
^^ The above thread is the closest I’ve seen it come, but the issue is that it resets to a value of 1, so when you have another oscillator driving your main, there’s clicks and pops all over.

I’d paste what i have so far, but A)I don’t know how to do it for the forums B) what I have isn’t much, and it’s not needed to solve the issue.. I don’t think.

Thanks all!

#60012
Nov 14, 2011 at 8:32pm

if you want to do band-limited hard sync with sinusoids, you need to look into making an external with minBLEP. You can pull the source code from the GPL TAL-noisemaker synth.

Alternatively, you can do Casio CZ style “windowed” hard sync like this…

– Pasted Max Patch, click to expand. –
#216065
Nov 14, 2011 at 8:45pm

I think your reset to a value of 1 is to do with the cycle object outputs a cosine wave rather than a sine, so you’d have to have a phase offset of 0.75 for the cycle object relative to the other wave shapes. As for waveform discontinuities you’d need to work out a change in phase over time (say 50ms or so maybe) using line~

#216066
Nov 14, 2011 at 8:55pm

Thanks for the response Oli.

The patch you posted is not quite what i”m looking for. I’m not even sure if i fully understand everything going on in that patch. Here’s a look at what I’m trying to accomplish.

The two pairs on the right are syncing fine, but two cycle waves I can’t get to sync.

Also, I looked into minBLEP, and it seemed a little confusing.

– Pasted Max Patch, click to expand. –
#216067
Nov 14, 2011 at 8:57pm

Hey Terry. Thanks for the response.

I wouldn’t say I’m a MaxMSP noob, but I will say I know very little about all the math functions throughout the software. Would you mind pasting an example?

thanks!

#216068
Nov 14, 2011 at 10:50pm

This is adapted from the example posted in the thread you referred to before:

– Pasted Max Patch, click to expand. –

The patch you posted just before is not an example of synching using phase, but actually an example of phase distortion.

#216069
Nov 14, 2011 at 11:32pm

Here you go, hope it makes sense:

– Pasted Max Patch, click to expand. –
#216070
Nov 14, 2011 at 11:58pm

here is a non-bandlimited hard synced sine… perhaps more what the OP was after

– Pasted Max Patch, click to expand. –

>The patch you posted just before is not an example of synching using phase, but actually an example of phase distortion.

not really. true it is used on a synth famous for being a PD synth (the “resonant” waveforms), but this is actually hard sync…. windowed to smooth out the discontinuities and hence the aliasing. The other waveforms on the CZ synths are actually more “phase distortion”, since there the phase accumulator is being warped.

Here is a similar version of the first patch i posted without the windowing

– Pasted Max Patch, click to expand. –
#216071
Nov 15, 2011 at 3:42am

you guys rock. however, I don’t think we’ve quite achieved what I’m looking for. i’m trying to emulate an analog synth (in the most basic way) by connecting the output of one oscillator to the ‘sync’ input of another oscillator to have them in sync. (note: Not trying to emulate the “unstable” sound of analog circuitry, but rather the overall experience.)

So. having said that, Oli, I think you are on a different page than the rest of us. I’m not sure how to translate your patches into what I’m trying to do. see the patch below, which is what I’m trying to do.

(note: the gate represents connecting/disconnecting the output of one oscillator to another)

– Pasted Max Patch, click to expand. –

Sorry I’m being so confusing.

Terry, i think we’re getting closer, but I’m not so much interested in getting oscillators in phase. It’s more important to figure out how to get that value of .75 (in your adapted version of the patch from the previous thread) to be triggered each time an external oscillator makes its cycle.

I hope that makes sense.

Thanks again for your help!
- Argee.

#216072
Nov 15, 2011 at 8:57am

I think Oli’s non-bandlimited patch did what you want.

– Pasted Max Patch, click to expand. –
#216073
Nov 15, 2011 at 11:40am

Would I be right in thinking Oli’s windowed patch is almost Vosim?
I’ve been trying to create a little Vosim patch recently, and would welcome any input. I suspect there’s more to it, but it’s interesting in itself anyway.
I must admit, I’d missed the +~ .75 trick, but it doesn’t seem to make any audible difference,
cheers
Roger

– Pasted Max Patch, click to expand. –
#216074
Nov 15, 2011 at 8:52pm

Chris! What you have posted seems to work, audibly, but I’m not sure if it is *exactly* what I want….My only concern for it is that, according to the scope, it appears to be all positive values, which I’m okay with, as long as there’s no damage done to headphones/speakers/etc. I wonder how this would compare with an analog system. But, it produces the desired result, so I believe I’ll be alright with it for now!

My only concern for it is that, according to the scope, it appears to be all positive values, which I’m okay with, as long as there’s no damage done to headphones/speakers/etc. I wonder how this would compare with an analog system.

Since I am using this for a school project, I don’t want to turn this in and say “viola! a sync’d sinewave oscillator!!!” I’d like to be able to explain how it’s working. Chris (or oli), would you mind explaining what is going on inside that patcher?

Thanks again guys!

#216075
Nov 16, 2011 at 12:11am

“Since I am using this for a school project, I don’t want to turn this in and say “viola! a sync’d sinewave oscillator!!!” I’d like to be able to explain how it’s working. Chris (or oli), would you mind explaining what is going on inside that patcher?”

I suggest you figure that out for yourself; otherwise you haven’t necessarily learned anything. There’s plenty of resources (help files, tutes etc) to look at.

#216076
Nov 16, 2011 at 1:51am

THe reason it’s all positive is because that’s what you’re asking it to do. You are syncing the sine at twice its rate. This means that it goes through the first half of its cycle, then gets synced, and starts to do it again.

#216077
Nov 16, 2011 at 2:36pm

Ahh.. Well that makes sense. I suppose at different frequencies, it’d look differently. Thanks everyone!

check out my oscillator here:

http://cycling74.com/forums/topic.php?id=36325&replies=4#post-176460

I also have posted an LFO. I’m sorta modeling these after the euromax objects (sorry I don’t have a link to those). I may or may not continue these series as my graduate thesis work, but it’s a good start. I may continue for fun.

#216078
Nov 16, 2011 at 2:43pm

if you want to play a “waveform” (== a cycle~ buffer) once, and then another one after the first one
has finished, i think you could just use index~ play~ and buffer~ instead.

you, the programmer, know how long a sinewave or a tri wave will last when played at note number
60 (or when played at rate*2 or at 5 Khz) and so you could use index~to play one after another.

#216079
Nov 16, 2011 at 2:57pm

@roger, concerning vosim, this could be a model to work with.

– Pasted Max Patch, click to expand. –
#216080
Nov 17, 2011 at 9:33am

Thanks, that makes much more sense!
Cheers
Roger

#216081
Nov 17, 2011 at 2:32pm

@jvkr
beautiful, fantastic, generous and supremely pedagogical example.
thanks.

#216082
Nov 17, 2011 at 5:01pm

here’s a gen~ version, I think.

– Pasted Max Patch, click to expand. –
#216084
Nov 18, 2011 at 8:50am

nice… but a bit glitchy. maybe the parameter changes need to be done at the beginning of each pulse?

#216085
Nov 18, 2011 at 3:03pm

The more charitable man might have concluded or wondered whether or not it was done *on purpose* because I liked the way it sounds, and also because it’s always interesting and useful to leave things in a state where other people can feel as though they can “contribute” by making a few judicious changes (otherwise you’re just doing people’s homework for them). Feel free to make those mods and it’ll be um… “perfect.”

#216086
Nov 18, 2011 at 3:23pm

sorry if I offended your ego somehow. When i have time to investigate more and learn gen~ i may well try and add said mods to the nice patch you posted.

Regarding doing peoples homework for them… the OP didn’t say it was a homework question initially. If he had I and others would likely have been more careful about just providing the solution. But anyhow phase reseting a sine wave in Max at sample-rate is a fiddly business – easiest shown with the solution imho.

#216087
Nov 18, 2011 at 7:02pm

ooh, those are fun the last few comments…

anyhow, i had some fun with this this afternoon. in gregory’s spirit of “it might not be very good though”, here it is…

@oli, “phase reseting a sine wave in Max at sample-rate” – actually remarkably easy with [gen~]. although i might have misunderstood…

i decided to sync to the phasor, although this means parameter jumps from slow/low (long phasor freq times) to high are a bit lame. it is non-glitchy, although in the spirit of those who like it glitchy, i provided a “mode” toggle so you can choose between them.

[codebox]‘s in the [gen~] are just for patch cleanliness (as we still have no encapsulation in [gen~]), nothing more.

and one more thing i changed: personally, i do not think using [param] is much cop for signal rate controls.

please mod away…

thanks all!

– Pasted Max Patch, click to expand. –
#216088
Nov 18, 2011 at 7:47pm

IMO, ArgeeBrobot seemed to be making a real effort to do something, unlike some of the other “my assignment is…” sort of posters.

#216089
Nov 19, 2011 at 2:22am

That looks nice, pid. Sounds pretty good, too. Thanks for getting the obvious tell about using messages not being the best fit.

When the next version of Max is released, you’ll find my considerably more traditional values approach – I wanted to keep it really simple [gen~ for the other N% and all. :-) ]. But I’m sure you’ll notice the similarities.

The *other* reason for doing the VOSIM patch is personal. Stan Tempelaars (VOSIM’s daddy) was one of my teachers, once upon a time. Nice guy, and a great teacher. May his name be for a blessing.

#216090

You must be logged in to reply to this topic.