O1Library Docs
Fall 2026
Docs API

# Instrument

o1.sound.midi.Instrument
See the Instrument companion object
case class Instrument(number: Int) extends MusicElem

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.

## Parameters

number

  the number of a MIDI instrument between 0 and 127, inclusive

## Attributes

Companion
  object
Graph
Supertypes
  trait Serializable
  trait Product
  trait Equals
  trait MusicElem
  class Object
  trait Matchable
  class Any
  Show all

## Members list

### Value members

#### Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

## Attributes

Inherited from:
  Product

def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

## Attributes

Returns

  in the default implementation, an `Iterator[Any]`

Inherited from:
  Product

#### Concrete fields

val length: Int

an `Instrument` element is a meta directive; it has no duration, so its length is zero

an `Instrument` element is a meta directive; it has no duration, so its length is zero

## Attributes