How Can I Improve my Sinth?

Hi Everyone,

I have to sound a synth with 20 different frequencies at once.
29/5000
But the result is horrible.
How can I improve my sound?
Any suggestion is accepted. I´m a beginner.

(
SynthDef.new(\test, {
	arg freq = 100, amp = 0.5;
	var sig;
	sig = SinOsc.ar(freq * {Rand(0.99,1.02)}, mul:amp * {Rand(0.0,1.0)})!2;
	sig = FreeVerb.ar(sig, 0.7,0.8,0.25);
	sig = BPF.ar(sig, 650); 
	sig = sig * 0.05;
	Out.ar(0, sig);
}).add;
)
(
[40,50,60,70,80,90,100,500,220,110,95,300,400,600,222,55,88,74,116,200].do{
	arg selfreq;
	Synth.new(\test, [\freq, selfreq]);
}
)

If you want all of those frequencies played with the same dynamics you could use Klang or DynKlang instead of SinOsc, and put them in the SynthDef. Maybe something like

(
SynthDef.new(\test, {
	arg freq = 100, amp = 0.8, atk=0.01, sus=1, rel=0.5, gate=1;
	var sig, env;
	sig = DynKlang.ar( `[(freq/100)*[40,50,60,70,80,90,100,500,220,110,95,300,400,600,222,55,88,74,116,200],
		1!20,
		{Rand(0,6.3)}!20 ])!2;
	env = EnvGen.kr(Env.asr(atk, sus, rel), doneAction:2, gate:gate);
	sig = FreeVerb.ar(sig, 0.7,0.8,0.25);
	sig = BPF.ar(sig, 650);
	sig = env*sig*amp;
	Out.ar(0, sig);
}).add;
)

(
Pbind(\instrument, \test,
	\dur, 2,
	\amp, 1,
	\freq, Pseq([100,200,400],inf).trace;
).play(quant:1)

…but its hard to say without more information on what you are trying to do.

Thank you for your answer.

I´m trying to make a synth that takes the frequency and amplitude values of an big array and the result is the sum of all those values.
I suppose I need to make a structure to read the values of my array but I am investigating.

Thanks for your help.

Can you say more about what you mean by “horrible”?

I ran your code and the result is reasonable, based on what the code says.

So, “horrible” means either “this isn’t what I wanted,” or “there is a technical problem with the sound.”

In general: Sinewaves into effects aren’t very interesting.

Reverb consists of multiple delays. The effect of mixing delayed sinewaves is only phase cancellation: some frequencies might be a little louder than without the reverb, other frequencies might be a little softer.

Filters amplify some frequencies and reduce (attenuate) others. If the input is only a single frequency, then you get only an effect on the volume.

(sine --> reverb --> filter) + (sine --> reverb --> filter) + … + … is very inefficient. hamptonio’s redesign changes that to (sine + sine + sine + sine + …) --> reverb --> filter. That will save a lot of CPU time.

hjh

This is my synthDef and my values:

I´ve a 3d array with frequency and amplitude values. These values have to be read by a synth so that with those data it processes a signal.
In other words, the synth has to read each row of the array and add the signals with the frequency and amplitude values of each cell. For example:

myarray = [f1,a1] [f2,a2], [f3,a3]
[f4,a4] [f5,a5], [f6,a6]
[f7,a7] [f8,a8] [f9,a9]

And my SynthDef is
Synthdef.new(\sinth{
arg freq, amp;
var sig;
sig = SinOsc.ar(freq, mul:amp);
Out.ar (0,sig);
}).add;

n = number of row
For (i = 0 to i=2)
var freqi, ampi;
freqi = myarray[n-1] [i] [0];
ampi = myarray[n-1] [i] [1];
xi = Synth.new (\sinth,[\freq, freqi],[\amp, ampi]);
end

How can I do this in SC?. I need to do Additive Synthesis with the values of the row.
Thank u for your answer. I’m learning a lot

Thank u for your answer. I’m learning a lot.
Can u help me?

This is my synthDef and my values:

I´ve a 3d array with frequency and amplitude values. These values have to be read by a synth so that with those data it processes a signal.
In other words, the synth has to read each row of the array and add the signals with the frequency and amplitude values of each cell. For example:

myarray = [f1,a1] [f2,a2], [f3,a3]
[f4,a4] [f5,a5], [f6,a6]
[f7,a7] [f8,a8] [f9,a9]

And my SynthDef is
Synthdef.new(\sinth{
arg freq, amp;
var sig;
sig = SinOsc.ar(freq, mul:amp);
Out.ar (0,sig);
}).add;

n = number of row
For (i = 0 to i=2)
var freqi, ampi;
freqi = myarray[n-1] [i] [0];
ampi = myarray[n-1] [i] [1];
xi = Synth.new (\sinth,[\freq, freqi],[\amp, ampi]);
end

How can I do this in SC?. I need to do Additive Synthesis with the values of the row.