Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple library for playing sounds and music in Java
Java
tree: 2fcb202332

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
example
lib
src/kuusisto/tinysound
.gitignore
LICENSE
README
tinysound.zip

README

About
-----
TinySound is a simple sound system that wraps the standard Java sound libraries.
It is "tiny" in that it is intended to have a small, easy-to-use interface with
everything that you need to play sounds and music, and nothing that you don't.

License
-------
TinySound is licensed under the BSD 2-Clause license.  A copy of the license can
be found in the header of every source file as well as in the LICENSE file
included with the TinySound system.

Audio Formats
-------------
TinySound stores all audio as 16-bit, 44.1kHz, 2-channel, linear PCM data
internally.  It makes an effort to convert other formats, but will not be able
to handle all formats.  As for container formats, TinySound should be able to
load any container types supported by your version of Java.  This should include
WAV at the very least.
TinySound can also load Ogg files containing audio in the Vorbis format with the
inclusion of the libraries found in the lib directory.  If you intend to use Ogg
Vorbis files with TinySound just include the jorbis, tritonus_share and
vorbisspi jar files on your CLASSPATH along with TinySound.

Javadocs
--------
http://finnkuusisto.github.com/TinySound

Using TinySound
---------------
There are 3 classes that you need to know when using TinySound: TinySound, Music
and Sound.  TinySound is the main system class, Music is an abstraction for
music, and Sound is an abstraction for a sound effect.  Simple.

-TinySound-
There are really only 2 steps you need to worry about with the TinySound class.
1. Initialization
2. Shutdown

1. Initialization is accomplished via the init() function.  It takes no
arguments and sets up the system for you to play audio data.  TinySound creates
a daemon thread to automatically write audio data to the speakers.

2. Shutdown is accomplished via the shutdown() function.  This shuts down the
update thread and clears resources in use.

-Music-
You load Music objects via the TinySound loadMusic() functions.  Music objects
can be started, stopped, paused, resumed, and looped from specified positions.
If you are done using a particular Music object, you can also unload its sound
data from the system via its unload() function.  See the Javadocs for more
detail.

-Sound-
You load Sound objects via the TinySound loadSound() functions.  Sound objects
work differently from Music objects as you can only play them (no pausing etc.).
When a Sound is played it is queued to be played from the speakers once.  Of
course, you can play a Sound multiple times in an overlapping fashion so it is
generally useful for sound effects.

Example
-------
There is a very simple example provided in the example directory.  You'll need
sound resources with the specified names on the classpath if you want to try the
example without modifying it.  Note that the example does not demonstrate all of
TinySound's features.  See the Javadocs for more detail.
Something went wrong with that request. Please try again.