package sound
Please see one of the two subpackages:
- o1.sound.midi for MIDI sound described in terms of notes, instruments, and other directives
- o1.sound.sampled for working with recorded sound samples.
Package Members
- package midi
This is one of O1’s sound packages (the other being o1.sound.sampled).
This is one of O1’s sound packages (the other being o1.sound.sampled). This package provides a simple interface to a part of the more generic MIDI API. In particular, it lets students play MIDI music by writing notes a
String
and passing them to a function. That function, play, has an alias in the top-level package o1, so it’s accessible to students simply viaimport o1._
.Here is a summary of the notation used in the musical
String
s that you pass to play and some other functions in this package:"cdefgah"
plays seven notes at the default tempo of 120. (N.B. the seventh note ish
, notb
.)"CDEFGAH"
plays them louder."CDEFGAH/240"
plays them at a double tempo of 240."CD E"
has a pause between the second and third note."CD-E---"
has a longer second note and a longer still third note."C.D.E"
produces a staccato-like effect on the first two notes (playing them shorter followed by a pause).">CDE<<<CDE"
plays three notes in a higher octave then shifts three octaves down before playing them again."C7D3E"
plays the c in Octave #7, the d in Octave #3, and the e in the default Octave #5."CbDBE#7F"
has a c-flat, a d-flat, an e-sharp in Octave #7, and a natural f. b and B are equivalent."C♭D♭E♯7F♮"
is a fancy-pants way of writing the same thing."CDE[13]CDE"
plays three notes using the default Instrument #1, then again using Instrument #13."(CEG)(DF#A)(EG#H)---"
plays three chords, the last of which is longer."CDE&<<[28]efg&[110] F"
simultaneously plays the three parts separated by&
s."P:CDE"
uses the MIDI percussion channel: each "note"represents a different percussion instrument.
"C|D||||E"
means the same as ̀"cde"
: the|
s don't do anything, but you can use them to mark bars or whatever.
For a numbered list of the instruments, see the General MIDI Sound Set; the
Instrument
object contains the same list as Scala constants. - package sampled
This is one of O1’s sound packages (the other being o1.sound.midi).
This is one of O1’s sound packages (the other being o1.sound.midi). This package provides a simple interface for loading recorded sound samples.
The contents of the package have aliases in the top-level package o1, so they are accessible to students simply via
import o1._
.