Csound Csound-dev Csound-tekno Search About

[Csnd] problem with midi, when playing a csd_file

Date2010-10-23 10:15
FromStefan Thomas
Subject[Csnd] problem with midi, when playing a csd_file
Attachmentsadditivtrial.csd  
Dear community,
I've written the following file with the help of Joachim Heintz.
I try to redesign the sound of xenophonie 4.
I've now the problem, that I can play only a few notes with my midi-keyboard, then I can't hear a sound.
Joachim told me, that he can play the same file with as many notes and as long he wants.
Maybee it has to do with my linux-distro (puredyne) or my version of csound ( 5.10 double samples ), I don't know.
If someone could try out this file, I would be very thankful if he could tell me, if he has any problems with it.
Thanks,
Stefan

<CsoundSynthesizer>
;additive synthesis with a "inharmonic" sound
<CsOptions>
 -odevaudio -Ma -b400 -m0d
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
; amlitudes of the different partials
giPartamps    ftgen        0, 0, -30, -2, 0.500804, 0.173136, 0.160991,  0.101076, 0.081932,  0.067141,   0.045805,  0.036794,  0.035306,  0.029838, 0.011930,  0.011010,  0.010675,  0.008733,  0.008409, 0.008226, 0.007619,  0.005701,  0.005513,  0.005106, 0.004824,  0.004630,  0.004250,  0.004002, 0.003883,  0.003451,  0.003443
; frequencies of partials
giPartfreqs    ftgen        0, 0, -30, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
giTuning    ftgen        0, 0, 64, -2, 6, 1.625, 261.63,  60, 1.00, 1.08428194851, 1.17566734386, 1.2747548784, 1.38219370342, 1.49868768196, 1.625 ; tuning-table

giSine        ftgen        0, 0, 2^10, 10, 1

        massign     0, 10
instr 1
gimaxdur    =        16 ;maximum duration of a very loud tone
endin

instr 10 ; triggered by midi, triggers inumparts instances of instr 100 for the partials
inumparts    =        24 ; the number of partials
imidinot    notnum
icps        cpstmid       giTuning ;the frequencie of partial 1
iamp        ampmidi    1
idur        =        gimaxdur * iamp
indx        =        1 ;we start with partial number 1
isubinstr    =        100+imidinot/1000 ;e.g. 100.060 for middle-c
loop:
ipartamp    tab_i        indx-1, giPartamps
ipartamp    =        ipartamp * iamp
ipartfreq    tab_i        indx-1, giPartfreqs
ipartfreq    =        ipartfreq * icps
        event_i    "i", isubinstr, 0, idur, ipartfreq, ipartamp, indx, iamp
        loop_le    indx, 1, inumparts, loop
krelease    release   
 if krelease == 1 then ;when  note off event
         turnoff2    isubinstr, 4, 1
 endif
endin


instr 100 ;plays one partial; higher partials are shorter
idur        =        p3 ;duration
ifreq        =        p4 ;frequencie of the partial
iamp        =        p5 ;amlitude of the partial
ittnr        =        p6 ;which partial has to be played
ivel        =        p7 ;key velocity (0-1)
asig        poscil        iamp, ifreq, giSine
aenv        expsegr    0.01, 0.01, 1, idur-0.1, .001, .2,.00001
aout        =        asig * aenv ;* kvel
        outs         aout, aout
endin


</CsInstruments>
<CsScore>
i 1 0 3600
</CsScore>
</CsoundSynthesizer>