Mark Allidine
Mark Allidine

Reputation: 11

2 Midi files in one project

I'm trying to play two separate midi files in one project. Bronson2 I have working fine. How should I approach bass.mid to get it to work alongside the other file. I have a feeling it's something about Midi numbers however I'm new to csound and unsure. I've posted the code below. I'm receiving an error message that the midi file won't load however I've made sure it's in the project file. Any help is appreciated, thanks.

<CsoundSynthesizer>
<CsOptions>
-F Bronson2.mid
-F bass.mid
</CsOptions>
<CsInstruments>

ksmps = 10
0dbfs = 1


instr 1
iamp        ampmidi 1
ifr         cpsmidi

aosc oscil iamp, ifr, 1

afilt lpf18 aosc*.5, 1500, .89, .9
out afilt*.02

endin

instr 5
iamp        ampmidi 1
ifr         cpsmidi

aosc oscil iamp, ifr, 1

afilt lpf18 aosc*.5, 1500, .89, .9
out afilt*.02

endin

instr 4       ;hihat closed

aamp      expon     .25,  0.1,   .001   ;short fade out...an a-rate
exponantial line, a-rate makes it more accurate.
arand     rand      aamp                ;random noise faded
out arand*.1

endin

instr 2 ;snare
iamp = p4
aenv1   expon  iamp, 0.03, 0.01   ;short fade out
a1      oscili aenv1, 147, 1        ;'ring' faded, 147 hz works well for snare
ring.
aamp    expon    .25,  0.2,  .001   ;short fade ut
arand   rand     aamp               ;random noise faded
out a1+arand*.2                 ;mix
endin

instr 3; kick
ipitch = p4
k1  expon    ipitch, .2, 50     ;detune...with user-controlled starting point.
aenv expon 1, p3, 0.01      ;fade over note
a1  poscil    aenv, k1, 1     ;pitched tone, faded out
out a1*.4*.2                 ;scale down volume
endin




</CsInstruments>
<CsScore>
f 0 3600
f1 0 1024 10 1

t 0 120

{16 CNT ;38 seconds long

i4 [0   + 4*$CNT.]    0.25
i4 [0.5 + 4*$CNT.]    0.25
i4 [1   + 4*$CNT.]    0.25
i4 [1.5 + 4*$CNT.]    0.25 
i4 [2   + 4*$CNT.]    0.25
i4 [2.5 + 4*$CNT.]    0.25
i4 [3   + 4*$CNT.]    0.25 
i4 [3.5 + 4*$CNT.]    0.25

i2 [1 + 4*$CNT.] .25 .45
i2 [3 + 4*$CNT.] .25 .45

i3 [0   + 4*$CNT.] .25 100
i3 [2   + 4*$CNT.] .25 100
i3 [2.5 + 4*$CNT.] .25 100

}


</CsScore>
</CsoundSynthesizer>

Upvotes: 1

Views: 31

Answers (0)

Related Questions