SoundX is an Open Hardware sound card for the Commodore 16, 116 and Plus/4 home computers based on the Yamaha OPL/OPL-II chip.
SoundX is basically an adaptation of the C64 SFX Sound Expander for the x264 series of Commodore computers.
While it didn't enjoy much success when it was released on the C64, since it was not that much superior to the built-in SID (if superior at all...), it would have certainly been much more successful if it had been targeted at the Commodore 16, 116 and Plus/4. In fact, it is basically the equivalent of an AdLib, an audio card for the PCs of the time, based on the YM3526 chip from Yamaha (also known as OPL), which is exponentially better than the TED as a sound chip, as it sports the following features (thanks Wikipedia):
- 9 channels of sound, each made of two oscillators or 6 channels with 5 percussion instruments
For the whole channel:
- Main frequency (10 bits)
- Octave (3 bits)
- Note on/off
- Synthesis mode (FM or just additive)
- Feedback (0–7, the modulator modulating itself)
For each one of the two oscillators:
- Frequency multiply (can be set to 1⁄2, 1 to 10, 12 or 15)
- Waveform (Sine)
- Volume (0–63, logarithmic)
- Attack, decay, sustain, release (4 bits each, logarithmic)
- Tremolo (on or off)
- Vibrato (on or off)
- Sustain (on or off)
- Envelope scaling per key (on or off)
- Volume scaling per key (0–3)
There are also a few parameters that can be set for the whole chip:
- Vibrato depth
- Tremolo depth
- Percussion mode (uses 3 channels to provide 5 percussion sounds)
- Composite sine mode (see Sinewave synthesis)
The board can even use the slightly more modern YM3812 (OPL-II): among its newly-added features is the ability to pick between four waveforms for each individual oscillator. In addition to the original sine wave, three modified waveforms can be produced: half-sine waves (where the negative part of the sine is muted), absolute-sine waves (where the negative part is inverted), and pseudo-sawtooth waves (quarter sine waves upward only with silent sections in between).
The original SFX Sound Expander could be bought together with a piano-like keyboard and some demo software. Such keyboard is not easy to find these days, so it was pointless to replicate the interface for it and I rather decided to build upon my experience with another project and add a real MIDI I/O interface. This means the C16/116/+4 will be able to receive data from a MIDI keyboard or to play it, through a standard DIN-5 MIDI interface.
This project makes sense because the YM3812 chip, its companion DAC (YM3014B) and a standard ACIA 6551 chip (for the MIDI part) can all be bought supercheap on AliExpress & similar sites, making this board very affordable to build for everyone. Let's say 15-20€? So get all this stuff second-hand and be happy :).
The audio output is automatically fed back into the computer through the EXT_AUDIO pin, so that you will hear it mixed with the sounds produced by the TED. There is also a 3.5" jack connector on the board, which allows bringing the sound output to external equipment. Note that when a jack is plugged in, the sound will no longer be redirected to the EXT_AUDIO pin.
Note that the OPL and MIDI circuits of the board are completely independent from each other, so the board can also be assembled partially if only one of the features is desired. The IBOM points out which feature every components belongs to.
Due to the impressive array of features, the OPL/OPL-II is not easy to program: the chip has 244 registers, so it would take a while to get acquainted with it and there is really not much documentation about how to program the SFX Sound Expander. This is one of the reasons why I decided to diverge a bit from the SFX Sound Expander on the programming side and rather followed the AdLib style: the board only uses two addresses for the audio part: $FDE4 and $FDE5. The former is for writing the number of the YM register to be modified while the latter is for the value. The former address can also be read and it will return the OPL status register, which is only useful for the detection of the board or if you want to make use of the OPL internal timers.
This means that you should be able to follow any AdLib programming tutorials around (like this one), as they should be 100% applicable to SoundX just as well (except for the different addresses, of course). The chip detection from that document also works!
If you want some code to start from, you can have a look at the Tech Demo that Master Csabo from the Plus/4 World Forum quickly hacked together: it does OPL detection and then plays a few songs from the original AdLib Card Demo. It comes with full source code, so it will definitely be helpful!
The MIDI section is handled through a classic ACIA (6551) chip, occupying addresses $FDE0/1/2/3 (I chose these addresses because they were already partly used by Solder's MIDI interface). Just set the Baud rate to 19200 bps, which will actually result in the standard 31250 bps MIDI Baud rate on the wire, due to the use of a non-standard crystal.
Csabo has also made a Simple MIDI Decoder utility that listens for NoteOn and NoteOff messages coming in through the MIDI port and plays the corresponding notes through the TED. Again, it comes with full source code and thus it should help you have a jump start.
Important
When programming the OPL chip, always keep in mind is that you must wait at least 3.3 microseconds after you wrote the address, before you write the data, and then at least 23 microseconds before the next write. This stands for AdLib sound cards as well, since it is an inherent limitation of the OPL chip. Nevertheless, some clever programming appears to be able to mitigate the issue.
Of course, to make complete sense, this project needs support from the actual programmers! So people, please make games for the board! Or programs, demos, whatever! I think a nice first step would be to port the original SFX Sounds Expander software: I can't say for sure, but I'm guessing this shouldn't be too much of an effort, plus I can help with the tech details and can explain how to make the MIDI decoder, just ask! :)
If you want to get this board produced, you are recommended to get the latest release rather than the current git version, as the latter might be under development and is not guaranteed to be working.
Every release is accompanied by its Bill Of Materials (BOM) file and any relevant notes about it, which you are recommended to read carefully.
The SoundX documentation, including the design itself, is copyright © SukkoPera 2023 and is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
This documentation is distributed as is and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES whatsoever with respect to its functionality, operability or use, including, without limitation, any implied warranties OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE or infringement. We expressly disclaim any liability whatsoever for any direct, indirect, consequential, incidental or special damages, including, without limitation, lost revenues, lost profits, losses resulting from business interruption or loss of data, regardless of the form of action or legal theory under which the liability may be asserted, even if advised of the possibility or likelihood of such damages.
If you want to get some boards manufactured, you can get them from PCBWay through this link:
You get my gratitude and cheap, professionally-made and good quality PCBs, I get some credit that will help with this and other projects. You won't even have to worry about the various PCB options, it's all pre-configured for you!
Also, if you still have to register, you can use this link to get some bonus initial credit (and yield me some more).
You can also buy me a coffee if you want, all the money collected this way will actually go to charity:
- Master Csabo and Chizman (unbeknownst) for their help with the testing software.
- kinmami for his usual precious hints about the hardware design.
- Iconian Fonts (Daniel Zadorozny) for the Universal Jack Font used for the logo.