Music

final case class Music(tempoSetting: Option[Int], voices: Seq[Voice])

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 MaxVoices plus a possible percussion track

Companion:
object
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def play(): Unit

Plays this music using the MIDI synthesizer. This is equivalent to calling o1.sound.midi.play. Students have access to the same functionality via the play method in the top-level package o1.

Plays this music using the MIDI synthesizer. This is equivalent to calling o1.sound.midi.play. Students have access to the same functionality via the play method in the top-level package o1.

def toMidi: Sequence

Returns the underlying MIDI sequence.

Returns the underlying MIDI sequence.

override def toString: String

Returns a string description of the music.

Returns a string description of the music.

Definition Classes

Inherited methods

Inherited from:
Product

Concrete fields

lazy val nonEmpty: Boolean

whether the Music object has any MusicElems at all

whether the Music object has any MusicElems at all

lazy val tempo: Int

The tempo of the music in beats per minute. This equals tempoSetting or DefaultTempo, if that’s not set.

The tempo of the music in beats per minute. This equals tempoSetting or DefaultTempo, if that’s not set.