Logo MIDI Music

MIDI stands for Musical Instrument Digital Interface. Logo has a full set of MIDI commands available. You will need a PC with a MIDI enabled soundcard and functioning headphones/speakers in order to get these commands to work.


Musical Scale

Basic Commands

Open Logo and the procedure editor. Copy and paste this code in and then save and exit.

to scale
print midiopen
repeat 12 [
midimessage (list 144+13 75+repcount 100)
wait 60
midimessage (list 128+13 75+repcount 100)
]
repeat 13 [
midimessage (list 144+13 88-repcount 100)
wait 30
midimessage (list 128+13 88-repcount 100)
]
midiclose
end

Call the procedure with the command line code:

scale

  • midiopen switches links to the midi device on
  • midimessage sends the note on (144) message to channel (13) and switches on note (75+repcount) with velocity (100).
  • The second midimessage (128) then switches the note off.
  • The program loops up and down the scale. Wait is set in 1/60ths of a second.
  • Communications to the MIDI device are closed with midiclose. This is also an effective way to stop things sounding if all else fails
    • The LOGO help files contain loads of information about using MIDI. If you want to connect LOGO to a keyboard or sound module then RTM.

Playing a Chord

Open Logo and the procedure editor. Copy and paste this code in and then save and exit.

to chord
midimessage (list 144+13 60 100)
midimessage (list 144+13 72 100)
midimessage (list 144+13 84 100)
wait 120
midimessage (list 176+13 123 0) ;all notes off
end

If MIDI hasn't already been opened then use the command line code:

show midiopen

Call the procedure with the command line code:

chord

Close MIDI communications with the command line code:

midiclose

  • midimessage sends the note on (144) message to channel (13) and switches on note (60) with velocity (100).
  • midimessage sends the note on (144) message to channel (13) and switches on note (72 one octave, 12 semitones above note 60) with velocity (100).
  • midimessage sends the note on (144) message to channel (13) and switches on note (84 one octave, 12 semitones above note 72) with velocity (100).
  • wait waits for 2 seconds
  • The second midimessage (176+13) then switches all the notes off (123).
    • The LOGO help files contain loads of information about using MIDI. If you want to connect LOGO to a keyboard or sound module then RTM.

Changing the Instrument

Open Logo and the procedure editor. Copy and paste this code in and then save and exit.

to instruments
repeat 10 [
midimessage (list 192+13 40+repcount)
chord
]
end

If MIDI hasn't already been opened then use the command line code:

show midiopen

Call the procedure with the command line code:

instruments

Close MIDI communications with the command line code:

midiclose

  • midimessage sends the program change (192) message to channel (13) and selects instrument (40+repcount).
  • The program then loops through 10 instruments using "Chord" to demonstrate the sounds.
    • These are the instruments used.

Feigenbaum Mapping

This program draws the Feigenbaum mapping of the logistic mapping equation:

x ← ax(1-x)

x is initially set to 0.5, a is a paramater ranging from 0 to 4.

to feig
show midiopen
for [a 1 4 0.005][
make "x1 0.5
repeat 50 [
make "x1 :x1*:a*(1-:x1) ]
repeat 100 [
make "x1 :x1*:a*(1-:x1)
make "xplot -300+:a*100
make "yplot -200+:x1*400
pu setxy :xPlot :yPlot pd fd 1
midimessage (list 144+13 round(:x1*50+20) 100)
midimessage (list 128+13 round(:x1*50+20) 100)
] ]
midiclose
end

Run the program by typing feig at the command line.

  • parameter a is varied from 1 to 4 in increments of 0.005
  • The mapping is iterated 50 times to allow it to reach a stable state.
  • 100 values of the mapping are calculated and plotted. Mapping values are plotted on the y-axis and parameter a is on the x-axis.
  • the x value is used to select the note played by MIDI

Last modified 1st February 2012