Top Up Prev Next Bottom Contents Index Search

2.10 Sounds

On some workstations (currently only SGI Indigos, HP 700s and HP 800s and Sun SparcStations,), Ptolemy can play sounds over the workstation speaker. Below we discuss various details about playing sounds on various workstations.

2.10.1 Workstation Audio Internet Resources

Below we list several workstation audio resources on the Internet.
Home of the audio file format FAQ.
The AF program is an audio server similar to the X server which allows remote machine to play audio on the local machine. The user starts the AF program in the background and then uses the aplay program to play sounds. AF is not directly supported by Ptolemy, but is nonetheless useful.
The sox program converts files between various formats.
The workman program can play audio CDs on Sun SparcStations.

2.10.2 Solaris

Sun workstations running Solaris2.x can play 8kHz mu law sounds directly through
/dev/audio. The Solaris2.x /usr/openwin/bin/audiotool program can be used to control the record and play volume and the input and output sources. In Ptolemy 0.7 and later, the SDF Play star writes the appropriate .au file header.

Most Sun workstations can only play 8 bit u-law audio at 8khz. Sun UltraSparcs can play a range of audio formats: 8 bit u-law, 8 bit A-law and 16 bit linear. UltraSparcs can also play a range of sample rates, including CD (44.1khz) and DAT (48khz).

The Solaris /usr/demo/SOUND contains sample sounds and programs. See /usr/demo/SOUND/bin/soundtool for a graphical sound program with a slightly different interface. For further information about audio on Sun workstations, see the man pages in /usr/demo/SOUND/man, and the man pages for audioamd, audiocs, dbri, sbpro, audio, and cdio.

SparcStation CD-ROM

The workman program can play audio CD's via the Sun SparcStation CD-ROM drive. workman can be configured to use the Solaris volmgt program so that when an audio CD is inserted into the drive it is automatically played. Only the Sparc5 and a few obscure Sparc10s can get audio from the CD directly.Most other Sparcs can use a mini jump plug from the headphone jack on the CD-ROM to the line in on the back of the machine. You can then use audiotool to control the inputs and outputs. Look under the Volume menu button for the proper controls. It may take a few minutes to adjust the levels appropriately. The workman program can be used as an audio source with the CGC Tycho demos (see "Tycho Demos" on page 14-27) to demonstrate the various audio effects.

2.10.3 HPUX

Under HPUX10.x, the /opt/audio/bin/audio_editor program can play sounds. Under HPXU9.x, use /usr/audio/bin/audio_editor.

2.10.4 Playing Audio over the Network

If you use Ptolemy to create audio files, then you may want to share them with others over the network.There are several ways to play audio over the network, we discuss them below.

Via the Web

Audio files can be placed on HTML pages and played by many HTML browsers over the network. There are many proprietary commercial server packages that allow users to listen to audio via their browser, we do not cover those packages here, instead we discuss two common formats: .au and .wav. In general, SparcStations can directly play only .au files and Windows and Macintosh machines can play both .au and .wav files. If you use Ptolemy to generate a .au file, the file must have a proper header. The SDF Play star will generate that header for you.

Under Solaris, you can use the xplaygizmo and AudioFile aplay programs to play audio files via a browser. To set this up, place the following in the .mailcap file in your home directory and restart your browser.

audio/*; xplaygizmo -p -q /usr/sww/AF/bin/aplay; stream-buffer-size=2000
On the Macintosh to play the .au files under Netscape, you may need to install a sound program. If you are using the "Berkeley Internet Kit", then you probably already have installed a program SoundApp that can play the Sun audio files. However, Netscape may not be configured to use it. You can change this by selecting General Preferences from the Options menu, and selecting the Helpers page within that. Under ULAW audio, you should set the file type to ULAW and the application program to SoundApp.


Java can play .au files over the net, but again, these files must have a proper header.


The AudioFile program AF is a audio server that allows a user to listen to a sound generated on a remote machine. See the link above for more information.

2.10.5 Ptolemy Sounds

You can try playing sounds with the universe you just created. Replace the XMgraph star in waveform window with an instance of the Play star (second row of the sinks palette, right of center, with a stylized loudspeaker as an icon). Edit the parameters of the Play star entering 16000 for the gain parameter. (To see details about the Play star, execute the "profile" command in the "Other" menu, or type a comma (",") with the mouse on the Play icon). The SPARCstation's speaker is driven by a codec that operates at an 8 kHz sample rate. So running this universe for 40000 samples will produce about 5 seconds of sound. The sound produced by the current parameters is not particularly attractive. Experiment with different parameter values. Try PI/1000 in place of the PI/50.

An interesting variant of this system modulates a chirp instead of a pure sinusoid with a low frequency sinusoid. A chirp is a sinusoid that sweeps over a frequency range. You could replace one of your sinegen instances with something that generates a chirp, and again experiment with parameters.

A chirp can be created with three stars: a Ramp, an Integrator and a Sin, connected in series. The step parameter of the Ramp should be very small, such as 0.0001. With this value, you will hear some aliasing if you create five seconds of sound. The Integrator is in the "arithmetic" palette, furthest on the right, and its default parameter values are fine for this purpose. Use the "profile" command (",") to read about it. Note that a fourth star, a Const (second star in "sources" palette) is needed to set the Integrator reset input to zero.

In the SDF domain, sound output is collected into a file, and then played out in real time. Another alternative, available in the CGC domain, is to generate the output in real-time. Since the CGC stars have not been optimized for real-time performance, only simple signals can be generated at this time.

This is a good time to try out your own examples. In general, when you create new galaxies and universes that depend on each other, it is a good idea to keep them together in one directory. For example, all of the facets we have created so far are in the "example" directory. You can use the extensive Ptolemy demos as models.

Top Up Prev Next Bottom Contents Index Search

Copyright © 1990-1997, University of California. All rights reserved.