next up previous contents
Next: Example: makesounds program Up: GRASP Routines: General purpose Previous: Function: sgraph()   Contents

Function: audio()

0 void audio(short *array,int n)

Makes a workstation play music! This is guaranteed to work on SUN machines, and may also work on others.

The arguments are:

array: Input. The array that you want to hear.
n: Input. The number of array elements that you want to hear. The elements used are array[0..n-1].

It doesn't take much experience before you find out that an interferometer can do funny things that you can't see in the data stream, if you just graph the numbers. However in many cases you can hear the peculiar events. This function works only on Sun workstations with a CD-sound quality chipset, that can handle 16 bit linear PCM audio. It creates a temporary file, then pipes it though the Sun utility audioplay. The sample rate is assumed to be 9600 Hz.

Note that audio() adjusts the volume so that the loudest event (largest absolute value) in the data stream has a (previously fixed, by us!) maximum amplitude. So the ``background level" of the sound will depend upon the amplitude of the most obnoxious pings, blips, bumps, scrapes or howlers in the data set.

On a machine not equiped with the correct sound chip (for example a SparcStation 2) you can listen to the file, if you first convert it to a format that the chipset can handle. This can be done by taking the output of audio(), which is a file called temp.au and converting it to ``voice" format. To do this, use the command:
audioconvert -f voice -o temp2.au temp.au
You can then listen to the sound using the command:
audioplay temp2.au

Warning: If you share your office with others, they will find the first few events that you listen to highly entertaining. After the first day however they will stop asking what you're listening to. After a few more days, their suggestions that you buy headphones will become more pointed. Respect this request.

Authors: Bruce Allen, ballen@dirac.phys.uwm.edu
Comments: This routine could be modified to permit a bit more freedom in setting the volume and/or the sample rate.


next up previous contents
Next: Example: makesounds program Up: GRASP Routines: General purpose Previous: Function: sgraph()   Contents
Bruce Allen 2000-11-19