I am trying to modulate from a more sinewavesh sound to an impuls. The following code works so far, but I get unwanted artefacts when the MouseX - Courser is all the way to the right side of the screen. The artifacts (quick jumps in amplitude) pop up very every few seconds … Does anyone know how to avoid these?
Only options: do it in NRT or server-side. It should be noted also that this unavoidable inaccuracy only plays a role with smooth regular sound material. For many if not most granulation applications it doesn’t play a role in perception.
I don’t see it so negative. It’s mainly about becoming aware of each tool’s limits. In most cases there are alternative solutions in SC itself. E.g. here we can easily rewrite the example as Synth (panning omitted, but also possible):
Thank you for the responses! Not sure if I fully get the NRT/RT process. The code will be manipulated by sensors, there will also be an OSC-connection to another Software. So I guess NRT will not be an option, right?
Also thank you on how to solve it another way! I have rewritten your code a little bit (see below).
My goal is to have an impulse at the end with a frequency of less than 1Hz. I tried to alter the duration of LFGauss and the delaytime to get from a high freuqency impuls to a low frequency one, but it also creates artifacts. Makes sense to me since I am manipulating the delaytime.
So what works good is getting from a sinewave to a high frequency impulse. But getting from a high to a low frequency impulse doesn’t really work. I cant think of a smooth way of solving it. Do you guys have any suggestions or workarounds?
Moreover you’re triggering a complicated modulation process with three simultaneously changing parameters and consequently get AM artefacts. Another point: When starting with LFGauss of width = 0.2, you are already starting with a slighty AM-modulated sine wave. Higher width values of LFGauss on the other hand would need more overlaps, so an array of higher size. Controling the LFGauss ‘as Impulse’ is also problematic at least because of amplitude.
A powered sine can be an alternative to LFGauss, though with high power values, close to impulse, it suffers the same problem of control with low frequencies. So I’d suggest a different approach: do a crossfade between a powered sine and impulse. Variant: taking a transition from a constant 1 signal to a powered sine as envelope for another signal.
// mappings may need some tweaking
var startFreq = 200;
var endFreq = 1;
var ctrl = MouseX.kr(0, 1);
var power = ctrl.linlin(0, 0.5, 1, 1500).poll(label: \power);
var freq = ctrl.explin(0.5, 1, startFreq, 1).poll(label: \freq);
var sig = SelectX.ar(ctrl * 2, [
SinOsc.ar(freq).range(0, 1) ** power,
// for plotting of waveform changes you can drop LeakDC
LeakDC.ar(Normalizer.ar(sig) * 0.1 ! 2)