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, on the hppa, you may need more publicly available software), Ptolemy can play sounds over the workstation speaker. You can try this 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

ptolemy@eecs.berkeley.edu
Copyright © 1990-1997, University of California. All rights reserved.