[Coco] 1bit hsync nasties....
Steve
6809er at srbsoftware.com
Thu Jan 23 20:11:27 EST 2014
Simon ,
Well, you are really down two octaves then. One from changing the code
to use to use every other H-sync and the other from an error thinking
that Octave 5 Note B was 493.883 Hz, when it's really octave 4 Note B.
So the top end is only Octave 3 Note B. Not much of an octave range for
playing music.
If the code is still taking 75 out of 114 clock cycles (two H-syncs),
then the leftover CPU time for real work is only 34.2% or only about 1/3
of the CPU. Still too costly in a Video Game and why it was rarely used
(if ever) back in the day.
Since you are taking more then one H-sync, why does you try the
summation trick to put the notes in perfect key? It code something like
this...
Sum ldd #000 ;Sum store in this code
freq addd #0 ;store the sub added for the freq here
std >Sum+1 ;save sum back for then pass
bnc Skipflip ;skip if over carry over
lda $ff20 ;flip the sound DAC
xor #$80
sta $ff20
SkipFlip
For the Note C in octave 3 (130.813 Hz), you use the following math for
the number to add to the sum...
65536 / (7875 / note / 2) for this note, 65536 / (7875/130.83 /2) for
a freq(adder)=2177.
What does all this do?
This lets our timing loop be 30.10 units long. About 10% of the time,
the normal delay of 30 units will be extended by one to make up for the
off timing. The best part is there no reloading of the count down
timer. You just keep adding till you get an carry to show its time to
flip the Audio DAC.
But my real problem is how it sounds. It's just a bunch low beeps or
playing the scale. How about a real song? Maybe it will sound better
to this old Sound engineer if it plays a familiar tune.
The other problem with the sound is all distortion in the waveform.
See: http://www.coco4.com/images/7875waveform.jpg
You will note of the waveform distortions at each transition and how it
create harmonics and a real pain to these ears. Try fliping the DCA
with $80 or $90 in place of $F0. This should remove some of the
problems in the transitions. Remember there is capacitor tied to the
output of the DAC and it does not take Kindly to big swings on the out.
It good to see you trying to push things along. But remember, us old
time CoCo programmers have tried many of these roads before and found
that some of them were dead ends. So, if one does not work out then
there are other roads to travel.
Steve
On 1/23/2014 1:58 PM, Simon Jonassen wrote:
> Hey guys !
>
> was contemplating if i should share todays 8 bit madness or not....
>
> well, here goes:
>
> the hsync music players irq has been refactored to intentionally use 58+
> cycles every pass (no best/worst case scenario anymore), so that means it
> skips an hsync so the irq fequency is now 15750/2 (7875Hz)
>
> yes the music player loses 1 octave, but we now have about 40% free cpu time
> to do other stuff.....
>
> this is a playback of the new irq routine:
>
> http://www.roust-it.dk/coco/sock/7875hz.wav
>
> if you have trouble loading this, it's because my DSL line is sick at the
> moment.... getting it serviced tomorrow.....
>
> /Simon :-)
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list