Last updated -[Sat Oct 4 00:09:48 1997 by cxh]-
This page discusses Sun audio and audio in general

Local places to go

Some of these links are accessible only to trusted machines
  • Ptolemy Almagest 2.10 Sounds section that repeats much of the info in this page, but in a better format.
  • Java Audio Demos
  • MIDI
  • Listening to CDs on a Sun (accessible only to group machines)
  • MBONE (accessible only to group machines)
  • Sun Video (accessible only to group machines)
  • Useful Programs

  • AF The AudioFile program - Asparc The Sparc Player - aplay - DEC AF ftp site - AF homepage - Local AF page Apparently AudioFile cannot play .wav files If you do aplay -e foo.wav on a .wav file then wav is not listed.
  • audiotool, /usr/local/bin/gaintool - A Sun OpenWindows programs that has controls for volume
  • Under SunOS4.1.3 /usr/demo/SOUND/raw2audio.c can be used to convert raw audio files to a form acceptable to audiotool. raw2audio makes calls to audio_write_filehdr() to fix the headers.
  • xanim can play sound along with video. - The Xanim home page
  • sox can convert between formats. The Sox home page is: Sox is installed locally on sww. The Audio file formats FAQ - has a section about Sox.
  • Macintosh Netscape Helper apps, including SoundApp
  • Local copy of the Audio file formats FAQ - site that contains the audio file format FAQ
  • Some other FAQs that you might find interesting: cdrom.faq - mime.faq - compression.faq speech.faq - www.faq -
  • Audio through the web

    The text for these items is from www.faq, also at
  • RealAudio
    By Progressive Networks (URL is ). The RealAudio player can communicate with a specialized RealAudio server in order to play back audio as it is downloaded, eliminating download delays even over long distances and slow modems. RealAudio now supports a variety of quality levels and non-audio features such as HTML pages displayed in synchronization with the audio. RealAudio players are available for Microsoft Windows, the Macintosh, and several Unix platforms.
  • StreamWorks
    By Xing Technology (URL is ). StreamWorks also provides streaming audio playback, again in conjunction with a special StreamWorks server. Video is also available and can be played back over modems at reduced frame rates. StreamWorks players are available for Microsoft Windows, the Macintosh and several Unix platforms.
  • Apparently Netscape's atlas2 will play audio directly.
  • Brief instructions on playing sounds
    1. Place the following in your .mime.types: audio/au au
    2. Place the following in your .mailcap file audio/x-wav; sox -t .wav - -t .au - | xplaygizmo -p -q /usr/sww/AF/bin/aplay ; stream-buffer-size=2000 audio/*; xplaygizmo -p -q /usr/sww/AF/bin/aplay ; stream-buffer-size=2000 Or, if you don't have xplaygizmo, you can place the following, but this won't work for .wav files: audio/*; /usr/sww/AF/bin/aplay ; stream-buffer-size=2000
    3. Start up the AudioFile server: /usr/sww/bin/AF. If you are on a Sun workstation other than a Sparc10, you should startup /usr/sww/AF/bin/Asparc instead.
    4. Here are Netscape's instructions, gleaned from their web site:
      One way to play sound on a Unix system is to use a program named "sox".
      If you also want to do audio streaming from Netscape (that is, be able
      to play the files while they are still downloading through the network)
      you need a program named "xplay".
      The lines in the "mailcap" file for these two utilities should read:
      audio/x-wav; sox -t .wav - -t .au - | xplay -forkoff -; stream-buffer-size=8000
      audio/*; xplay -forkoff -; stream-buffer-size=8000
      Other ways to play sound on a Unix system would be to use "playulaw",
      "maplay", "sfplay", or even just "cat > /dev/audio", depending on what
      your system has available.
      To display MPEG video, you will need to have a MPEG player; other video
      formats (including QuickTime) can be handled by "xanim".  Be sure to
      have this line in the "mailcap" file:
      video/*; xanim +Ca +CF4 -Cn %s
      To find out where Netscape's "mailcap" file is, go into the Netscape
      Preferences and go down to the "Helper Applications" section.  The
      complete path to the file will probably be something like
      You can override the settings in the normal "mailcap" file (which might
      be installed somewhere where you can't modify it, or where you wouldn't
      want to modify it) by creating a file named ".mailcap" in your home
      directory.  Here's a sample ".mailcap" file:
      audio/x-wav; sox -t .wav - -t .au - | xplay -forkoff -; stream-buffer-size=8000
      audio/*; xplay -forkoff -; stream-buffer-size=8000
      video/*; xanim +Ca +CF4 -Cn %s
      application/postscript; ghostview %s
      application/x-dvi; xdvi %s
    5. Sample sounds:
    6. A Long sound .au file: /usr/demo/SOUND/sounds/
    7. Here's a .au from a SDF demo in Ptolemy:
    8. Two .wav files:hmmm.wav - uh-oh.wav
    9. Locally, you can find sounds in /usr/sww/share/sounds and /usr/demo/SOUND/sounds
  • Sun's /usr/demo/SOUND directory

  • /usr/demo/SOUND contains demo programs
  • /usr/demo/SOUND/bin/soundtool - another Openwindows sound tool with a slightly different interface.

  • Ptolemy and Audio

    Some of the Ptolemy stars use ptplay to play sounds. A quick and dirty ptplay script that uses aplay is #!/bin/sh aplay $* Tom says:
    The SDFPlay star runs the program "ptplay" in a separate background process. Unfortunately aplay is "sophisticated" enough to play more than one file at a time. So in the SDF:sound:speech" demo the two output files get played together. I tried adding the -f flag for aplay in the ptplay script (which forces aplay to wait until all the sound has been played before it returns) but that did not help. The reason is that ptplay is being invoked in *separate* processes. I don't know if we want to change SDFPlay to wait for ptplay to finish, but that seems like the only solution if we are going to allow something like aplay.

    Also, it seems that the ptplay program in Ptolemy0.6 has problems playing long files

    ptplay fails to play all of the following sample:

    ptplay /usr/demo/SOUND/sounds/

    ptplay on RDI machines

    On Jan 28, 1996, Edward wrote:
    The ptplay program appears to be broken. If I run a demo that uses it, the ptplay program starts up but produces no audio. It chews up all my cpu cycles. When I kill it, then it finally produces audio.
    I wrote:
    The sdf:sound:chirpplay demo works for me on campus. Perhaps there is some sort of problem with the audio on traveler, possibly due to the sleep resume stuff and the audio drivers. You could try: ptplay ~ptdesign/src/domains/sdf/demo/speech/ Also, '/usr/demo/SOUND/bin/soundtool' says that is not a valid file, but then plays it anyway.
    Wan-teh wrote:
    I remember that a "valid" .au file should have an ASCII header (possibly containing info like file name, file size, sampling rate). I think I read about it in a man page on audio. I just looked at some .au files in java's distribution. They all start with the header string ".snd ". The file does not have a header. It only has the speech samples.
    Stephen wrote:
    On my system at home, anyway, they're a little cagey about what the file format really is: DESCRIPTION Audio files contain a header that has a magic number (iden- tifying the file as an audio file) and fields that describe the encoding format used to store the audio data. Immedi- ately following the header is a variable-length information field in which, for instance, ASCII annotation may be stored. The Audio_hdr structure used by many of the libaudio rou- tines for describing audio data is not an exact duplicate of the audio file header. Several routines are provided to read and write file headers so that programs need not be concerned with the details of the exact file header struc- ture.
    Edward writes:
    ptplay appears to not exit when it runs out of audio data. It just keeps running, like the Duracell bunny.
    I noticed this behaviour on my RDI as well.

    Revamp of ptplay

    Features we would like
  • ptplay should be able to long sounds ptplay /usr/demo/SOUND/sounds/ should work. We should probably apply the same fix to the CGCSunSound star
  • The ability to play sounds on remote machines
  • Make it easier to play sounds via a web browser One way would be to just have html pages that have sounds in them, and then expect the user to have their mime-types file fixed properly
  • The output files produced by the SDF demos cannot be directly played with audiotool. It says Not an audio file.. soundtool will play the output, but it says that the file is not a valid audiofile, but it can be saved as one.
  • We should use whatever sound capabilities are present on the Ultrasparc. I believe that this is 16bit PCM.
  • It would be cool to write a cgc/dfm demo that could read sound files with a itcl browser and then play them.
  • Ultrasparc audio

    The Ultrasparc seems to use a cs4231 audio device: cxh@brahe 26% modinfo | grep audio 89 50b1a000 58ac 108 1 audiocs (CS4231 audio driver) 90 50c37558 21a6 - 1 diaudio (Generic Audio) cxh@brahe 27% cxh@brahe 27% ls -l /dev/audio /dev/sound/0 lrwxrwxrwx 1 root 12 Jan 2 11:26 /dev/audio -> /dev/sound/0 lrwxrwxrwx 1 root 57 Jan 2 11:26 /dev/sound/0 -> ../../devices/sbus@1f,0/SUNW,CS4231@d,c000000:sound,audio cxh@brahe 28% Useful man pages:
  • audioamd - telephone quality audio device
  • audiocs.7d - Crystal Semiconductor 4231 audio Interface
  • dbri - ISDN and audio interface
  • sbpro - Sound Blaster Pro, Sound Blaster 16, and Sound Blaster AWE32 audio device driver
  • audio(7) describes the generic audio interface. One trick would be to write code to access the audio device with ioctls and then print out the results
  • cdio - CD-ROM control operations
  • The man pages in /usr/demo/SOUND/man are worth looking over. There is a man page for the audiofile format there.

  • cxh at eecs