O1Library Docs
Fall 2023
Docs API

# MusicElem

o1.sound.midi.MusicElem
trait MusicElem

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. `MusicElem`s put together make a Voice; voices put together compose a piece of Music.

Each `MusicElem` 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.

## Attributes

See also

  the subtypes Note, Chord, Pause, OctaveShift, Instrument

Graph
Supertypes
  class Object
  trait Matchable
  class Any
Known subtypes
  class Chord
  class Instrument
  class Note
  class OctaveShift
  object Pause.type

## Members list

### Value members

#### Abstract methods

def length: Int

the duration of the `MusicElem`: how long it takes to play it

the duration of the `MusicElem`: how long it takes to play it

## Attributes