[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Moving binary files to /RAM
Simon Williams wrote:
The underlying problem I've been trying to get around is the audible
click at the start and end of DAC522 playback. In my original TIMELORD
program I had short percussion samples playing alternately with a delay
loop to control tempo. Typically, a sequence would "look" like this:
. . . . . . . .
||| | ||| | ||| | ||| |
|||||::..| |||||::..| |||||::..| |||||::..|
<-audio--><-delay->
...as you can see, the initial "click" is masked quite well by the fast
attack of the audio, however the final click occurs after the sound has
decayed and is quite pronounced. If the delay length is proportionally
different from the sample length this can result in an out-of-synch
effect, which is a bit annoying.
I understand exactly.
The reason for the audible pop is that most samples are centered around
midscale ($80). A solution you can investigate is ramping the
"center" value of a sample stream down to $00 as its amplitude drops.
The ramp should not be too fast, or it will be audible as well. It is
very helpful if there is still an audio signal to mask the ramping of
the average value to $00.
There will still be some "pop", since zero does not correspond to a
zero duty cycle, but the amplitude will be much reduced.
You've got me thinking about a version of DAC522 that _does_ use a
zero duty cycle for $00 samples... And a preprocessor that ramps the
average level up at the start and down at the end, to eliminate the
pop problem. Hmmm...
Originally, I was planning to use much longer samples to avoid having
the delay loop, so that the final click of playback would be masked by
the attack of the next note, thus:
. .. .. .. .
||| |||| |||| |||| |
|||||::...........||||||::...........||||||::...........||||||::......|
Eventually it dawned on me that, in Apple II terms, the "useful" part of
any percussion sample occurs within the first 2K of the file, so it
would be just as effective to use 2K samples and have them load ahead of
a 2K (or larger) "buffer" of zero-bytes, so that DAC can play a 4K file,
but the program only has to move 2K from AUXMEM.
This approach should work fine, where the number of fill bytes played
is sufficient to create the delay time between sounds (minus a little
to set things up). The fill bytes should typically be the same as the
average sample ($80) to avoid a pop at the transition.
Of course this "solution" is only effective for percussion sounds which
typically have a very short attack and little or no sustain. It might
also be possible to add a faux reverb after the sample rather than just
silence.
This is also possible, but will typically require some time to
generate...
Programming is a lot easier when you actually know what your program is
supposed to do ;-)
Hear, hear! ;-)
-michael
New Applesoft BASIC interface for NadaNet networking!
Home page: http://members.aol.com/MJMahon/