I’ve been trying to imagine a very simple way to have impulse repeat certain rhythms in the manner of rhythmic modes or Carnatic jhatis.
For example a simple rhythm like: XXXO
In the above X would be an impulse and O a rest. I’m struggling to think of an elegant solution, and don’t want to use patterns.
Has anyone experimented with this?
Many thanks!
It depends on what you mean by you don’t want to use patterns. If you mean the sequencing should happen on the server, then Demand ugens would be perfect.
1 Like
You can use NamedControl for array args and a convenient interface, e.g.:
// quick example
(
x = { |unit = 0.2, freq = 400, length = 2, amp = 0.1|
var maxLength = 20; // you have to define maximum length
var rhy = \rhy.kr(1 ! maxLength);
var trig = TDuty.ar(unit, 0, Dseq([Dser(rhy, length)], inf));
Decay2.ar(trig) * SinOsc.ar(freq, 0, amp) ! 2
}.play
)
// normal setting
x.set(\rhy, [1, 0, 1, 1], \length, 4)
// helper Function for making an interface
(
~setRhy = { |synth, str = "X"|
var arr = str.as(Array).collect { |ch| (ch == $X).if { 1 }{ 0 } };
synth.set(\rhy, arr, \length, arr.size)
}
)
// apply
~setRhy.(x, "X00X00X0")
// tempo change
x.set(\unit, 0.15)
x.release
3 Likes
Hi Thor, dkmayer,
Thank you so much for your responses.
Thor, you are correct, the Demand Ugens are highly relevant to what I am doing. Thanks for pointing me in the right direction.
dkmayer, apologies for not responding sooner. I wanted to get a moment to properly test you code and it hasn’t arrived for me, but it looks perfect. I will give it a spin as soon as possible. The helper function for the interface is really cool. I’d never have thought along those lines. I find making GUIs a bit tiresome, but this is a really nice in-between territory that had never crossed my mind. Really elegant, thank you!
Thank you both for helping me out, I was quite a way of from this so you have saved me a great deal of head-scratching!
Dom