| No, Csound 5 still requires a file (CSD or just the orchestra) to be present. If you can program, then you could use the API to read a CSD from stdin and present it to Csound.
On 13 Aug 2012, at 05:57, pj@pjb.com.au wrote:
> Greetings,
>
> Starting with Istvan Varga's fluidcomplex.csd, I've translated
> (the sf2-related parts of) my timidity.cfg file into csound.
> The result has two big advantages, at least on my machine:
>
> * There is no perceptible latency :-) TiMidity has a latency
> of =~120mS and is, for most patches, unusable in real-time.
>
> * I can set up different banks on individual channels :-)
> This is how it should be, since the bank command has a channel
> parameter, but it's the first time I've been able to do it.
> Most synths only seem to be able to have one bank at once.
>
> So, a major improvement in my quality of life, thanks
> to the fluidEngine. The script follows after the .sig...
>
> Can csound read its csd script from its stdin, to avoid the
> tmp file ? I tried the obvious:
> csound -
> but that didn't work...
>
> Regards, Peter Billam
>
> http://www.pjb.com.au pj@pjb.com.au (03) 6278 9410
> "Follow the charge, not the particle." -- Richard Feynman
> from The Theory of Positrons, Physical Review, 1949
>
>
> #! /bin/bash
>
> # fullsynth Peter Billam www.pjb.com.au
> # Evolved from Istvan Varga's fluidcomplex.csd in the csound doc.
> # There is no config file; you edit this file to point to your
> # favourite SoundFonts. The result has much less latency than timidity,
> # and allows setting of separate banks on each channel (which is how
> # things should be, since the bank command has a channel parameter).
>
> # TODO:
> # An "-o file.wav" option should be fed into the .csd's -o option.
> # There should be by a "-i Pro,Key" option. We could just
> # aconnect them to 14:1, but better, use perl not bash and run:
> # "csound -M99 /tmp/dummy.csd 2>/tmp/dummy_stderr" and then parse
> # "the available MIDI in devices" and pass it to the .csd's -M option.
> # Can csound read its csd script from its stdin, to avoid the tmp file ?
>
> cat >/tmp/fullsynth.csd <<'EOT'
>
>
> ; -d -m229 -o dac -T -F midifile.mid
> ; -d -+rtmidi=alsa -m0 -M0 -iadc -odac
> ; listens on Midi-Through 1 = 14:1 ready for use in muz
> -d -m0 -M1 -iadc -odac
>
>
> sr = 44100
> ksmps = 128
> nchnls = 2
> 0dbfs = 1
> gicha2bank ftgen 0,0,16,2, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
>
> ichn = 1
> lp1:
> massign ichn, 0 ; disable triggering of instruments by MIDI events
> loop_le ichn, 1, 16, lp1
> pgmassign 0, 0
>
> gifld fluidEngine
> gisf_good_gm fluidLoad "/home/soundfonts/Good_GM.sf2", gifld ; default
> gisf_steinway fluidLoad "/home/soundfonts/Steinway.sf2", gifld ; patch 0
> gisf_jeux fluidLoad "/home/soundfonts/Jeux14.sf2", gifld ; banks 6,7
> gisf_bank5 fluidLoad "/home/soundfonts/Bank5.sf2", gifld ; bank 5
>
> opcode fluidProgramSelect_k, 0, kkkkk ; k-rate version of fluidProgramSelect
> keng, kchn, ksf2, kbnk, kpre xin
> igoto skipInit
> doInit:
> printf "channel %d set to bank %d patch %d\n", 1, kchn,kbnk,kpre
> fluidProgramSelect i(keng), i(kchn), i(ksf2), i(kbnk), i(kpre)
> reinit doInit
> rireturn
> skipInit:
> endop
>
> instr 1
> ; 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
> ; could set up a default patch, e.g. 0
> loop_le kchn, 1, 16, lp2
> endif
> nxt:
> kst, kch, kd1, kd2 midiin
> if (kst != 0) then ; receive a MIDI event
> if (kst == 144) then ; note on, we compress because of the ProKeys
> if (kd2 > 0) then ; don't mess up the vol=0, it means note-off
> kd2 = 100 + round(0.4 * (kd2-100))
> endif
> endif
> ; send the event to FluidSynth
> if (kst == 192) then ; 192 means patch_change
> kbank table kch-1, gicha2bank ; retrieve bank from @gicha2bank
> if (kbank == 6 || kbank == 7) then ; use Jeux for banks 6 and 7
> fluidProgramSelect_k gifld, kch-1, gisf_jeux, kbank, kd1
> elseif (kbank == 5) then ; use Bank5 for bank 5
> fluidProgramSelect_k gifld, kch-1, gisf_bank5, kbank, kd1
> elseif (kbank == 0 && kd1 == 0) then ; use Steinway for patch 0
> fluidProgramSelect_k gifld, kch-1, gisf_steinway, 0, kd1
> else ; otherwise use Good_GM
> fluidProgramSelect_k gifld, kch-1, gisf_good_gm, 0, kd1
> endif
> else
> ; we intercept cc0=bankmsb, and remember it in @gicha2bank
> if (kst == 176 && kd1 == 0) then ; cc0 is bank-msb
> printf "channel %d set to bank %d\n", 1, kch-1,kd2
> tablew kd2, kch-1, gicha2bank
> endif
> fluidControl gifld, kst, kch-1, kd1, kd2
> endif
> kgoto nxt
> endif
> aL,aR fluidOut gifld ; get audio output from FluidSynth
> outs aL,aR ; and send it to the audio card
> endin
>
>
>
> ; i 1 0 31557600 ; causes csound to hang immediately :-(
> i 1 0 3600
> e
>
>
> EOT
>
> csound /tmp/fullsynth.csd # 2>/tmp/e
>
>
>
> 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
|