Updated: 3 days ago
I now have the onboard SD Card (SPI for communication) working on my sound card. I ended up going without the hardware shift registers for SPI. I found the code was just so much simpler without messing with the shift registers, and performance is still great. I am bit banging the SPI communication from the onboard 65816 processor and one of the VIAs directly to the SD Card reader. Next up, I need get the bi-directional communication working between the host system and the sound card (see this post)... and continue my assembly work... and get some fresh music and some sound effects going.
I was getting some weird outputs when connecting to different devices' line inputs (e.g., PC, amplifier, sound mixer). As I reviewed my original output design, I realized I failed to pull the analog outputs of the PSGs down to ground. Also, the YM2149 PSGs have a DC offset in the analog output that I wasn't removing. I updated my output circuit to pull the analog outputs down to ground with a 330 ohm resistor on the left and right (combined) channels. I also added an inline 10μF capacitor to remove the positive DC bias. Below, the original design is shown on the left. The black boxes are resistor networks (bus). The updated design is on the right. The updated design is soooo much better. Now, I am getting nice levels with all of the devices where I'm pulling in the audio output of the sound card.
Also, I was running into an issue where I would notice the sound would change for the same music, such as when I was playing from the media ROM followed by playing from the media SD Card. Sometimes, I would hear differences in output on the exact same media from the same source -- just resetting the system between playback. I believe I have tracked it down to the left and right channels being slightly out of sync on their outputs. I caught this when I was adjusting volume on my mixer, one channel (left/right) at a time. As I was increasing the volume of a channel, the overall volume dropped.
If the left and right channels' waveforms are not in sync, they could be cancelling each other out -- like how noise cancelling works (and possibly, my music is noise 😎). This is likely caused by the delay between me setting the left channel PSG registers and then the right channel PSG registers. I will need to research how to best manage this, other than trying to get my "turn on" signals for the PSGs as close in time as possible.
In the recording below, I record just the left channel out of the sound card as a mono signal (and you'll hear the same signal on both left and right). This recording also has the updated output schematic, and I play the same audio as the previous video where I playback from core ROM, media ROM, and SD Card.