Home‎ > ‎RetroChallenge 4/2017‎ > ‎

Demo Video, Sound effects

posted Jan 14, 2016, 11:10 AM by Brett Gordon

YouTube Video


I started work on sound effects.  I figure some basic white noise pumped into the DAC should be in order.  To get the random white noise values, I just reuse a Linear Shift Register I use for randomizing the terrain and placement of opponents.  If we modify how fast we're sending our noise samples to the DAC, then we control the pitch of the noise (nyquist's freq).  And if we rotate bits right we can control the amplitude of the noise.  The volume level on the CoCo's 6 bit DAC can be adjusted to 64 levels, of course, but human hearing is logarithmic, so a simple 0 to 5 bit right-shift of DAC data works just fine.

foreach sample{
    while(  len-- ){
        get random no from LSR
        while( freq-- );        
        shift sample by volume
        send to DAC
    }
}

So if we point this pseudo-code at a table of sound data, we get a frequency/volume/length control over a white noise signal.  For a explosion we do a loud short high frequency noise, then drop it off fast to longer quieter low frequency noise.  The results are in the video.


Comments