[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] Can I load a list of commands?
From: |
Dave Serls |
Subject: |
Re: [fluid-dev] Can I load a list of commands? |
Date: |
Mon, 9 Jan 2006 11:41:04 -0700 |
On Mon, 09 Jan 2006 12:14:47 +0000
Dougie McGilvray <address@hidden> wrote:
>
>
> Hi, I'm experimenting with Scala & Fluidsynth. I'm currently
> copy/pasting the contents of the file produced by Scala into the
> fluidsynth shell. Is there an easier way? I couldn't find one in the
> documentation, but I thought there might be a way to load a list of
> commands from a file.
>
A script can be made to do this by 'enhancing' the command syntax
of fluidsynth. Unfortunately for most others I use Rexx as my script
language,
being a former mainframe geek. I'm sure it would be just as easily done (tm)
in shell script. The script rxfluid1 accepts the command 'incl' to include a
file of fluidsyunth commands.
Starter script:
#! /usr/local/bin/rexx
/* set up jack keyboard to fluidsynth */
call directory "/src/fluidsynth"
fonts = '8Rock11e.sf2 FluidR3GM.sf2 wst25fstein.sf2 Tremolo_Oud_V2_SEC.sf2'
say "Using jack as sound device"
'/home/dave/bin/rxfluid1 | fluidsynth -g 1.0 -R 1 -a jack' fonts
rxfluid1 which interprets standard input and generates fluidsynth commands:
#! /usr/local/bin/rexx
/* interpret console commands for fluidsynth */
ccnt = 0
fbase = "/audio/csound/"
say "router_clear"
do forever
parse pull stmt
cmd = word( stmt, 1 )
ccnt = ccnt + 1
select
when cmd = "q" then do
say "quit"
'aconnect -x'
exit 0
end
when cmd = "incl" then do
parse var stmt . filen
filen = fbase || filen || ".incl"
do while lines( filen ) > 0
icmd = linein( filen )
say icmd
end
say "channels"
end
when cmd = "split" then do
bass = word(stmt, 2) /* bass output channel */
melody = word(stmt, 3) /* melody output channel */
splitkey = word(stmt,4) /* key to split on */
say "router_begin note"
say "router_chan 0 0 0" bass
say "router_par1 1" splitkey "1 0"
say "router_end"
say "router_begin note"
say "router_chan 0 0 0" melody
say "router_par1" splitkey+1 "88 1 0"
say "router_end"
end
when cmd = "trans" then do
offset = word( stmt, 2 )
if datatype( offset, "NUM" ) then do
if ( offset > 12 ) | ( offset < -12 ) then ,
say "invalid trans"
else do
say "router_begin note"
say "router_par1 1 88 1" offset
say "router_end"
end
end
end
otherwise do /* send command as-is */
say stmt
if cmd = "select" | cmd = "prog" then do
say "channels"
end
end
end
end
exit 0
inparse:
parse arg instr
parse var instr prog '.' bank '.' font
if bank = '' then bank = "0"
if font = '' then font = "0"
instdef = font bank prog
return instdef
--
************************************************************************
* Dave Serls Littleton, CO, USA *
* dashs.denver.co.us sorrybiscuit.com *
************************************************************************