csound / manual

Csound Reference Manual (English)
Other
45 stars 29 forks source link

TableArps #659

Closed tjingboem closed 9 months ago

tjingboem commented 1 year ago

new musical example for schedkwhen opcodes

<CsoundSynthesizer>
<CsOptions>
-odac
; output for writing audio file with
; Android version of Csound:
;-o/sdcard/TableArps.wav
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

; initialize global reverb channels
gaRvbL      init  0
gaRvbR      init  0
; initialize Count at -1 so Note tables are read starting at index 0
giCount     init -1
; arpeggio note tables
giMinAdd2   ftgen   1, 0, 0, 2, 60, 62, 63, 67, 72, 
                    74, 75, 74, 72, 67, 63, 62
giMajAdd2   ftgen   2, 0, 0, 2, 60, 62, 64, 67, 72, 
                    74, 76, 74, 72, 67, 64, 62

    instr Trigger
kTrig metro 8 
  schedkwhen  kTrig, 0, 0, "Arps", 0, 1/3, p4, p5, p6 ; trigger a note  
    endin

    instr Arps
giCount = giCount + 1 
iNote = table(giCount, p6, 0, 0, 1) ;read incrementally from the table
kEnv  = linsegr(0, 0.003, p5, p3, p5, .5, 0) ; amplitude envelope
iRnd  = random(0.92, 0.98) ; randomize amp and pluck point
iDtn  = random(-0.05, 0.05) ; random detune
iFreq = cpsmidinn(iNote + p4 + iDtn) ; convert note table values to cps 
aSig  = wgpluck2(iRnd, kEnv/5*iRnd, iFreq, .25, 0.06) ; plucked string opcodr
kEnv2 = linseg(.1, p3/2, 0)                                          
aSig2 = oscil(kEnv2*.1*iRnd, iFreq + 12) ; sine osc one octave higher
aMixL = aSig+aSig2/2
aMixR = aSig+aSig2
gaRvbL  +=  aSig*.22 ; send to global reverb channels
gaRvbR  +=  aSig*.22
  outs(aMixL, aMixR)
    endin

    instr Reverb
aRvbL,aRvbR reverbsc gaRvbL, gaRvbR, 0.91, 11000
  outs(aRvbL,aRvbR)
   clear(gaRvbL,gaRvbR)
    endin

</CsInstruments>
<CsScore>
i"Reverb" 0 34
; for instr Trigger: p4=number of semi-tones 
; away from original note table freqs, 
; p5=amp, p6=table used
i"Trigger" 0 5 0  .8  1
i .  5   .    -4  .8  2
i . 10   .    -7  .8  1
i . 15   5.1  -2  .8  2

i . 22   1   -12  .8  1
i . 23   .    -9  .8  2
i . 24   .    -7  .8  1
i . 25   .    -4  .8  2
i . 26   .    -2  .8  2
i . 27   2     0  .8  1
i . 29   0.7   3  .8  2
e
</CsScore>
</CsoundSynthesizer>
; example by Scott Daughtrey
; inspired by example 01D13 by Iain McCurdy
; from the FLOSS manual
tjingboem commented 9 months ago

done

csounder commented 9 months ago

What a lovely example.

- Dr.B

Dr. Richard Boulanger

Professor

Electronic Production and Design

Berklee College of Music

Professional Writing & Technology Division

On Thu, Nov 16, 2023 at 2:46 PM Menno Knevel @.***> wrote:

Closed #659 https://us-west-2.protection.sophos.com?d=github.com&u=aHR0cHM6Ly9naXRodWIuY29tL2Nzb3VuZC9tYW51YWwvaXNzdWVzLzY1OQ==&i=NWYxNzBkMDNiNTVmZGEwZmIyNjczYmRm&t=WW02WFBUemYrelhPdE00S2NhbVY4OXpyWEVYUTQ2SjB2V3RhTkdyR0xsND0=&h=0fa2649529044cd7ac965c2a198f5afb&s=AVNPUEhUT0NFTkNSWVBUSVZ-CzEl059Ym1RlqwKl3ZhNfC-dR2N5IDL9CUAdMA_6tA as completed.

— Reply to this email directly, view it on GitHub https://us-west-2.protection.sophos.com?d=github.com&u=aHR0cHM6Ly9naXRodWIuY29tL2Nzb3VuZC9tYW51YWwvaXNzdWVzLzY1OSNldmVudC0xMDk4NTUyOTQ5MQ==&i=NWYxNzBkMDNiNTVmZGEwZmIyNjczYmRm&t=L1kxYjl6enIxQmZ4K0w4UkpsQW5HeHBtTFFsejVBQjZXTlFMWlRuOWRuYz0=&h=0fa2649529044cd7ac965c2a198f5afb&s=AVNPUEhUT0NFTkNSWVBUSVZ-CzEl059Ym1RlqwKl3ZhNfC-dR2N5IDL9CUAdMA_6tA, or unsubscribe https://us-west-2.protection.sophos.com?d=github.com&u=aHR0cHM6Ly9naXRodWIuY29tL25vdGlmaWNhdGlvbnMvdW5zdWJzY3JpYmUtYXV0aC9BQUxXWUZVRkY2WTNONjROWjRFU0pQVFlFWlVSSEFWQ05GU002QUFBQUFBUlNIWlhYU1ZISTJEU01WUVdJWDNMTVY0NVVBQkNKRlpYRzVMRklWM0dLM1RVSlpYWEkyTEdORlJXQzVESk41WERXTUpRSEU0REtOSlNIRTJEU01J&i=NWYxNzBkMDNiNTVmZGEwZmIyNjczYmRm&t=SWd2SE1RWXU5bG1NV0FzWXNOcUVycUl5ZDhrSFhuVXdZZVVpZ0dWNVkvWT0=&h=0fa2649529044cd7ac965c2a198f5afb&s=AVNPUEhUT0NFTkNSWVBUSVZ-CzEl059Ym1RlqwKl3ZhNfC-dR2N5IDL9CUAdMA_6tA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tjingboem commented 9 months ago

couldn't agree more...now avialable at https://csound.com/manual/schedkwhen.html