| Not sure what you mean, but here his original example work with a GM midifile without the need for any changes. PG changes were recognised in all channels.
On 26 Dec 2011, at 13:50, zappfinger wrote:
> I changed Istvan's example so that is reacts on program change/bank select
> messages on channels 1..10
> Now I can play a GM file and get the correct sounds ...
>
>
>
> ; Select audio/midi flags here according to platform
> ;Load external midi file from manual/examples
> -odac -T -F ./midis/AmD7bossa.mid ;;;realtime audio I/O and midifile in
> ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
> ; For Non-realtime ouput leave only the line below:
> ; -o fluidcomplex.wav -W ;;; for file output any platform
>
>
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> ; Example by Istvan Varga
> ; changed by zappfinger for more general use
>
> ; disable triggering of instruments by MIDI events
>
> ichn = 1
> lp1:
> massign ichn, 0
> loop_le ichn, 1, 16, lp1
> pgmassign 0, 0
>
> ; initialize FluidSynth
>
> gifld fluidEngine
> gisf2 fluidLoad "./samples/003.3mg GS Roland Sound Set 16 bit Bank.sf2",
> gifld, 1
>
> ; k-rate version of fluidProgramSelect
>
> opcode fluidProgramSelect_k, 0, kkkkk
> keng, kchn, ksf2, kbnk, kpre xin
> igoto skipInit
> doInit:
> fluidProgramSelect i(keng), i(kchn), i(ksf2), i(kbnk), i(kpre)
> reinit doInit
> rireturn
> skipInit:
> endop
>
> instr 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
> ; initialize channels
> kchn init 1
> if (kchn == 1) then
> lp2:
> fluidControl gifld, 192, kchn - 1, 0, 0
> fluidControl gifld, 176, kchn - 1, 7, 100
> fluidControl gifld, 176, kchn - 1, 10, 64
> loop_le kchn, 1, 16, lp2
> endif
>
> ; send any MIDI events received to FluidSynth
> nxt:
> kst, kch, kd1, kd2 midiin
> if (kst != 0) then
> if (kst != (192 + kch -1)) then ; respond to changes on all channels...
> fluidControl gifld, kst, kch - 1, kd1, kd2
> else
> fluidProgramSelect_k gifld, kch - 1, gisf2, 0, kd1
> endif
> kgoto nxt
> endif
>
> ; get audio output from FluidSynth
> ivol init 3 ;a bit louder
> aL, aR fluidOut gifld
> outs aL*ivol, aR*ivol
> endin
>
>
>
>
> i 1 0 3600
> e
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/FluidProgramSelect-bank-preset-from-midi-file-tp5101360p5101547.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|