On Sun, 13 Feb 2005 15:48:02 -0600, Boyd Stephen Smith Jr.
<[EMAIL PROTECTED]> wrote:
> On Sunday 13 February 2005 03:31 pm, Mark Knecht <[EMAIL PROTECTED]>
> wrote:
<SNIP>
> > > > 3) Ask me which on I want to use
> >
> > Easy to make it ask the question but so far I cannot find the bash
> > command to wait for keyboard input. There must be one but I don't see
> > it in man bash.
>
> The bash command read will read one line on text into a variable you use it
> like:
> read foo;
> echo $foo;
Hi again,
Thanks to everyone who's helped with my little project today. I now
have a working version of a script that is started by double clicking
on an icon in Gnome and answering some questions. Cool for me.
Thanks.
For reference, and because I have one little problem here's the script:
#!/bin/bash
gigdump "$1" | grep Instrument | grep MIDI
echo
echo Please pick an instrument
read INSTRUMENT
echo INSTRUMENT = $INSTRUMENT
echo "ADD CHANNEL" | nc localhost 8888
echo "LOAD ENGINE gig 0" | nc localhost 8888
echo "SET CHANNEL AUDIO_OUTPUT_DEVICE 0 0" | nc localhost 8888
echo "LOAD INSTRUMENT ""\""$1"\"" $(($INSTRUMENT-1)) "0" | nc localhost 8888
echo "SET CHANNEL VOLUME 0 0.40" | nc localhost 8888
echo From 1-16 please pick a MIDI channel for this instrument
read MIDI
echo "SET CHANNEL MIDI_INPUT 0 0 0 "$(($MIDI-1)) | nc localhost 8888
echo Hook to which alsa_pcm:playback pair?
read JACK
echo "SET AUDIO_OUTPUT_CHANNEL_PARAMETER 0 0
JACK_BINDINGS='alsa_pcm:playback_"$JACK"'" | nc localhost 8888
echo "SET AUDIO_OUTPUT_CHANNEL_PARAMETER 0 1
JACK_BINDINGS='alsa_pcm:playback_"$(($JACK+1))"'" | nc localhost 8888
echo "GET CHANNEL INFO 0" | nc localhost 8888
echo Hit enter to finish
read WAIT
Within reasonable usage this works just fine. I could add some error
checking, etc. but it's fine for now. There is only one more thing I
need to make it really useful. When the output of 'echo "ADD CHANNEL"
| nc localhost 8888' is executed LinuxSampler returns a channel
number. Here's a pass at using the script:
Instrument 1) "Grand Piano 1", MIDIBank=0, MIDIProgram=0
Please pick an instrument
1
INSTRUMENT = 1
OK[0]
OK
OK
OK
OK
>From 1-16 please pick a MIDI channel for this instrument
1
OK
Hook to which alsa_pcm:playback pair?
12
OK
OK
ENGINE_NAME: GigEngine
VOLUME: 0.400
AUDIO_OUTPUT_DEVICE: 0
AUDIO_OUTPUT_CHANNELS: 2
AUDIO_OUTPUT_ROUTING: 0,1
MIDI_INPUT_DEVICE: 0
MIDI_INPUT_PORT: 0
MIDI_INPUT_CHANNEL: 0
INSTRUMENT_FILE: /home/mark/Gigs/GSt25/Pianos/East West/grandpiano1.sf2.gig
INSTRUMENT_NR: 0
INSTRUMENT_NAME: Grand Piano 1
INSTRUMENT_STATUS: 100
.
Hit enter to finish
Note that near the start there is a response
OK[0]
Note that if I load a second gig file then LinuxSampler returns a new
channel number:
Instrument 1) "Dyno Rhodes", MIDIBank=0, MIDIProgram=0
Please pick an instrument
1
INSTRUMENT = 1
OK[1]
OK
OK
OK
OK
>From 1-16 please pick a MIDI channel for this instrument
The '0' & '1' are the real channel numbers that LinuxSampler has
assigned to my set of commands. I do not know how to capture this
response back into my script.
Does anyone know how I grab this response?
Thanks,
Mark
--
[email protected] mailing list