Re: [LAU] need little help with csound

From: James Harkins <jamshark70@email-addr-hidden>
Date: Thu Mar 28 2013 - 16:52:35 EET

Rustom Mody <rustompmody@...> writes:

>
> I am preparing a lecture on sound and vibrations and was thinking of using
the
demo:http://zonalandeducation.com/mstm/physics/wavesstandingWaves/standingWav
es1/StandingWaves1.html Along with that I want to demo how it would sound
using something like csound ie for a freqs from {440 880 1320 1760...}show
how the sound changes as each freq is added to the fundamental sine wave at
440.

csound... not my cup of tea. In SuperCollider you can do it IMO more easily.
Then again, I'm biased (being an avid SuperCollider user for over 10 years).

SynthDef(\sine, { |freq, amp = 0.1, gate = 1|
        var eg = EnvGen.kr(Env.asr(0.1, amp, 0.1), gate, doneAction: 2);
        Out.ar(0, SinOsc.ar(freq, 0, eg) ! 2);
}).add;

g = Group.new;

p = Pbind(\instrument, \sine, \type, \on, \freq, 440 * Pseries(1, 1, inf),
\amp, 0.1 / Pseries(1, 1, inf), \group, g).play;

// when done:
p.stop; g.release;

If you want different amplitudes, substitute a different pattern after \amp.
This example posits an inverse relationship between the partial's frequency
and its amplitude, i.e., a sawtooth.

Disclaimer: I wrote this on a tablet without testing the code... and we all
know how that usually turns out. There could be mistakes, but the principle
is right.

Again IMO (and admitting my bias), if you have to make a choice between
learning csound or SuperCollider, choose SuperCollider.

hjh

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Thu Mar 28 16:15:08 2013

This archive was generated by hypermail 2.1.8 : Thu Mar 28 2013 - 16:15:08 EET