[chuck-users] stupid n00bie question: part IV

Kassen signal.automatique at gmail.com
Fri Nov 9 07:12:46 EST 2007

```On Nov 9, 2007 11:10 AM, AlgoMantra <algomantra at gmail.com> wrote:

> Hm, happy diwali greetings from India chuckers!
>

Happy Diwali greetings to you to!

I had to look it up but celebrating the victory of good over evil by
lighting lamps sounded like a very good idea and I just lit a small candle,
it's a vanilla scented one, I hope that's appropriate as those are the only
ones I have around :¬)

Fireworks are illegal here except with new year (Roman callendar) but who
needs those when one has ChucK for the explosions?

> So. Lets say I'm shaping a curve, which is the frequency
> graph of a sound wave, using pygame, or some kind of
> GUI. So what I possibly have are two things:
>
> 1. a string of coordinates that forms the curve.
> 2. a parametric equation that represents the curve.
>
> What is the easiest way in ChucK, by which I can play/generate
> this sound in case 1) and 2).
>

The easiest by far will be the IFFT Uana
http://chuck.cs.princeton.edu/doc/program/uana_full.html#IFFT

This takes a array of complex numbers, maps those to frequencies between 0
and the Nyquist  and synthesises the result. Basically It's exactly what you
are describing you want to do in ready-made form. This does leave questions
with regard to the phase of the generated sines.

The official examples don't go into this but there is nothing that prevents
you from manually filling a "blob" with numbers you like and synthesising
that. I have one example of this at hand, I made it a while back to play
Kijjaz's "doing lots with little" game.

---------------------------------------
IFFT i=>dac;complex c[512];int A;
while(1){#(++A%.33,A%1.65)=>c[A%512]; i.transform(c);1024::samp=>now;}
----------------------------------------------------

Warning; not necessarily a pleasant sound for most, watch your speakers,

I suggest you do roughly that, except replace my silly formula with a OSC
signal.

> See? It's getting less stupid everyday :) (eh, Kassen?)
>
>
It never was stupid, don't put yourself down like that. If there were no
questions we might was well give up. Questions are good.

Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20071109/2356aeef/attachment.htm
```