[comp.sys.apple] Reply to: Using sound files on Info

krb20699@uxa.cso.uiuc.edu (12/25/89)

Written by Bruce_Kahn@DGC.MCEO.DG.COM in comp.sys.apple

>CEO comments:
>From: Bruce Kahn:VOID
>Date: ## 12/21/89 12:55 ##
>  Mac sound files can only be played by a program that can read them 
>such as PlaySound or MacCD (both of which are on 
>Sumex-Aim.Stanford.Edu in the archives some place).  If you use Apple 
>File Exchange, you can 'port' sound files back and forth between 
>Apple II's and Mac's.  I believe that if the sound contains an 
>80H (hex) on the Mac, you need to change it to a 00H on the Apple 
>II.  Otherwise the sound will be garbage.

[...clip...]

>                                   Bruce (KAHN@ADAM.DG.COM)

     I don't think changing $80 to $00 is a solution.  A $00 byte in sound
files is what makes Mac sounds distort on the IIgs.  To convert sound files
I change all instances of $00 to $01.  This eliminates the distortion while
only changing the pitch at these points by 1/256th.  Mac and II sounds are
identical except for the lack of 'support' of $00 by the IIgs.  I'm not
sure why the Ensoniq chip doesn't like it, but I heard someone explain why
awhile back...something about cancelling all previous sound or the like.

InterNet  ->   krb20699@uxa.cso.uiuc.edu      |                 Ken Brownfield
=---------------------------------------------+         Rural Route 4, Box 152
PLATO     ->   ken brownfield/unialum/cerl    |           Champaign, IL, 61820
          ->   brownfield/dialup/cerl         |(home)           (217) 643-7504
=---------------------------------------------+------------------------------=

brianw@microsoft.UUCP (Brian WILLOUGHBY) (12/30/89)

In article <113300233@uxa.cso.uiuc.edu> krb20699@uxa.cso.uiuc.edu writes:
>     I don't think changing $80 to $00 is a solution.  A $00 byte in sound
>files is what makes Mac sounds distort on the IIgs.  To convert sound files
>I change all instances of $00 to $01.  This eliminates the distortion while
>only changing the pitch at these points by 1/256th.  Mac and II sounds are
>identical except for the lack of 'support' of $00 by the IIgs.  I'm not
>sure why the Ensoniq chip doesn't like it, but I heard someone explain why
>awhile back...something about cancelling all previous sound or the like.
>
>Ken Brownfield

Huh?  A sample point can't have pitch.  Pitch is the rate of repetition of a
pattern, whether it is a pattern of speaker motion, a pattern of changing air
pressure or a pattern of digital sample values.  You can't have a pattern with
only one byte.  That would be silence.

Oh well, you're right that it only distorts the zero points by a small amount.
To explain the effect of a $00 byte, Ensoniq uses that to indicate the end of
a sample.  It can't cancel any previous sound that you've already heard (what,
by going back in time?), but it does stop the current sample being played.
Since you have 16 voices (32 samples) with the Ensoniq DOC, a $00 byte does not
stop ALL sound.

On a side note, some computers that support sampling use signed Analog to
Digital converters and some use unsigned.  When converting sounds from other
computers, you might have to take this into account.

I transferred a few Amiga 1000 samples over to my Apple ][ Plus, and they
sounded horrible, but not totally random.  It turns out that graphing these
samples to the screen showed how the Amiga treats $00 as a true middle value,
with $01-$7F as positive values and $80-$FF and negative values, $80 being the
lowest extreme and $7F being the upper extreme.  The sampling card that I built
for my Plus used $00-$FF as a positive range, where $80 happened to fall in the
middle.  What I needed to do was ADD $80 to every Amiga sample byte.  Since the
overflow is lost  on 8 bit data, adding $80 is the same as flipping the highest
bit, so just EOR #$80 for every byte to convert Amiga samples.

I hope this info is useful to any of you who also have access to Amiga sound
files.  I don't have a GS or a Mac, but I understand how the Ensoniq DOC works
and I assume that the above process would be compatible.

Brian Willoughby
UUCP:           ...!{tikal, sun, uunet, elwood}!microsoft!brianw
InterNet:       microsoft!brianw@uunet.UU.NET
  or:           microsoft!brianw@Sun.COM
Bitnet          brianw@microsoft.UUCP