Re: [LAU] sending random midi notes from a bash script

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: james morris <james@...>
Cc: <linux-audio-user@...>
Date: Sunday, February 7, 2010 - 1:51 pm

On Sunday, February 7, 2010, james morris wrote:

This translation requires a bit of explanation. The first set of characters
("cdefgabCDEFGAB") are two octaves, the lower one represented by the
symbols "cdefgab" and the upper one by the symbols "CDEFGAB". The two sets
are note names used in the tune, declared at the top:

tune="C 4, E 4, D 4, g 2, C 4, D 4, E 4, C 2, \
E 4, C 4, D 4, g 2, g 4, D 4, E 4, C 2,"

But the MIDI devices expect MIDI note numbers instead of symbolic names, so a
translation is needed. The symbol "c" is translated into the character "<"
(character code 0x3C, decimal 60), and the symbol "C" into the character "H"
(code 0x48, decimal 72). The character codes are the MIDI note numbers, and
we are writting them to character devices (/dev/midi*).

The MIDI note numbers and their corresponding musical notes can be seen in
this nice graphic:
http://en.wikipedia.org/wiki/File:NoteNamesFrequenciesAndMidiNumbers.svg

If you don't need to deal with note names, I suggest you to use the MIDI note
numbers directly. This gives you the widest possible range of notes.

> give me a wider range of notes, but is very middly, there's no bass

Another example is attached. In this case, the script plays a more complex
tune for two voices codified without using symbolic note names. Using this
technique you can even specify different velocities for each note (although
this example uses 0x64, dec.100 for all notes). The sample also uses running
status and knows how to cope with silences.

Regards,
Pedro

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] sending random midi notes from a bash script, james morris, (Sat Feb 6, 2:46 pm)
Re: [LAU] sending random midi notes from a bash script, Pedro Lopez-Cabanillas, (Sat Feb 6, 5:33 pm)
Re: [LAU] sending random midi notes from a bash script, james morris, (Sun Feb 7, 12:42 pm)
Re: [LAU] sending random midi notes from a bash script, Pedro Lopez-Cabanillas, (Sun Feb 7, 1:51 pm)
Re: [LAU] sending random midi notes from a bash script, Ken Restivo, (Thu Feb 11, 9:38 am)
Re: [LAU] sending random midi notes from a bash script, Philippe Hezaine, (Sun Feb 7, 6:29 pm)
Re: [LAU] sending random midi notes from a bash script, Gabriel M. Beddingfield, (Sun Feb 7, 7:43 pm)
Re: [LAU] sending random midi notes from a bash script, Philippe Hezaine, (Sun Feb 7, 8:10 pm)
Re: [LAU] sending random midi notes from a bash script, Philippe Hezaine, (Mon Feb 8, 7:02 pm)
Re: [LAU] sending random midi notes from a bash script, Gabriel M. Beddingfield, (Tue Feb 9, 12:28 am)
Re: [LAU] sending random midi notes from a bash script, Philippe Hezaine, (Tue Feb 9, 8:26 am)
Re: [LAU] sending random midi notes from a bash script, Gordon JC Pearce, (Sat Feb 6, 3:46 pm)
Re: [LAU] sending random midi notes from a bash script, David Santamauro, (Sat Feb 6, 3:46 pm)
Re: [LAU] sending random midi notes from a bash script, james morris, (Sat Feb 6, 4:50 pm)