First, I'm assuming that the speakers you show have their own power and amplification, so that throughout your schematic we're dealing with low-level audio signals, right? Ie: you're not hoping that the PC output will drive raw speakers?
Assuming this is correct, your schematic looks like it does what you describe, but here's a thought. As you have it wired, you are committed to using only the speakers or the headphones, but not both at once. You couldn't listen to the ipod on the headphones while the PC sends its sound to the speakers, for example.
Instead, consider wiring up two parallel "copies" of SW1, where the output of one of the "SW1"s is wired direct to the speakers (possibly through a jack) and the other "SW1" has its output direct to the headphones. Essentially these SW1s function as input selectors for the speakers and headphones respectively. It won't be a problem if both select to listen to the PC, or both the ipod.
As for driving LEDs off the audio signal, this will not be satisfactory. An LED needs at least 1.4 to 2V to illuminate, which your audio will be below much of the time. In addition, when lit the LED will draw more current than the low level audio signal can provide (without distorting the signal a lot).
You might consider replacing the DPDT switches with DP-3-throw switches, and use the extra throw to control LEDs. You could conveniently get power from the computer USB jack. Use 150 to 300 ohm resistor in series with the LED to operate off 5V -- adjust to suit your taste for brightness.
YM2612
This chip was designed to be used as a peripheral to 8 bit CPUs running at a handful of MHz. When you look at the "datasheet" (just a pinout, really), you'll find that there are three groups of pins you have to care about:
- D0 to D7
- Control pins (CS, WR, RD, A0, A1)
- IRQ
The data bus is bi-directional, the control pins are input-only, and the IRQ is output-only. It is obvious that this chip was originally designed to be mapped into the address range of an 8-bit CPU, but none of the devices you have on your list can do that (to my knowledge).
What you need
There are two features you want on your board that will make your life easier, and this rules out a few of them:
- 5 V I/O so you can hook the board up directly to the chip, without having to bother with level-conversion.
- At least one complete 8 bit bi-directional port so you can write values directly without having to split your data up and write it several times.
- 6 more pins for the control signals
This rules out the Raspberry Pi, the Arduino Nano, and some of the Teensy boards, and leaves the Arduino Uno, PIC, and some older Teensy.
I would consider these three more or less equivalently suited for your purpose. The latency problem you hinted is likely a newbie mistake, trying to use some software-delays in the Arduino. That just won't work for these things, you need a stable hardware timer to synchronize every write. You can do this with the integrated Arduino IDE.
Suggestion
Considering that you already have a PIC, and you seem to know how to program it in assembly (even if you're not yet comfortable doing so), I would suggest that this is your best option for a number of reasons:
- Nothing is stopping you from programming most of it in C using MPLAB X, perhaps using a mix of assembly routines where you think it's required.
- It has the requisite timers and interrupt mechanisms.
- You already have one.
- Depending on the PIC, you may be able to use its internal FOSC/4 clock output as your 8 MHz clock.
Best Answer
The polarity of the audio coupling capacitor C4 is backwards which causes a DC unbalance and the amplifier amplifies it. Two of the many coupling capacitors in the Mega Amp mod circuit are also backwards.
The audio gain is 240k/6.2k= 39 times which is crazy since the audio input to C4 is probably at least almost 2.8V peak to peak.