[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sound question



On 18 Jan 2002 23:57:49 GMT, mjmahon@aol.com (Michael J. Mahon) wrote:

>I can't help but wonder what the sample size/RAM size was for a
>30 minute load time!  A Hi-speed SCSI card can DMA data at a
>good fraction of a megabyte per second, and a IIgs can't handle
>more than 8MB, so how could loading up memory possibly take
>more than 10-30 seconds?
>
>If you were talking about loading from floppies, then I understand--
>but certainly no one considering playing extended sound samples
>would use less than a hard disk.  Storage capacity alone would
>make the decision.

It was an 8 bit, 22.050KHz, stereo sample that was about 1 MB in size
I believe.  :)

The problem is that I wrote it as a quick hack in GSoft BASIC and
stereo WAV files store the left and right channel samples alternately
in the file.  This means that when I loaded the file, I had to take
the first byte and put it in the left channel buffer and the second
byte and put it in the right channel buffer and so on until the file
was loaded.  Then I just did two FFStartSound calls, one for each
buffer and didn't worry about the slight delay between starting the
left and right channels.  I just took a look at the source code again
and I even unrolled my load loop to speed things up a bit.  This means
I put the two lines of code that put the sample data into the left and
right channels and copied it into the program 25 times so that the
program only has to iterate the loop for every 50 samples.

GSoft BASIC is an interpreted language so if I were to convert the
program to assembly and/or come up with a better method of loading the
data into memory, I'm sure I could speed things up.

>I appreciate the info that "Oversampler" (I didn't recall its name)
>only plays mono, but 22.050KHz 8-bit mono sounds pretty good
>to most people.  And if it's the program I'm thinking about, it plays
>while reading from disk, so memory size is not a limiter.
>
>For that matter, if AM radio fidelity doesn't bother you too much,
>then you can go to 11.025KHz and cut the music files in half.
>(BTW, any downsampling should be preceeded by digital filtering
>to eliminate distortions from aliased high frequencies.)

Yes, Oversampler can play from a fast hard disk and, as its name
implies, can play back at 2x or 4x oversampling to improve the quality
of the playback.

The confusion about whether it could play stereo files was because the
program has an Output option that defaults to "Stereo" but this is
just an option that he added for people who own stereo cards.  This
option gives the user the choice to play the sample through both
channels, the left channel, the right channel or to tell the program
that the machine doesn't have a stereo card installed.  With the first
three options, using the volume control in Oversampler changed the
volume of the oscillators but with the fourth option, the volue
control changed the system volume.  I'm not sure why he did it that
way but he did.  :)

To play stereo WAV files successfully with Oversampler, you had to
double the frequency because you were playing both channels and in
effect were converting the sound to mono when playing it back.

--
 Jeff Blakeney - Dean of the Apple II Unversity on A2Central.com
               - CUT the obvious from my address to e-mail me