[chuck-users] newbie questions

Kassen signal.automatique at gmail.com
Mon Aug 25 12:33:50 EDT 2008

Hi, Joachim!

> I'm new in ChucK (up to now I used mainly Max and Csound). I like the
> language and would like to use it for my next piece, which will be for
> trombone and live-electronics. What I need is:

Great, let's go over the parts that you need.

> 1. record the live input (6 microphones)

Ok, so that will mean starting ChucK with "chuck --chanels6" to get 6
channels instead of the default 2.

> in buffers and play the content back later (in parts);

The best way to do this is likely the LiSa (LIve SAmpling) ugen, in the
/examples/special/ directory there is a series of examples dealing with her
syntax. I suggest you start there and as soon as you get to grips with her
look into the "hid" examples to tie keyboard control to your LiSa Ugens.

I've said before that I feel tieing one example that makes sound to another
that deals with control input while looking up any bits you don't get in the
manual is a good way to start ChucKing. That way it'll be exciting from the
beginning and this need not be all that hard at all.

> 2. live transposition via fft (like the gizmo object in Max);

I'm not sure about gizmo but we do have FFT, there are examples in the
/examples/analysis/ directory of your install. You may also want to have a
look at the Uanae paper that's linked on the main ChucK site as that
explains in detail how ChucK deals with analysis and re-synthesis.

> 3. working on partials (e.g. changing the amplitudes or selecting any).

The FFT Ugen will give you a array that consists of complex numbers, giving
you the phase and amplitude of all partials. You can do arbitrary
opperations on those before you pass it on to the inverse fft for
re-synthesis; it works like any other array.

> I think this is not very sophisticated, but after having a look in the
> documentation and the examples I don't know whether it can be done in ChucK,
> and how.
> So I'd appreciate a lot if anyone can tell me where I can find some
> examples.

Well, I'd say it's a slightly more sophyisticated project as a first one in
ChucK , after all fft and i-fft are fairly complicated operations but it's
quite possible. I'd take it one step at a time, in exactly the order you
already gave, base it on the examples that come with the download and ask
questions as (or if) you get stuck.

As a first tip; to keep this all clean I'd use a array of 6 LISa ugens
instead of defining them all one by one. This is a bit more advanced then
most of the examples but it'll save you a lot of typing later on (do have a
look at how arrays work as well).

//define 6 LiSa ugens in a array called "buffers"
LiSa buffers[6];

//loop over this array, connecting each LiSa to a soundcard in and out-put.
//this is assuming you started ChucK with 6 in and outputs
for(int n; n< buffers.cap(); n++)
  adc.chan( n ) => buffers[ n ] => dac.chan ( n);

Later in your project on you'd insert fft and ifft Ugens between the buffers
and the dac. Using arrays like this will save you a lot of typing in setups
with identical paralel audio chains like you need here. It's better to only
write such things once and have ChucK deal with the "copy pasting".

Best of luck, take it one step at a time, come back with issues as you run
into them and you'll get through it. It'll be challenging at times but it's
very possible to do this, especially with the experience with sound and
programming that you already have. The /examples/ dir may be a ChucKists
best friend, closely followed by this list (or the forum), the "blaming Ge"
technique has gotten less useful since ChucK slowly got more stable but that
too can be employed, often with good results ;¬).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080825/dec84c65/attachment.html>

More information about the chuck-users mailing list