[futurebasic] Re: [FB] [X-FB] AIFF (was: Recording sounds from tape)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Mon, 11 Oct 1999 19:58:16 -0500
Thanks to everyone who's been responding to this thread.  My G3 has a mic jack
that accepts either the "long" microphone plug or a standard stereo miniplug,
and thanks to your suggestions, I now get perfectly acceptable (for my low
standards!) sound when I patch directly from the stereo headphone jack of the
cassette player to the Mac's input jack.

But now I have a different problem.  I want to put these sounds onto an audio
CD.  Adaptec's "Toast" is able to convert AIFF sound files into CD tracks--but
the sound files must be sampled at 44.1kHz with a 16-bit sample size.

I looked for shareware/freeware programs that will record sounds at these
parameters, and found a few that _almost_ do it, but none quite make it.  (One
program will record 44.1kHz/16bit, but only to RAM.  Another will record to
disk, but no faster than 22.3kHz.  Another will record 44.1kHz to disk, but
can only be triggered by that damn VOX thing.)

So I decided to dive into the Sound Input Manager and write my own.  And I've
gotten 99% of it to work.  I can record raw sound data to disk at the right
rate, with the right sample size, and in stereo.  There's just one little
problem:  I can't seem to create the AIFF file header.

The Toolbox function SetupAIFFHeader looks pretty straightforward, but I
absolutely can't seem to call it without getting an error back.

So here's a coding challenge!  I challenge anyone to write an FB program that
will (by calling SetupAIFFHeader) write an AIFF header to a file.  Use any
parameters that you can get to work.  The program needn't write anything else
at all to the file, nor do any actual sound recording.  You may either use the
version of FN SetupAIFFHeader provided below, or create your own.  Hopefully,
by examing the differences between your (working) code and mine, I can see
what I'm doing wrong.

Thanks in advance for any help.
- Rick

'--------------------------------------------------------
LOCAL FN SetupAIFFHeader(fRefNum%, numChannels%, sampleRate&, sampleSize%,
compressionType&, numBytes&, numFrames&)
  DIM OSErr
  `     clr.w   -(sp)
  `     move.w  -(sp),^fRefNum%
  `     move.w  -(sp),^numChannels%
  `     move.l  -(sp),^sampleRate&
  `     move.w  -(sp),^sampleSize%
  `     move.l  -(sp),^compressionType&
  `     move.l  -(sp),^numBytes&
  `     move.l  -(sp),^numFrames&
  `     move.l  #$0B4C0014,D0
  `     dc.w    $A800
  `     move.w  (sp)+,^OSErr
END FN = OSErr
'--------------------------------------------------------