[comp.sys.mac.programmer] Mac sounds to Sparc

dpawson@oracle.com (03/27/91)

Hey folks,
   Sorry - I'm sure this has been covered before, but I never was particularly
interested in the past.  Does anybody have any experience playing Mac sampled
sounds on a Sparc?  If so, please drop me a note telling me what I am missing.
I sampled at 7.4 khz on the Mac, then transferred to a Sparc using binary mode
ftp.  When I play back, my sounds are *very* loud, and while the true message
is barely audible in the background, it sounds remarkably like a vacuum 
cleaner.
      	       	     	      	       Thanks in advance,
      	       	     	      	       	     	Dave Pawson
      	       	     	      	       	     	dpawson@oracle.com

bruner@sp15.csrd.uiuc.edu (John Bruner) (03/27/91)

For some time I've been tempted to write a program to convert Mac 'snd '
resources into SPARC audio files.  However, I never seem to assemble
all of the necessary documentation (Mac + Sun) in one place at the
same time.

The Sun audio files are sampled at 8kHz and are stored in an encoded
format.  The Sun documentation refers to this as ISDN "mu-law"
encoding, which I'm sure is a standard encoding but to which I have no
reference.  According to the Sun audio_ulaw2linear(3) manual page "The
u-law transfer function results in a nearly linear relationship to PCM
[Pulse Code Modulated] at low amplitudes and a logarithmic
relationship at high amplitudes.  Another wrinkle is that the audio is
stored in one's complement sign-magnitude format on the Sun.

Sun's documentation indicates that the format of its audio files is a
subset of the format on the NeXT.  I've heard that there is a program
that converts Mac <-> NeXT audio formats, but I haven't tracked it
down yet.

If you just FTP'd the sound in binary, then the Sun "play" program
probably assumed some default format for the data, most likely 8-bit
mu-law encoding sampled at 8kHz.  I suspect this accounts for the
"vacuum cleaner" you're hearing.
--
John Bruner	Center for Supercomputing R&D, University of Illinois
	bruner@csrd.uiuc.edu		(217) 244-4476

russotto@eng.umd.edu (Matthew T. Russotto) (03/28/91)

In article <1991Mar27.015629.9536@oracle.com> dpawson@oracle.com () writes:
>Hey folks,
>   Sorry - I'm sure this has been covered before, but I never was particularly
>interested in the past.  Does anybody have any experience playing Mac sampled
>sounds on a Sparc?  If so, please drop me a note telling me what I am missing.
>I sampled at 7.4 khz on the Mac, then transferred to a Sparc using binary mode
>ftp.  When I play back, my sounds are *very* loud, and while the true message
>is barely audible in the background, it sounds remarkably like a vacuum 
>cleaner.

A guess:  Mac sounds are in 'offset binary'-- the position of the speaker
changes continuously as you move from 0 to 255.  Sparc sounds are probably
in two's complement, which would mean that the speaker position would change
continuously from 0 to 127, with a discontinuity at 128 (-128), and then move
continuously from 128 (-128) to 255 (-1).  Try subtracting 128 from each byte
in the mac file.
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
     .sig under construction, like the rest of this campus.

daveh@ccwf.cc.utexas.edu (David H. Huang) (03/28/91)

In article <BRUNER.91Mar27085814@sp15.csrd.uiuc.edu> bruner@sp15.csrd.uiuc.edu (John Bruner) writes:
>For some time I've been tempted to write a program to convert Mac 'snd '
>resources into SPARC audio files.  However, I never seem to assemble
>all of the necessary documentation (Mac + Sun) in one place at the
>same time.

There's already a program that you can run on the Sun end to convert
Mac format to Sun audio format. The source for mac2sun is available
for FTP from emx.utexas.edu in the /pub/mnt/source/sun/ss-audio
directory.

>--
>John Bruner	Center for Supercomputing R&D, University of Illinois
>	bruner@csrd.uiuc.edu		(217) 244-4476


-- 
David Huang                              |   "Calzoni Pizza:
Internet: daveh@ccwf.cc.utexas.edu       |       Delivery in six
UUCP: ..!ut-emx!ccwf.cc.utexas.edu!daveh |       hours, or else your
America Online: DrWho29                  |       pizza is cold."