[LAU] Fw: Connie, an organ template for JACK

From: Martin Homuth-Rosemann <linuxaudio@email-addr-hidden>
Date: Sun Aug 01 2010 - 13:48:21 EEST

Beginn der weitergeleiteten Nachricht:

Datum: Sun, 1 Aug 2010 12:40:14 +0200
Von: Martin Homuth-Rosemann <linuxaudio@cryptomys.de>
An: James Morris <james@jwm-art.net>
Betreff: Re: [LAU] Connie, an organ template for JACK

Am Sat, 31 Jul 2010 23:41:52 +0100
schrieb James Morris <james@jwm-art.net>:

> ...
> Same problem as Foo YC 20, a lack of volume envelope. The clicks
> resulting from sudden jumps in sample amplitude make it unusable for
> me.
>
> Cheers,
> James.

Hi James,

I do apply a simple envelope to the keys to reduce the awful clicking -
it's done in connie_main.c in rt_process_cb(), starting at line 370:

--- 8< ---
    // process the keys (attac/decay/release), do stop mixture
    if ( ++timer > tg_sample_rate / 4000 ) { // 4 kHz -> every 250us
      timer = 0;
      int *p_vol = tg_vol_key + LOWNOTE; // tg_vol_key[note]
      int *p_raw = midi_vol_raw + LOWNOTE;

      // ramp the midi volumes up/down to remove the clicking at key
      press/release
      for ( int note = LOWNOTE; note < HIGHNOTE; note++,
      p_vol++, p_raw++ ) { if ( *p_vol < *p_raw ) {
          if ( tg_percussion ) // attack immediately up to 0..256
            (*p_vol) = 256 * tg_percussion; // then decay to 64 (0..48
      ms)
          else
            (*p_vol) += 8; // attack quick up (2 ms)
        } else if ( *p_vol > *p_raw ) {
          (*p_vol)--; // decay/release slow down (16 ms)
        }
      } // for ( note )
      ...
--- 8< ---

If you change the line 382
            (*p_vol) += 8; // attack quick up (2 ms)
to
            (*p_vol) ++; // attack slow up (16 ms)
you'll get a slower attac.

But a soft click will be leftover because your envelope is a ramp (i.e.
non bandlimited frequency range and aliasing...) and it's only integer
range 0..64. I chose the quick up / slow down because if you press a key
the starting sound will "mask" the click and you'll get a more direct
feeling - no delay between key action and playing sound. It decays more
slowly because there is no "masking" (silence). Feel free to
improve this part to your needs.
If it's still unusable for you it willbe possible to use a more complex
envelope (e.g. bandlimited step) or shorter time steps - but this will
cost more cpu because at the moment the keys were calculated every
250µs only (-> sample rate 4KHz) to reduce cpu load.

Ciao Martin
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Sun Aug 1 16:15:01 2010

This archive was generated by hypermail 2.1.8 : Sun Aug 01 2010 - 16:15:01 EEST