Re: need little help with csound

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Thu, Mar 28, 2013 at 8:22 PM, James Harkins <jamshark70@xxxxxxxxx> wrote:
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@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user


Thanks James. I got something running with chuck.
[I still have to figure out how to use data structures in chuck; so for now the code is a bit of a mess :-) ]
Now I have a different related question
Is there any good source on harmonic spectra?

ie by showing the first say 8 harmonics and reconstitue according to the spectra of piano, violin, trombone etc can we being to discern the difference?
Yeah I know piano is specially hard because of the transient characteristic... Still just wondering...

Rusi
--
http://www.the-magus.in
http://blog.languager.org

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux