1 / 11

Field Trip #20

Creating Simple Music By Keith Lynn. Field Trip #20. Midi. Midi stands for Musical Instrument Digital Interface It is an interface that allows a variety of instruments to connect and communicate with each other A single midi link can carry up to 16 channels of information

luce
Download Presentation

Field Trip #20

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creating Simple Music By Keith Lynn Field Trip #20

  2. Midi • Midi stands for Musical Instrument Digital Interface • It is an interface that allows a variety of instruments to connect and communicate with each other • A single midi link can carry up to 16 channels of information • We can connect a channel to a different device

  3. Midi cont'd • A Midi Event message carries information about • Pitch • Notation • Velocity • Volume • etc

  4. Instrument • An instrument is represented by an integer between 0 and 255 • You can find a list of instruments at http://www.ccarh.org/courses/253/handout/gmiinstruments

  5. Creating the Midi • In order to create the midi, we will create a Sequencer • After we create the Sequencer, we open it • We create a Sequence • The Sequence is made of Tracks • The Tracks are made up of MidiEvents • The MidiEvent is composted of a MidiMessage and a tick. The tick indicates the time in the sequence where the event fires

  6. MidiMessage • In this app, we will create a simple message • A ShortMessage contains two bytes of information • To create the ShortMessage, we specify four things • A Midi command • A channel • The first data byte • The second data byte

  7. Midi Commands • The ShortMessage class contains constants that represent Midi commands • Some of the most common are • Note on – Start Playing • Note off – Stop Playing • Program change – Specify what instrument is on a channel

  8. Playing Notes • The third parameter to create the ShortMessage is a note • Middle C is 60 • The fourth parameter is the velocity • Typically we can use 100

  9. Playing the sound • In order to play the Midi sound, we create the ShortMessages and create a MidiEvent • The MidiEvent specifies the ShortMessage and the tick • The tick is the time when the event fires

  10. Creating the Midi Player • In our app, we allow the user to specify through Java components, the values to create a ShortMessage • These ShortMessages appear in a Jpanel • When we are ready to play, we click Play and each of the MidiMessages are put into a track, and the track put in a sequence, and the sequence put in the sequencer

  11. Storing MidiEvents • In our app, we create a Jpanel called a MidiMessagePanel • This class is declared to be Serialiazable • This means that instances of the class can be written to a file • Later we can read them back in • In order to write the objects, we use an ObjectOutputStream, and in order to read the objects, we use an ObjectInputStream

More Related