Syncing Oscillator to envelope

Mike S's icon

Is there a way to sync a running oscillator to an envelope so that the wave will begin at 0 at the exact point the envelope begins?

jml's icon

Depends on exactly which type of oscillation you mean, but yes.
Check out wave~/zigzag~/index~.

jml

LoneMonad aka don malone's icon

the right inlet of [cycle~] is the phase
you can set it and start the envelope simultaneously

Mike S's icon

Still can't get this to work properly

Basically I have some waveforms in buffers, I'm trying to synthesise a kick drum and I'd like the start to be at 0 rather than -1 or 0.5

I've tried setting the phase to 0 with cycle when the envelope is triggered but that just doesn't work.

I'm a bit lost with how to do it with the other objects too.

Mike S's icon

sorry can't make a patch right now, I'll try tomorrow when I have more time.

Here's another go...

I have a buffer with 512 samples.

I have an envelope.

I want them both to start at exactly the same time.

Mike S's icon

Hey thanks for the patch, unfortunately it doesn't do what I want. How do you condense a patch in to that? is it just saved as text?

My waveforms are stored in buffers and played back with cycle~ (at the moment) my envelope is with adsr~

I'll try and post a patch when I can figure out how!

Mike S's icon

OK here goes

Max Patch
Copy patch and select New From Clipboard in Max.

Mike S's icon

OK, I get the idea, but its still not doing what I want : /

I've attached two pictures to try and illustrate the problem.

Mike S's icon

The images were taken from wavesurfer with a recorded file directly from the patch. They're zoomed in quite far so it probably would look normal on the oscilloscope. Thanks for the help anyway :)

Anyone else have any ideas?

Mike S's icon

yeah forgot to say i turned that down...

Mike S's icon

Try giving the ADSR attack/decay 0.

Mike S's icon

Bizarre, do you think it could be something to do with my computer? (Dell Inspiron 8600)

justin's icon

adsr~ can be triggerd with signals, check the helpfile and look into the patcher "p signals".

also its best to use signals to sync the osc and envelope, as it will lead to better accuracy (rather than scheduler)...

hth,

j

justin's icon

see attached patch for a demo of how to sync an oscillator's phase to an envelope trigger, it's actually a modified version of the msp example "oscsync-advanced"...

j

Max Patch
Copy patch and select New From Clipboard in Max.

Mike S's icon

I am again going crazy over this, for some reason this seems to be starting at the peak of the sine wave +1, rather than at 0.

I'd like someone to explain part of this patch as I don't know exactly what its doing (which isn't nice when it stops working) my knowledge of signal objects is pretty weak :[

Also, I can't seem to open the other patchers in the thread for some reason

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

Mike S wrote on Thu, 17 July 2008 13:29
I have a buffer with 512 samples.

I have an envelope.

I want them both to start at exactly the same time.

well you have to drive everything by a signal when you need "sync".

do you do that?

Mike S's icon

the envelope was with adsr, i could write one to a buffer easy enough though

i suppose that is the easier way of doing it

thanks again Raja, I really apreciate the help

Mike S's icon

bump

why can't i open any of the compressed patchers in this thread?

can anyone else reproduce?

Mike S's icon

yes almost always

i actually tried it just now and it works fine. this was on loading max, usually i already have a patch or two open but i don't know why that would have anything to do with it

bizarre