Csound Csound-dev Csound-tekno Search About

Re: gen routines

Date1997-05-11 14:22
FromPeter Neubacker
SubjectRe: gen routines
On replacing wavetables on a running sound I wrote:

> It does work! On my system, I have a note running infinitely
> and send the new wavetables over a realtime pipe when editing
> the wave graphically, and I can hear the sound change.

Bill Kleinsasser wrote:
>Can you more fully describe your system and hwat you are using to
>graphically alter the wave tables?

Richard Dobson wrote:
>Sounds wonderful - but it would be good to have some more detailed
>information on how you are doing this. It is easy enough to replace
>one ftable with another, on a held note, less so to manage the
>takeover without a glitch, even less so to do something like gradual
>interpolation between wavetables. Also, not everyone has a system  
>which allows real-time pipes, we have to settle for a score. Can we  
>see an example orc. and sco. file?


So, I am working on a NeXTStep platform with a csound-interface
I wrote. For realtime I have csound running as a subprocess
of my program with the option *-L stdin* and pipe the events
through a unix pipe to the running process. When I alter the
graphically displayed curve form with the mouse (e.g. GEN07 or
GEN08), the f-events are generated and sent. When you do so,
of course there is no smooth transition of sound.
But you can interpolate between waveforms of a running sound
with the instrument below!

Peter Neubaecker

;------------ wavefade.orc -------------------
sr = 22050
kr = 2205
ksmps = 10
nchnls = 2

instr 1

tigoto  tied
kamp1   init    1
kamp2   init    0

tied:
ia1     =       i(kamp1)
ia2     =       i(kamp2)
kamp1   linseg  ia1,p6,ia2,1,ia2    ; two envelopes for crossfade
kamp2   =       1-kamp1             ; swapped on new start
                                    ; p6 = crossfade time
asig1   oscili  p4*kamp1,p5,1,-1    ; iphs = -1
asig2   oscili  p4*kamp2,p5,2,-1    ; to prevent phase init
asig    =       asig1+asig2
        outs    asig,asig

endin

;------------ wavefade.sco -------------------

f 1 0 1025 10 1             ; two initial waves
f 2 0 1025 10 0 1

i 1 0 -4 20000 100 3
f 1 4 1025 10 0 0 1         ; set new f1 after fade time
i 1 4 -4 20000 100 1        ; and restart tied note for crossfade
f 2 8 1025 10 0 0 0 1       ; set new f2
i 1 8 -4 20000 100 3        ; etc.
f 1 12 1025 10 1 0 0.5 0 1
i 1 12 -4 20000 100 2
f 2 16 1025 10 1
i 1 16 8 20000 100 4

e

;--------------------------------------------