O1Library Docs
Fall 2026
Docs API

# Note

o1.sound.midi.Note
final case class Note(pitch: Pitch, length: Int, isStaccato: Boolean) extends MusicElem

Each instance of this class represents a single musical note at a set pitch.

## Parameters

isStaccato

  whether the note should be played staccato --- that is, with the sound audible for only part of the note’s duration

length

  the duration of the note: how long it takes to play it

pitch

  the pitch of the note

## Attributes

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

## Members list

### Value members

#### Concrete methods

def audibleLength: Int

the duration that the note is audible. This equals the `length` of the note except for staccato notes whose audible length is half their `length`

the duration that the note is audible. This equals the `length` of the note except for staccato notes whose audible length is half their `length`

## Attributes

override def toString: String

Returns a string description of the note.

Returns a string description of the note.

## Attributes

Definition Classes
  Any

def volume: Int

the volume the note should be played at. The `Note` class selects between `HighVolume` and `MediumVolume` on the basis of the letter case of the note’s Pitch.

the volume the note should be played at. The `Note` class selects between `HighVolume` and `MediumVolume` on the basis of the letter case of the note’s Pitch.

## Attributes

#### 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