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
o

o1.sound.midi

Synthesizer

object Synthesizer

This object is an interface to the underlying MIDI synthesizer. It is a thin Scala wrapper around the synthesizer in the Java MIDI API. Uses the piano sound.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Synthesizer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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. lazy val channels: Array[MidiChannel]

    The channels available in the underlying MIDI synthesizer

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. def close(): Unit

    Frees up resources associated with the synthesizers’s Java peer.

  8. lazy val defaultChannel: MidiChannel

    The first channel available in the underlying MIDI synthesizer.

    The first channel available in the underlying MIDI synthesizer. Accessing this value throws a MidiUnavailableException in case no channels are available.

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. lazy val latency: Long

    The latench of the underlying MIDI synthesizer, in milliseconds.

  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def noteOff(note: Pitch): Unit

    Terminates the playing of an ongoing note played with noteOn.

    Terminates the playing of an ongoing note played with noteOn.

    This method throws a MidiUnavailableException if no MIDI channels are available.

    note

    the note to terminate.

  17. def noteOn(note: Pitch, volume: Int): Unit

    Plays a single note on the synthesized piano.

    Plays a single note on the synthesized piano. The sound will fade away eventually or may be cut off using noteOff.

    You must call open once before playing any music with this method, or no sound will play. The method throws a MidiUnavailableException if no MIDI channels are available.

    note

    the note to play on the piano

    volume

    the volume to play it at (between 0 and 127; if you pass in zero, this will work like noteOff)

  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. def open(): Unit

    Prepares the synthesizer for use.

    Prepares the synthesizer for use. This method needs to be called before calling noteOn for the first time.

  21. lazy val peer: javax.sound.midi.Synthesizer

    the underlying Java MIDI synthesizer

  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString: String
    Definition Classes
    AnyRef → Any
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  26. 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 AnyRef

Inherited from Any

Ungrouped