midiecho - Simulates tape-loop delay echo: on MIDI files, or on real-time MIDI
# on midi-files ( *.mid ) : midiecho -c 3 fn # echo will be added to midi channel 3 midiecho -c 3 -d 450,900,1350 fn # echoes at 450, 900 and 1350 mS midiecho -c 3 -d 450,900 -q 30 fn # each echo is (MIDI) 30 quieter midiecho -c 2 -d 450 -e 5 -q 30 fn # the echo appears on channel 5 midiecho -c 3 -d 40 -e 4 -p 10 -q 0 # Automatic-Double-Tracking midiecho -c 1 -d 350 -q 35 -S # stateless synth doesn't count note_ons midiecho filename # defaults: midiecho -c 0 -d 300 -q 30 muscript -midi f.txt | midiecho -c 1 -d 300 -q 25 -e 2 >f.mid # on real-time (raw) midi : midiecho -i 22:0 -o 128:0 -c 3 -d 450,900 # from ALSAport 22 to 128 midikbd -o - 1:90 0:105 | midiecho -i - -d 1 -q 40 -e 1
Simulates (roughly) a tape-delay echo on a particular MIDI-channel by issuing repeated note_on events with diminishing volume. It does about as well as can be done at the MIDI-level, but how well that works on your particular sounds is for you to decide; YMMV!
Midiecho sounds best if the -e option is used, to assign the echoes to different MIDI-channels; this avoids notes being restarted before they have finished. Without -e, midiecho works much better on transient sounds, e.g. banjo, or snare-drum.
If the -e option is not being used, then the echo note is played on the same channel as the original note. If this leaves your synth chopping of lots of notes (when the original note is not finished by the time the echo note starts), then your synth is probably stateless, and you should try invoking midiecho with the -S option.
The -p option allows the echo to be detuned (in 1/100's of a semitone) which makes possible an "Automatic Double-Tracking" effect.
Since version 2.0, the -i and -o options allow midiecho to work on real-time (raw) midi inputs, as well as on midi files.
Echo will be added to midi Channel 3. The channels are numbered from 0...15 If -c is not specified, the default channel is 0. Midiecho can only add echoes to one channel at once; the other channels pass through unaltered.
The echo notes will be Delayed 350, 650 and 900 mS after the original note. If -d is not specified, the default delay is just 300 mS
The Echoes are produced not on the original (-c) channel but on the channels 4 then 5 then 4 again (in this example there are three echoes). This is a really useful option :-)
As one example usage, you might have set up your synth's channel 4 and 5 with the same patch (instrumental sound) as the original channel (e.g. 3), but panned to different places in the stereo image. This creates a very realistic echo-effect.
Another example usage could be to set up the echo-channels with a completely different sound, maybe something atmospheric or ethereal.
Another example usage could be to set up the echo-channels with a different patch, and use a 1ms delay, thus doubling the original channel with a different sound.
If the number of echo-channels (-e) is fewer than the number of delays in the -d list, then the last echo-channel is repeated as necessary.
Echo will be added only to midi Notes 38 and 40. This option is mainly useful with General-MIDI channel 9, which represents a drumkit, with each note representing a different drum, see www.pjb.com.au/muscript/gm.html#perc
In this -c 9 -n 38,40 example, echoes would only be added to the Acoustic Snare and the Electric Snare sounds.
The echo will be Pitch-changed up 8 cents
(hundredths of a semi-tone). This is mainly useful in conjunction with
the -e and -d options to produce the "Automatic-Double-Tracking" effect, e.g.
midiecho -c 3 -d 40 -e 4 -p 10 -q 0
which assumes that the original channel 3 is panned over to one
extreme, and the echo-channel 4 is set up with the same patch but
panned over the other way. It then produces an "echo" just 40mS
late and just 10 cents lower. Because the two sounds are in different
speakers they don't beat with each other, and sound almost like two
instruments playing in unison.
The first delayed note is 35 (MIDI) Quieter than the original, and the second is 20 quieter still.
If the number of quietenings (-e) is fewer than the number of delays in the -d list, then the last quietening is repeated as necessary.
If -q is not specified, by default each delayed note is 30 quieter than the previous. (needs x0.6,)
You'll need to use the -S option if the sythesiser you're going to be using is Stateless (and if you're not using -e). In other words, if the sythesiser does not keep a count of how many note_on's there have been on a given note, and switches the note off if receives even just one note_off command. So if your synth seems to be chopping off lots of notes, you should try invoking midiecho with the -S option.
This option puts I
In the first example, the port is specified as an ALSA-port; you can check out the available ports with the command arecordmidi -l or aconnect -il. In the second example, the port is one of the raw-midi device files in /dev/snd/ (just be warned that if you want to input from a virtual-midi device, you have to connect the client to itself e.g.: aconnect 24 24, don't ask me why)
If there are no free Virtual-MIDI ports, then you need to reload the
snd-virmidi kernel-module
with more virtual sound-cards enabled, e.g.:
modprobe -r snd-virmidi
modprobe snd-virmidi enable=1,1
If the device is -
then it reads from STDIN, e.g.:
midikbd -o - | midiecho -i - -d 250,450 -q 45 -e 1,2
or:
midikbd -o - 5:91:120 4:14:120 3:91:8 2:14:8 1:29:64 0:14:64 \
| midiecho -i - -d 1,2200,2201,4400,4401 -q 5 -e 1,2,3,4,5
This option assumes midiecho is in raw-midi mode (i.e. you also need the -i option), and sets the ouput-port to which the midi output will be sent. The default ouput-port is the environment variable $ALSA_OUTPUT_PORTS
As with the -i option, in the first example, the port is specified as an ALSA-port; you can check out the available ports with the command aplaymidi -l or aconnect -ol. In the second example, the port is one of the raw-midi device files in /dev/snd/ (just be warned that only one process can open a raw-midi device file at once).
As an example, note that
this muscript file
sets up some extra MIDI channels on the synth;
channel 3 is patch 105, which is a banjo
channel 4 is patch 105 pan 5, which is a banjo panned left
channel 5 is patch 105 pan 95, which is a banjo panned right
channel 6 is patch 91 pan 10, which is a Pad 4 (choir)
channel 7 is patch 88 pan 90, which is a Pad 7 (halo), and
channel 8 is patch 66 pan 35, which is a tenor sax
It was converted into midi by the command
muscript -midi t > t.mid
(or listen to t.mp3)
Then a couple of echoes on the same channel (3) were added with
midiecho -c 3 -d 250,450 -q 45 -N t.mid > t1.mid
(or listen to t1.mp3)
or on different channels with the same patch (banjo)
but panned left and right with
midiecho -c 3 -d 250,450 -q 45 -e 4,5 t.mid > t2.mid
(or listen to t2.mp3)
or on channels with different, more ethereal, patches with
midiecho -c 3 -d 250,450 -q 45 -e 6,7 t.mid > t3.mid
(or listen to t3.mp3)
or on a channel with a saxophone patch and a
one-millisecond delay, for a doubling effect, with
midiecho -c 3 -d 1 -q 5 -e 8 t.mid > t4.mid
(or listen to t4.mp3)
The current version of midiecho is available by http at
www.pjb.com.au/midi/free/midiecho.txt (rename it to midiecho,
make it executable, and move it into your $PATH),
or as part of
www.pjb.com.au/midi/free/midiscripts.tar.gz
(unpack the tar archive somewhere in your $PATH).
If necessary, edit the first lines to reflect
where perl is installed on your system.
You'll also need to install the MIDI-Perl module written by Sean Burke.
2.4, 20100420, bug fixed with real-time pitch-bend events
2.3, 20100325, real-time patch-changes do not get echoed
2.2, 20100324, real-time mode now handles running-status,
and the aconnect connections get cleaned up even after Ctrl-C
2.1, 20100324, fixed bug:
-p in real-time mode was a quarter-tone flat
2.0, 20100323,
the -i and
the -o options
work on real-time raw midi, not just on .mid midi-files
1.9, 20071006, fixed 2 bugs; numerical sort of keys of %pending,
and start_time remembers $millisecs, not $unique_ms
1.8, 20070403,
the -p option allows Automatic-Double-Tracking
1.5, 20060804, tracks overlapping note_ons in input,
1.4, 20060729, reads STDIN if no filename, for use in pipes
1.3, 20060728, first working version;
-N is now the default, and
-S
introduced to handle stateless synths.
Peter J Billam www.pjb.com.au/comp/contact.html
Based on Sean Burke's MIDI::Perl CPAN module.
search.cpan.org/~sburke
www.pjb.com.au/muscript
www.pjb.com.au/midi/midikbd.html
www.pjb.com.au/midi/bassline.html
www.pjb.com.au/midi/mididump.html
www.pjb.com.au/midi/midiedit.html
www.pjb.com.au/midi/musicxml2mid.html
www.pjb.com.au/midi