[NetBehaviour] X Window Midi Arp Toy

james morris james at jwm-art.net
Thu Feb 11 01:05:09 CET 2010

Sorry for the verbiage, but I think it needs some explaining...

The X Window Midi Arp Toy is a BASH script to be run from an X terminal.
It sends midi data to a midi device and acts as a kind of arpeggiator.
The script opens an X terminal, the placement of which directly dictates
the pitch and loudness of the midi note data sent to the device. Each X
terminal that is opened calls the script again, to continue the process
which results in a semi-random arpeggiated sequence and terminals of
varying colours opening up all over your screen (before disappearing
again, one by one). I personally find it quite entertaining.

(and yes, you can stop it - press ctrl-c several times)

Several factors influence this script: The window manager being the most
important here. As an example I will describe the behaviour of the two
window managers I have tested this script under:

The Fluxbox window manager places terminals where they will fit and
always tries placing them from the top left of the screen, moving right
and then down if it cannot place a window without overlapping another.
This kind of behaviour is the kind which creates arpeggiated results.
Patterns can be created by blocking off areas of the screen with the
windows of other programs. These patterns can then be modified by moving
the windows. And if you have virtual work-spaces/desktops you can
arrange several patterns and switch between them.

The EvilWM window manager on the other hand, always places the windows
directly under the mouse pointer (or whatever pointing device you use).
This type of behaviour is better for... un-patterned sequences. The
patterns you create with this kind of behaviour are the patterns you
make with the mouse pointer.

The Script's System Settings (important!)
There is only one option in the system settings section of the script:
the midi device to use to send midi data to.


is used by default. If you're lucky this device exists on your system,
otherwise you'll have to know which device to set mididev to. On my
system, in qjackctl, I connect virtual raw midi 1 to my favourite
softsynth and them I'm off!


Don't expect this script to run well under a window manager with all the
bells and whistles. There's a reason I mention Fluxbox and EvilWM -
they're light and don't do anything fancy, and so respond quickly.

I recommend running this script from within xterm. Again, xterm is
lightweight and very responsive compared to something like Gnome



The Script's User Options

At the top of the script there is a section named "user options" here
you can specify the lowest note and the highest note, the lowest
velocity, and the highest velocity.

A pattern can also be specified in the form of 1's and 0's. A 1 means a
note will be played, a 0 means it won't.

Because of the nature of this script, note durations and pauses are
specified in seconds. BASH is not really cut out for real-time
low-latency precision timing (I assume). The notetime setting is how
long the note should last. The hangtime setting is how long the terminal
window should hang around for after the note turns off. The hangtime
setting does actually influence the pattern, if your window manager
prefers not to overlap windows.

The last settings in the "user options" section are the minimum and
maximum dimensions of the terminal windows that will be opened by the
script. These are also only influential if your window manager prefers
not to overlap windows.




chmod +x Downloads/xwinmidiarptoy



I make no guarantees this will work on your system.

this text: http://jwm-art.net/art/text/xwinmidiarptoy.txt

More information about the NetBehaviour mailing list