Forums > MaxMSP

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

December 20, 2009 | 11:00 pm

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,


— Pasted Max Patch, click to expand. —
December 20, 2009 | 11:11 pm

the subpatch ‘signal input’ in the help of the count~ object might help

December 20, 2009 | 11:12 pm

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.

December 20, 2009 | 11:15 pm

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 :)

December 21, 2009 | 1:23 am

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)?

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

— Pasted Max Patch, click to expand. —
December 21, 2009 | 3:21 am

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.

December 21, 2009 | 3:21 am


here it is:

— Pasted Max Patch, click to expand. —
December 21, 2009 | 4:08 am
December 21, 2009 | 6:08 am

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

December 21, 2009 | 8:23 am

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?

December 21, 2009 | 12:13 pm

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.

December 21, 2009 | 12:18 pm

> Sorry I couldn’t be more help.

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

December 21, 2009 | 2:40 pm

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.

December 21, 2009 | 2:55 pm

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 ;)

December 21, 2009 | 9:12 pm

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.

——————————————— /

Viewing 15 posts - 1 through 15 (of 15 total)

Forums > MaxMSP