Tritonus is a clean room open source implementation of the Java Sound 1.0 API for Linux. It is released under the GNU Library General Public License.
Tritonus is far from being complete and perfect. So volunteers are welcome. This page is intended to coordinate the efforts.
Currently supported are .au, .aiff and .wav (reading and writing). There is currently some reasoning how data in additional chunks can be reflected on the Java side.
In general, for supporting a new file format in Java Sound, you have to implement the javax.sound.sampled.spi.AudioFileReader interface for reading and the javax.sound.sampled.spi.AudioFileWriter interface for writing. For implementing file readers and writers for Tritonus, use Tritonus source code as a reference, not Sun source code. If you have troubles with buffered vs. unbuffered streams, look at how the javax.sound.sampled.AudioSystem class is implemented in Tritonus or ask Florian.
To use new audio file support, change the files src/packaging/core/META-INF/service/ and rebuild the jar files.
Descriptions of audio file formats:
Unlike the sun implementation of Java Sound, Tritonus does not have its own mixing engine. It generally relies on mixing engines available somewhere in the operating system. This has the advantage of integrating seamlessly into the existing infrastructure
Adding support for a new audio server requires implementing the interfaces Mixer, SourceDataLine, TargetDataLine and Clip plus helper interfaces like MixerProvider and FloatControl. If you want to do this, you might have a look at how the existing implementation (esd and alsa) is organized.
NAS is an old but quite poweful audio server. It uses an event-oriented protocol similar to the X protocol.
Playback is unstable: protocoll errors after some minutes, presumably race conditions. Recording and Clips are missing. Volume control is designed but not yet completely implemented. Nice to have: a pure-java client-side library.
NAS is no longer supported by Tritonus.
Esd is a relatively simple, mainly stream-oriented audio server. It is now part of the GNOME project. Old documentation can be found at The Enlightened Sound Daemon. For newer docs, try to search the GNOME sites (I haven't found anything). The main references I used are the library header files, the example programs and the implementation of convenience functions in the library.
In Tritonus, playback and recording are supported. Clips are supported to a limited degree. Volume control is not supported. Nice to have: a pure-java client-side library. Atsuhiko Yamanaka has reported to have some hacks around this. It is planned to integrate this for the future. See the roadmap.)
kaudioserver is the audio server of the KDE project. It is not yet supported. I was not able to locate programming documentation. Try it at www.kde.org.
arts is mainly a sound synthesis engine, but can be used as a mixing engine, too. it is now the audio server of KDE 2.X. It is on the medium-term TODO list to support it. See analog realtime synthesizer.
YIFF is not yet supported. See YIFF.
ALSA supports sound cards with hardware mixing facilities. Support is under development. See the links on ALSA below.
Providing facilities to compress and decompress audio data and to convert between encodings is done by implementing the javax.sound.sampled.spi.FormatConversionProvider.
To use new format converters, change the files in src/packaging/core/META-INF/service/ and rebuild the jar.
Here are some converters/codecs that come to my mind:
Implemented. This converter can convert between mono and stereo and between any channel number and mono. It does conversion of big and little endian, 8, 16, 24 and 32 bit. Still open: 20bit support.
Javalayer 0.0.7 has been incorporated
Java MP3 Player Project
MP3 file creation implemented by using of LAME library.
Also see the Sox Source code
Also see the Sox Source code
Main parts of the MIDI support are now implemented based on the ALSA sequencer. An implementation based on MidiShare is under development. See below.
General information on MIDI:
Information about interfaces to sound card drivers:
ALSA is preferrable, as it will be the standard Linux soundcard driver in version 2.5 of the kernel.
Here are the main tasks:
Reading is implemented. Writing and handling of sysex events are experimental.
Perhaps TiMidity++ can be integrated. There also is a patch to TiMidity to make it act as a client of the ALSA sequencer. However, the author calls it a 'proof-of-concept' and points out that it is not a fully working solution. Does anybody know of other software synthesizers?
Basic playback is implemented for cards whose synth is supported by ALSA. Not yet supported is mute/solo, voice information, soundbank management and some other advanced features.
This is basically implemented based on the ALSA sequencer (MIDI ports are supported on almost all cards that are supported by ALSA at all). However, there are some problems. MIDI IN is working, but is reported to get confused by active sensing events. MIDI OUT is not absolutely stable, too. It's supposed that there are still bugs in ALSA.
RMF (Rich Music Format) support cannot be implemented, because the specification of the format is not published by beatnik and there is no code we can build on. So, other solutions are demanded. Candidates are CSound (there are Java wrappers for it by Michael Gogins), arts (analog realtime synthesizer) and everything around the MPEG-4 Structured Audio standard. See MPEG-4 Structured Audio, SAOL / MPEG-4 Structured Audio homepage, MPEG-4 Structured Audio Page
Tritonus currently uses autoconf. Trials with ANT are under way.
Currently still done by Matthias and Florian. Though this task has been assigned to Warren. Ask him if you want to help.
There are daily CVS snapshots.
For anonymous downloading via CVS, use these commands:
export CVSROOT=:pserver:firstname.lastname@example.org:/cvsroot/tritonus cvs login [press enter when prompted for password] cvs -z3 co tritonus