Squeak Class Documentation category index | class index  
 
MIDISynth
  category: Sound-Scores
  superclass: Object
  subclasses:

I implement a simple real-time MIDI synthesizer on platforms that support MIDI input. I work best on platforms that allow the sound buffer to be made very short--under 50 milliseconds is good and under 20 milliseconds is preferred (see below). The buffer size is changed by modifying the class initialization method of SoundPlayer and executing the do-it there to re-start the sound player.

Each instance of me takes input from a single MIDI input port. Multiple instances of me can be used to handle multiple MIDI input ports. I distribute incoming commands among my sixteen MIDISynthChannel objects. Most of the interpretation of the MIDI commands is done by these channel objects.

Buffer size notes: At the moment, most fast PowerPC Macintosh computers can probably work with buffer sizes down to 50 milliseconds, and the Powerbook G3 works down to about 15 milliseconds. You will need to experiment to discover the minimum buffer size that does not result in clicking during sound output. (Hint: Be sure to turn off power cycling on your Powerbook. Other applications and extensions can steal cycles from Squeak, causing intermittent clicking. Experimentation may be necessary to find a configuration that works for you.)

instance methods
  as yet unclassified
  channel:
closeMIDIPort
initialize
instrumentForChannel:
instrumentForChannel:put:
isOn
midiParser
midiPort
midiPort:
midiTrackingLoop
mutedForChannel:put:
panForChannel:
panForChannel:put:
processMIDI
processMIDIUntilMouseDown
setAllChannelMasterVolumes:
startMIDITracking
stopMIDITracking
volumeForChannel:
volumeForChannel:put:

class methods
  examples
  example

  instance creation
  new

instance methods
  as yet unclassified top  
 

channel:


 

closeMIDIPort


 

initialize


 

instrumentForChannel:


 

instrumentForChannel:put:


 

isOn


 

midiParser


 

midiPort


 

midiPort:


 

midiTrackingLoop


 

mutedForChannel:put:


 

panForChannel:


 

panForChannel:put:


 

processMIDI

Process some MIDI commands. Answer true if any commands were processed.


 

processMIDIUntilMouseDown

Used for debugging. Do MIDI processing until the mouse is pressed.


 

setAllChannelMasterVolumes:


 

startMIDITracking


 

stopMIDITracking


 

volumeForChannel:


 

volumeForChannel:put:


class methods
  examples top  
 

example

Here's one way to run the MIDI synth. It will get a nice Morphic UI later. Click the mouse to stop running it. (Mac users note: be sure you have MIDI interface adaptor plugged in, or Squeak will hang waiting for the external clock signal.).


  instance creation top  
 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.