Another audio-rate question! (Send click on [phasor~] restart?)

christripledot's icon

I've reached a major stumbling block in creating an audio-rate sequencer. I have a phasor that cycles 32 times per beat, and I need a way to find when its phase is exactly 0 or 1 (i.e. when it's on the first and last sample of each sequencer 'tick').

I've only been able to reach the solution below, which is, frankly, unusable for my needs. At low BPMs I'm sure the [~0.09] objects spit out 1s for more than one sample, and at moderate to high BPMs they begin to drop samples.

If anybody has any solutions to this issue I'd be very grateful for some tips.

Many thanks,

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

chris

Mike S's icon

the subpatch 'signal input' in the help of the count~ object might help

Tim Lloyd's icon

I've not looked at your patch, but have you tried using delta~ in place of the comparison objects? It should give you a signal click when the phasor ramp restarts.

christripledot's icon

tim, you're saving my bacon a lot at the moment!

@mike: i'd seen that but hadn't made the leap of logic... i'll think on it again.

thanks for the help, guys :)

cudnylon's icon

I've been trying to put together an audio-rate sequencer for a while. Here's a "proof of concept" I've come up with. A few questions:

1) Is this the most computationally cheap way to obtain what I want?
2) Can I prevent converting to bangs before the router and keep it completely audio rate from input to output? (triggering the envelopes/groove~ with non-zero to zero transition signal clicks)
3) How could I add an on/off switch to the phasor~ so that when off no sounds are triggered and when turned on phasor~ resets to the beginning (or resets after being turned off)?

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

Here is the patch I've worked out with an example of synthesized and sampled drum sounds.

Tim Lloyd's icon

Here is an alternate way of the whole audio-rate sequencer concept. I'm using matrixctrl to write trigger values into a 4-channel buffer, which is then played back via phasor~ and index~, the output of which can then be used to trigger envelopes or playback of samples.

It gets rid of the reliance on edge~. Apologies for the aural assault, the only kick sample I had available was the start of jongly.........it will work much better with some well-edited samples.

Tim Lloyd's icon

haha

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

here it is:

Mike S's icon
cudnylon's icon

Interesting concept there, Tim. Definitely can get some use out of that with tweaking. Thanks.

christripledot's icon

Tim, in your example you suggest using an [adsr~]. I've been thinking about that long and hard, but can't figure out a clean way of supplying a note-off to it. I'd like to store triggers and note-offs in a buffer~ (1=note on, -1=note off, 0=ignore step) and know that I can do this with a [thresh~] object, but if i have two adjacent sequencer steps set to "on", i need to squeeze a '0' into the [adsr~] just before the next sequencer step to allow it to retrigger.

This was why I was wondering about detecting the last sample of a [phasor~]'s cycle: An ugly solution might be to read one step ahead in the buffer, and if there's a note being held and the next step is a note on, then pass a '0' to the [adsr~] on the last sample of the current step. Can't seem to get this right though.

Although I've tried [delta~] and the like I can't get this working reliably. I can do it cleanly if I send two clicks on every sequencer tick, and delay the "note on" tick by one sample, but this buggers up the rest of my timing and I don't want to have to keep track of negative delays throughout all my logic...

Am I still making any sense?

Tim Lloyd's icon

I think get what you mean, but I'm not sure how to do it really. Tbh, suggesting adsr~ was a little silly of me, as i never use it. I prefer to use combinations of reson~ and things like that to create envelopes for synth sounds. Bit harder to predict and be really accurate about, but I find it more interesting.

With the adsr~ thing, I really wish it could have it's envelope triggered by just a single click. I know that would stray from the normal use of it inside traditional synth patches, where you only want the release portion after a note-off, but it would be useful.

Sorry I couldn't be more help. I'm sure somebody else will chip in and defend adsr~ with some possible solutions.

christripledot's icon

> Sorry I couldn't be more help.

Dude, you've been awesome these last few days!

Tim Lloyd's icon

Aha! I just remembered Eric Lyon's el.adsr~ external, which is click-triggered. That will do what you and I both seem to need!

He has made some siick externals, can't believe I've been overlooking el.adsr~ for such a long time.

christripledot's icon

Trouble is, it doesn't have a 'release' like you and I are talking about. The sustain is sustain time, not level. It is click-triggered, sure, but it has no way of waiting for a note-off, AFAICT. The plot thickens ;)

oli larkin's icon

here is a solution to the adsr~ problem. in fact i am working on a collection of sample triggered externals including a better adsr, but for the time being ol.timedpulse~ should help. it triggers a pulse of specified duration in response to a 0->positive transition.

---------------------------------------------
http://www.olilarkin.co.uk / http://olilarkin.blogspot.com