o1.sound.midi
Type members
Classlikes
An adjustment to the frequency of a Pitch: a Flat, a Sharp, or a Natural.
An adjustment to the frequency of a Pitch: a Flat, a Sharp, or a Natural.
- Value parameters:
- shift
the shift from the base frequency caused by the accidental (in semitones). A positive number means a higher frequency, a negative number a lower one.
- symbol
a symbol describing the accidental: "#", "♭", or the empty string
A MusicElem that sets the instrument for the upcoming notes. The 128 main instruments of the standard MIDI list are supported. The companion object of this class provides constants that match those instruments.
A MusicElem that sets the instrument for the upcoming notes. The 128 main instruments of the standard MIDI list are supported. The companion object of this class provides constants that match those instruments.
- Value parameters:
- number
the number of a MIDI instrument between 0 and 127, inclusive
- Companion:
- object
This object provides a selection of constants that correspond to the 128 main instruments of the standard MIDI list. They are grouped in nested objects (Piano, Strings, etc.). The object PercussionChannel contains constants that correspond to the special sounds available on the MIDI percussion channel.
This object provides a selection of constants that correspond to the 128 main instruments of the standard MIDI list. They are grouped in nested objects (Piano, Strings, etc.). The object PercussionChannel contains constants that correspond to the special sounds available on the MIDI percussion channel.
- Companion:
- class
An error type that signals the underlying Java MIDI toolkit is unavailable.
An error type that signals the underlying Java MIDI toolkit is unavailable.
This companion object of class Music provides additional options for creating Music objects.
This companion object of class Music provides additional options for creating Music objects.
- Companion:
- class
Represents a piece of music that may consist of multiple Voices, which in turn consist of MusicElems such as notes.
Represents a piece of music that may consist of multiple Voices, which in turn consist of MusicElems such as notes.
Instead of using the constructor, you can use the companion object to construct a
Music object from a string: e.g., Music("cdefg&>gfedc").
- Value parameters:
- tempoSetting
a tempo setting (in beats per minute) for the music, if there is one
- voices
the voices that, played simultaneously, make up the piece of music; no more than
MaxVoicesplus a possible percussion track
- Companion:
- object
A MusicElem is an element describes an aspect of MIDI music: a note, a chord, a pause,
or a meta directive such as the change of an instrument. MusicElems put together make a
Voice; voices put together compose a piece of Music.
A MusicElem is an element describes an aspect of MIDI music: a note, a chord, a pause,
or a meta directive such as the change of an instrument. MusicElems put together make a
Voice; voices put together compose a piece of Music.
Each MusicEleme has a length that represents how long it takes to play it. The duration
of the shortest audible sound playable with o1.sound.midi is one; other durations are
linearly relative to that.
- See also:
the subtypes Note, Chord, Pause, OctaveShift, Instrument
Each instance of this class represents a single musical note at a set pitch.
Each instance of this class represents a single musical note at a set pitch.
- Value parameters:
- isStaccato
whether the note should be played staccato so that sound is shorter than its duration
- length
the duration of the note: how long it takes to play it
- pitch
the pitch of the note
Each instance of this class is a directive that instructs the subsequent notes to play one octave higher or lower.
Each instance of this class is a directive that instructs the subsequent notes to play one octave higher or lower.
- Value parameters:
- shift
the direction of the shift: +1 means one octave higher, -1 one lower
This object is a MusicElem that represents a short pause in the music.
This object is a MusicElem that represents a short pause in the music.
A Pitch is a frequency for a note to be played at.
A Pitch is a frequency for a note to be played at.
- Value parameters:
- accidental
an adjustment to the base frequency
- name
the name of the corresponding note, which provides the base frequency; one of "cdefgah" or their upper-case equivalents
- octave
the number of the octave relative to
DefaultOctave; e.g., -2 means two octaves lower than the default; passing inNonehas the same effect as passing in zero
- Companion:
- object
This object is an interface to the underlying MIDI sequencer. It is a thin Scala wrapper around the sequencer in the Java MIDI API.
This object is an interface to the underlying MIDI sequencer. It is a thin Scala wrapper around the sequencer in the Java MIDI API.
This object is an interface to the underlying MIDI synthesizer. It is a thin Scala wrapper around the synthesizer in the Java MIDI API. Uses the piano sound.
This object is an interface to the underlying MIDI synthesizer. It is a thin Scala wrapper around the synthesizer in the Java MIDI API. Uses the piano sound.
Represents a single voice within a piece of Music. A voice consists of MusicElems, primarily notes, in order.
Represents a single voice within a piece of Music. A voice consists of MusicElems, primarily notes, in order.
- Value parameters:
- isPercussion
whether the notes should not be interpresed as regular notes but as the special sounds defined for the MIDI standard’s percussion channel
- notes
the notes (and possible other MusicElems) that compose this voice
Types
Value members
Concrete methods
Parses the given musical String and returns the result as a Music object.
The String must be formatted as described in the package overview.
Throws an IllegalArgumentException in case the String was invalid.
Parses the given musical String and returns the result as a Music object.
The String must be formatted as described in the package overview.
Throws an IllegalArgumentException in case the String was invalid.
Parses the given musical String and plays the music that it describes on the MIDI synthesizer.
The String must be formatted as described in the package overview.
Prints out an error message in case the String was invalid.
Parses the given musical String and plays the music that it describes on the MIDI synthesizer.
The String must be formatted as described in the package overview.
Prints out an error message in case the String was invalid.
Concrete fields
The number (5) of the default octave to play notes from.
The number (5) of the default octave to play notes from.
The default tempo (120 beats per minute). This is used by various methods in with this package when playing music, unless otherwise specified.
The default tempo (120 beats per minute). This is used by various methods in with this package when playing music, unless otherwise specified.
A number (127) that corresponds to the highest possible volume setting available to this MIDI package. (The lowest is zero.)
A number (127) that corresponds to the highest possible volume setting available to this MIDI package. (The lowest is zero.)
