Csound Csound-dev Csound-tekno Search About

De-clicking random loop punch-ins??

Date2016-07-12 14:08
FromJohn Montgomery
SubjectDe-clicking random loop punch-ins??
Hello All,

( Working on my Sonic Art assignment ) Using the Behringer FCB1010, I
am trying to achieve a continuous looper pedal, but with the facility
to  punch-in and add to the loop buffer at any point.  So, whilst the
MIDI "Record" pedal is depressed it both adds the -iadc  to the loop,
and the loop feedback attenuates the existing buffer audio slightly.
i.e. If you keep "record" depressed without new input, the loop should
get quieter and quieter.

Below is my attempt - a snippet of the FCB1010 reader/dispatcher main
loop, followed by the actual record function.

A. - part of  MIDI dispatcher (Alwayson )
kStatus, kChan, kData1, kData2   midiin
if kStatus == 144 then
   if kData1 == 5 && kData2 == 100 then
       kPlaying active "Rec"  ;; bypass if already recording
       if (kPlaying > 0) then
          kgoto bypass
       endif
       event "i", "Rec",0,2    ;; record
   elseif ...
      ... other MIDI note responses
      .
      .
      .
   endif
endif
bypass:
    ;; just play the loop buffer
    aSnd  poscil .6, 1/2, giAudio  ;; giAudio is the 2 second loop buffer
    chnset aSnd, "Bus1"
endin

B. My current record function
instr Rec
  aIn    inch 1
  gkFbckAmt   init 0.9  ;; Loop feedback
  printks "Recording..%n", 10  ;; prints every 10 secs
  aNdx    phasor 1/2           ;; 2 second sweeps
  aFbck   table aNdx, giAudio, 1
  aFbck   *= gkFbckAmt        ;; slightly attenuate
  ;;aEnv   linseg 0, 0.02, 1, p3 - 0.05, 1, 0.02, 0, 0.01, 0 << declick attempt
  aSnd   = aIn + aFbck
  tablew   aSnd, aNdx, giAudio, 1  ;; the 1 = normalize indexing and wrap.
endin

Unfortunately, my simple solution gathers (and loops) clicks when I
punch-in.  I have tried enveloping 'aIn' similar to the declick opcode
in the library, but that didn't work.

I would be very grateful for suggestions/pointers how I might stop the
clicking, please?  Is there a better way to accomplish this or perhaps
some efficient way I could ramp the first eight hundred or so samples
in and then out at an arbitrary release time.  ( This last bit is also
necessary - although the event "i" sets p3 at 2 seconds, I intend that
it just continues recording without break if the pedal is still
depressed. )

Thanks for any help.
:-)
John Montgomery
Smiddy Cottage,
Campfield, Glassel,
Banchory.
AB31 4DL

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here