[Coco] Assembly audio routines
Bill Pierce
ooogalapasooo at aol.com
Mon Mar 20 23:45:50 EDT 2017
Ed, I thought it shifted 2 bits, but it actually shifts 1 bit. Here's the loop:
init00 leax 5,u * Set pointer past the BASIC 5 byte M/L header
init01 ldd ,x * this is to normalize waveform volumes to 6-bit
lsra * for the DAC... bypass for Orch90 & SS Pak
lsrb
std ,x++
cmpx #$0403
ble init01
This is done to the original saved bytes from a Musica II file. The loop scans each byte in the complete song. It passes through all 4 voices. The shift is done before the 4 voices are mixed. The Orch90/Stereo Pak option skips this routine. The loop is actually shifting 2 bytes at a time by using D reg.
I think more than anything this just normalizes the samples so they don't clip.
This is from the OS9 L2 "PlayMus", which plays RSDOS Musica II files under OS9 L2.
Bill Pierce
"Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull
My Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Co-Contributor, Co-Editor for CocoPedia
http://www.cocopedia.com/wiki/index.php/Main_Page
Global Moderator for TRS-80/Tandy Color Computer Forums
http://www.tandycoco.com/forum/
E-Mail: ooogalapasooo at aol.com
-----Original Message-----
From: Zippster <zippster278 at gmail.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Mon, Mar 20, 2017 10:05 pm
Subject: Re: [Coco] Assembly audio routines
Bill,Arithmetic shift or logical? That still seems weird to me, but then again, I have no ideawhat data they are starting with. Got a link to the source code? Might be interestingto read through.- Ed> On Mar 20, 2017, at 7:42 PM, Bill Pierce via Coco <coco at maltedmedia.com> wrote:> > Maybe the software is shifting to the right then. I'll have to look. It's been a bit since I dug into the Musica source, which I know does a shift on every 8 bit value after generating the samples from an 8bit freaquency table. I do know that if you comment out that shift loop, the sound is a little grainier. If I comment it out and route to the orch90, it's clean.> The only reason Musica preserves the 8 bit values in the file and only does the shift loop before play is that Musica supported the "Speech Systems Stereo Pak" which was like the orch90 (8 bit stereo DACs) but without the rom. When the Stereo pak is selected as output, the shift is skipped, leaving the 8 bit values intact.> > I just checked the source and it does shift 2 bits to the right. So you guys are right. The comments state it's shifted to "normalize" the byte for the 6 bit DAC.> > > Bill Pierce> "Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull-- Coco mailing listCoco at maltedmedia.comhttps://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list