Packages

  • package root
    Definition Classes
    root
  • package o1

    O1Library is a toolkit designed for the course Programming 1 (a.k.a. O1) at Aalto University.

    O1Library is a toolkit designed for the course Programming 1 (a.k.a. O1) at Aalto University. It contains an assortment of tools; most prominently, it provides a framework for simple graphical programming and utilities for playing sound.

    This is the front page of O1Library’s documentation. However, this is probably not the best place to start learning about O1Library as a student. That’s because the relevant content of this library is introduced bit by bit in the chapters of O1’s custom ebook alongside the associated programming concepts and assignments.

    You may still find this documentation useful as a reference. You can also find some optional content here that you may wish to try.

    This front page lists the content available in the top-level package called simply o1. These tools are available with the simple command import o1._ in your Scala programs. Some of them you’ll use a lot; some of them you won’t necessarily need at all.

    The tools listed here are actually implemented in a number of subpackages (o1.gui, o1.sound, etc.); what you see here are just “shortcut aliases” to those actual implementations. The aliases are here to make that convenient import command work and to provide you with this list of links to some of the more commonly used tools in O1Library. The subpackages also contain additional content not listed here.

    O1Library has been developed by Aleksi Lukkarinen and Juha Sorva. Several of the key components in o1.gui and o1.world are built upon Aleksi’s Scala Media Computation Library. Some parts of O1Library draw inspiration from the “teachpacks” of the Racket programming language.

    We are grateful to Riku Autio, Joonatan Honkamaa, Juhani Numminen, Leo Varis, Veera Kahva, and anonymous students for bug reports and fixes. We thank Otto Seppälä for helpful discussions.

    Definition Classes
    root
  • package sound

    Please see one of the two subpackages:

    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.
    Definition Classes
    o1
  • 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 via import o1._.

    Here is a summary of the notation used in the musical Strings 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 is h, not b.)
    • "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.

    Definition Classes
    sound
  • Accidental
  • Chord
  • Flat
  • Instrument
  • Music
  • MusicElem
  • Natural
  • Note
  • OctaveShift
  • Pause
  • Pitch
  • Sequencer
  • Sharp
  • Synthesizer
  • Voice

case class Note(pitch: Pitch, length: Int, isStaccato: Boolean) extends MusicElem with Product with Serializable

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

pitch

the pitch of the note

length

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

isStaccato

whether the note should be played staccato so that sound is shorter than its duration

Linear Supertypes
Serializable, Product, Equals, MusicElem, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Note
  2. Serializable
  3. Product
  4. Equals
  5. MusicElem
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Note(pitch: Pitch, length: Int, isStaccato: Boolean)

    pitch

    the pitch of the note

    length

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

    isStaccato

    whether the note should be played staccato so that sound is shorter than its duration

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def audibleLength: Int

    the duration that the note is audible.

    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

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  10. val isStaccato: Boolean
  11. val 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

    Definition Classes
    NoteMusicElem
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. val pitch: Pitch
  16. def productElementNames: Iterator[String]
    Definition Classes
    Product
  17. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  18. def volume: Int

    the volume the note should be played at.

    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.

  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from MusicElem

Inherited from AnyRef

Inherited from Any

Ungrouped