Hello, I asked for help on the lines forum about iteration and executing events. I received help but have some questions… what I am trying to do is as follows
-a single SinOsc frequency ascending by multiples of a fundamental, i.e- overtones.
-the amplitude envelope of each new overtone decreasing exponentially
over a total, finite duration of time.
-each new enveloped overtone sent to different output within an 8-channel array, linearly distributed and wrapping back to the first channel, i.e 0…7, 0…7, 0…7, etc.
In other words, what I am trying to create is a single tone raising in pitch by sequential order of its harmonics, each new harmonic is exponentially shorter in duration than the previous harmonic, and each new harmonic is sent to a different channel in an 8 channel circular array, over a defined total duration.
the following code was posted…
(
SynthDef (\sine_tone) {
arg freq = 440, amp = 1, len = 1, bus = 0;
var sig, env;
env = Env.step ([ amp ], [ len ]);
env = EnvGen.kr (env, doneAction: 2);
sig = SinOsc.ar (freq, 0, env);
Out.ar (bus, sig);
}.add;
)(
t = 2; // initial duration
f = 220; // initial frequency
~harmonic_bus_pattern = Pbind (
\instrument, \sine_tone,
\delta, t * (2 ** Pseq ((0…-7), 1)),
\len, Pkey (\delta),
\amp, (2 ** Pseq ((0…-7), 1)),
\freq, f * Pseq ((0…7), 1), // will give you octaves. see edit
\bus, Pseq ((0…7), 1),
);
)~harmonic_bus_pattern.play
When I execute this I hear one channel of audio, then silence. I suspected it was because I was listening on my computer and not an 8-channel system so I checked on the meter there were events happening on the other channels but it didn’t wrap or continue, it seemed like it stopped/was freed, which was confirmed after inspecting the node tree. I tried to change it to two channel but failed.
Also, I tried to implement a exponential envelope but kept getting errors. I didn’t think of using Env.step but it seems like an effective option.
Finally, there is a wait/delay equal to the “initial duration” variable, I haven’t figured out why this is.
Any and all help is greatly appreciated as I try to figure this out… thank you!!!