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 grid

    This package contains tools for working with grid-like two-dimensional structures.

    This package contains tools for working with grid-like two-dimensional structures.

    The contents of this package have aliases in the top-level package o1, so they are accessible to students simply via import o1._.

    Definition Classes
    o1
  • package gui

    This package contains tools for building simple GUIs.

    This package contains tools for building simple GUIs. The toolkit is particularly well suited to constructing GUIs that display information as 2D images and/or geometric shapes. It is not designed for demanding graphical needs that call for high efficiency. Some of the tools in this package are built on the Swing GUI library, and the two libraries can be used in combination.

    Some of the types in this package have aliases in the top-level package o1, so they are accessible to students simply via import o1._. Some of the package contents are not available in the top-level package or included in this documentation.

    Please note: One of this package’s key components (views) comes in multiple varieties, which which are defined in the subpackages o1.gui.mutable and o1.gui.immutable and not listed below. The View that is most commonly used in O1 (and aliased as o1.View in the top-level package) is o1.gui.mutable.ViewFrame.

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

  • 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._.

  • package util

    The package o1.util contains miscellaneous tools that are used internally by some of the given programs in O1 for added convenience.

    The package o1.util contains miscellaneous tools that are used internally by some of the given programs in O1 for added convenience.

    NOTE TO STUDENTS: In this course, you don't need to understand how this package works or can be used.

    This documentation lists only some of the tools in the package. The listed tools are largely a mix of:

    • functions for simple I/O from files and URLs;
    • aliases for easy access (via import o1.util._) to some of the tools from scala.util; and
    • implicit classes that add a few convenience methods to selected types from the Scala API.
    Definition Classes
    o1
  • package world

    This package contains tools for locations and movement in two-dimensional space.

    This package contains tools for locations and movement in two-dimensional space.

    The tools in this package have aliases in the top-level package o1, so they are accessible to students simply via import o1._.

    The subpackage o1.world.objects contains additional tools for representing entities that reside within two-dimensional spaces.

    Definition Classes
    o1
p

o1

sound

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.
Linear Supertypes
AnyRef, Any

Package Members

  1. 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.

  2. 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._.

Inherited from AnyRef

Inherited from Any

Ungrouped