[chuck-users] help understanding lisa

mike clemow gelfmuse at gmail.com
Thu Nov 6 17:55:20 EST 2008


This is just for fun, but it's totally relevant.  This is currently
the state of DIY Hann (for example) envelopes for granular synthesis.
You get a couple more of these trainlets running, and you'll kill the
VM.  I absolutely love ChucK's concurrency model, but it can't handle
too much of this kind of thing.  The sample-level intervention is also

Also, you all might check my notably horrid math...


1024 => int N;  // length of grain in samples

fun float hann( int n ) {
    return 0.5 * (1. - Math.cos( (2*pi*n)/(N-1) ));   // thank you,
Wikipedia.org ;-)

fun void hannGrain( float f ) {
    SinOsc s => dac;
    f => s.freq;
    0 => int n;
    0. => float h;

    while( n < N-1 ) {
        hann( n ) => h => s.gain;
        1::samp => now;

while( true ) {
    spork ~ hannGrain(Math.rand2f(250.,500.));
    1024::samp/2 => now;    // 50% grain overlap


If you make the random frequency a constant, it will sound like a
SinOsc.  This is mostly because of the nice envelope...


On Thu, Nov 6, 2008 at 4:35 PM, Kassen <signal.automatique at gmail.com> wrote:
> Rogan;
>> This is interesting.  I have some code that does pretty cool graining
>> / glitching on samples (that I have yet to post on the forum) that I'm
>> currently using linear ramps for.
> Cool!
>>  What would be the optimal shape for
>> the grain?
> Well, that's a good question... it's a question like what is the best
> instrument or the most beautiful animal. In other words; it depends on taste
> and application. A envelope shape (or grain "window" if you like) that's
> perfect for me may be completely unsuitable for you. I do think that if we
> only have one the simplicity of the linear ramp is nice but more can be said
> on the topic.
>>  Sine wave attack (sqare-root)?
> That would be a nice one, yes. Nothing could be "the best" but something
> like that would be a decent bet as a starting point, I think.
>>  And what are the effects
>> on the spectrum?
> Well, what we have is a wave-form (the section of the buffer being played
> back) and a envelope over it which is actually another wave-form that gets
> multiplied with the first. For longer grains (or loops or recordings) this
> is no huge issue but as grains become shorter the envelope may approach a
> rate where it's wave-form comes close to the audible range in frequency. If
> we then consider that  a multiplication of two wave-forms really comes down
> to a ring modulator we'll see that the spectral content of the envelope will
> start generating side-bands for the audio.
> This is not a bug, in fact it's a feature of granular (or pulselet, or....)
> synthesis and it gives us interesting options in sound-design. However, to
> make the most of those options we need to be able to talk about the curve of
> the ramps as the curve of the ramps will translate to harmonics of the
> "envelope wave-form" which will in turn end up in the sound. Hope fully
> we'll be able to find a way to talk about this to LiSa that doesn't make
> LiSa any more complicated then she needs to be; simple tools are nice.
> I hope that served as a introduction. If you'd like to know a lot more about
> this topic I think the best thing to do is to considder getting the book
> "Microsound" by Roads. That book goes into considerable depth in the various
> properties of granular systems, how they interact and how they influence the
> final result.
> Yours,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users


More information about the chuck-users mailing list