- Forward


Described Auditory Content
An Introduction with Examples in Java


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Introduction
Back SMYC Forward
  • Describe Frequencies:
    • "A" is the name commonly given to the frequencies 55Hz, 110Hz, 220Hz, 440Hz, 880Hz, 1760Hz, etc...
    • The complete set of frequencies in a single octave is usually denoted by the letters A-G followed by either a sharp (half-step up) or flat indicator (half-step down)
  • Describe Durations:
    • Commonly given as multiples/fractions of a base duration (called a whole note)
    • Common durations are half notes, quarter notes, eighth notes and sixteenth notes.
    • A standard duration can be "dotted" to indicate that it should be increased by 50%.
  • Describe the Voice/Instrument:
    • Usually a name
Introduction (cont.)
Back SMYC Forward
  • One Notation:
    • odetojoy
  • Our Notation:
    • A String representation
A "Quick Start"
Back SMYC Forward
  • Presenting Described Auditory Content:
    • The Musical Instrument Digital Interface (MIDI)
  • Original Purpose:
    • A protocol for passing musical events between electronic instruments and sequencers (devices that stored these events)
  • Our Interest:
    • The software portion of the protocol designed to work with files
A "Quick Start" (cont.)
Back SMYC Forward
  • Package:
    • midi
  • Device Classes:
    • Synthesizer (a device for generating sound waves)
    • Sequencer (a device for reading/writing MIDI events)
A "Quick Start" (cont.)
Back SMYC Forward
  • Playing MIDI Files:
    1. Create a Sequence from a File or an InputStream
    2. Create a Sequencer
    3. Open the Sequencer.
    4. Associate the Sequence with the Sequencer.
    5. Start the Sequencer.
  • Using MIDI "On the Fly":
    • Use a Synthesizer directly
A "Quick Start" (cont.)
Back SMYC Forward
Playing MIDI Files
javaexamples/auditory/described/MidiPlayer.java
 
Presenting Described Audio
Back SMYC Forward
midi-sequence
Presenting Described Audio (cont.)
Back SMYC Forward
  1. Obtain a Synthesizer object by calling the MidiSystem.getSynthesizer() method
  2. Get a Soundbank object (e.g., by calling the Synthesizer object's getDefaultSoundBank() method)
  3. Call the Synthesizer object's loadAllInstruments() method (passing it the Soundbank object
  4. Get the MidiChannel objects by calling the Synthesizer object's getChannels() method
Presenting Described Audio (cont.)
Back SMYC Forward
  • One Way:
    1. Obtain a Receiver object by calling the Synthesizerobject's getReceiver() method
    2. Construct a ShortMessage object that turns the note on
    3. Call the Receiver object's send() method (passing it the ShortMessage object)
    4. Wait the appropriate amount of time
    5. Construct a ShortMessage object that turns the note off
    6. Call the Receiver object's send() method (passing it the ShortMessage object)
  • Another Way:
    1. Call the MidiChannel object's noteOn method
    2. Wait the appropriate amount of time
    3. Call the MidiChannel object's noteOff method
Encapsulating Described Auditory Content
Back SMYC Forward

Design Alternatives

DescribedAuditoryContent_duplicative

DescribedAuditoryContent_inflexible

DescribedAuditoryContent_flexible

DescribedAuditoryContent_composite

Encapsulating Described Auditory Content (cont.)
Back SMYC Forward
The Content Interface
javaexamples/auditory/described/Content.java
 
The AbstractContent Class
javaexamples/auditory/described/AbstractContent.java
 
Encapsulating Described Auditory Content (cont.)
Back SMYC Forward
The Note Class
javaexamples/auditory/described/Note.java
 
The NoteFactory Class
javaexamples/auditory/described/NoteFactory.java
 
Encapsulating Described Auditory Content (cont.)
Back SMYC Forward
The Chord Class
javaexamples/auditory/described/Chord.java
 
Encapsulating Described Audio (cont.)
Back SMYC Forward
A Part Class
javaexamples/auditory/described/Part.java
 
A PartFactory Class
javaexamples/auditory/described/PartFactory.java
 
Encapsulating Described Audio (cont.)
Back SMYC Forward
A Score Class
javaexamples/auditory/described/Score.java
 
A ScoreFactory Class
javaexamples/auditory/described/ScoreFactory.java
 
There's Always More to Learn
Back -