11

I want to make a homebrew 8-bit computer and I want to include a sound chip in it. It needs to be as cheap as possible (under 5$) and I also want it to be possibly controlled by an Arduino or ATmega-based microcontrollers for some testing and other projects.

Here are the minimum specifications I need:

  • at least 2 voices independently programmable
  • can produce square waves, triangle waves, sawtooth, and noise
  • an ADSR envelope (optional)

Something really cool would be putting a SID chip in there, but it is too expensive for me. I could also use a YM3812 chip, but I would want to use something even cheaper to further reduce cost.

It may not be in the first revision of my computer but I would want to take all the circuitry needed for the sounds and put them in a separated sound card that would plug in a socket of the motherboard.

16
  • 4
    There aren't any low-cost sound chips any more, I guess. Today, low cost sound is done through PWM output – any $1 µC has those. (Even the Raspberry Pi's sound output is simply a PWM output.)
    – Janka
    Commented Jul 28, 2019 at 0:01
  • 2
    If you want to go fully retro, you could utilize EPROMs and counters as wavetable and envelope generator.
    – Janka
    Commented Jul 28, 2019 at 0:06
  • 4
    Also see en.wikipedia.org/wiki/List_of_sound_chips
    – Janka
    Commented Jul 28, 2019 at 0:10
  • 6
    "it needs to be as cheap as possible" - You must be more clear on this, what did you really mean? How much is acceptable? In electronics, there's often no lower limit on the price, a chip of similar functionality can cost either 0.2 USD or 20 USD, depends on the supply/demand, how many specialized features you need, and how good/bad you want it to be. For personal projects, 2 USD is low-cost but for mass production, low-cost means 0.2 USD. I recently purchased 3 old Yamaha YM2608, a very powerful FM synthesizer chip of the early 90s, and it only costed me 1.5 USD. Commented Jul 28, 2019 at 8:18
  • 2
    I'm not certain that this is a good question for the site. I'm thinking off-topic and shopping recommendation. (I'm not certain that it isn't a good question, either, so I'm not hammering it.)
    – wizzwizz4
    Commented Jul 28, 2019 at 13:28

7 Answers 7

17

May I recommend the TI SN76489, then? 3 channels + noise, clocked from a 4 MHz input. Small, cheap. Sounds like chiptunes. Simple to program. Easy to get surplus.

Only drawbacks:

  • it powers on producing a loud continuous tone. You need logic at startup to tell it to make some other noise, or preferably no noise at all. Hence the BBC Micro's two-tone startup sound: the first tone is the SN76489's startup sound, the second is the Beeb's generated beep to shut it up.

  • square wave only. Might be a dealbreaker.

3
  • 1
    A clone of the SN is used in the Sega Master System, if the original poster would like to get a sense of what people could do with it once memory was no longer the overwhelming constraint. Sonic 2 does particularly well.
    – Tommy
    Commented Jul 28, 2019 at 16:13
  • Yup. It's also used in countless low-cost slot machines.
    – scruss
    Commented Jul 28, 2019 at 16:37
  • Technically, the Beeb doesn't need to generate its own beep to "shut up" the SN76489 on startup, just clear the chip's contents. The second beep is generated much later at the end of the boot sequence. When using a second processor, the second beep isn't generated at all (because it's not included in the Tube OS).
    – Kaz
    Commented Jul 30, 2019 at 7:14
14

If you're comfortable with programming microcontrollers already, I suggest you just use another microcontroller and adapt its output to be an audio signal.

  • You can use a DSP-type with an audio output (Microchip dsPIC has stereo audio out off the top of my head, your favourite brand may have their own) if you want potential stereo, fine grained control with sampled waveforms (like an Amiga's tracker-style playback), or any kind of simple algorithmic waveform you want (give yourself two squares, two pulses, two triangles in software and there you go).
  • You could use a very basic MCU with just GPIOs and have a n-channel square wave output (without volume control) with a basic resistor summer. (The Ocelot Arcade System is a dsPIC33 design that creates its four channel square audio output with just spare gpios used in this manner)
  • If you're good with analogue electronics you could improve the previous option by using your super basic sound MCU to mastermind a small analogue section with 555 timers, caps, opamps, etc, to ultimately produce a sophisticated 'synth card' with different primitive waveform channels mixed together, all abstracted behind the sound MCU's basic interface you design.

The advantages of using a microcontroller in this way:

  • very very low cost (you could get basically anything you want for 25c thereabouts, much cheaper than any surplus chip, as requested in your question)
  • high availability - a contemporary chip will have many suppliers and reliable stock as compared to surplus as-and-when availability, and you can get it at the same time as the rest of your components
  • a variety of form factors and packages (surface mount or dip, instead of restricted to dip)
  • a higher likelihood of being voltage compatible with your main microcontroller (old sound chips are 5V usually, a modern MCU is likely 3.3V)
  • potentially higher resilience and forgiveness - using a rare SID is nice, but I'd be a lot more comfortable throwing around easily replaceable 2019-tech microcontrollers in experimental circuits. Old ASIC chips can self destruct under normal conditions from their own heat; I believe I've read guides for C64 buffs that recommend you ought to apply heat sinks to them etc.
  • easier assimilatability into your design - you can use a spi channel to communicate asynchronously easily, instead of the old-style parallel access with many register writes and obtuse 'knock' combinations to push data into your sound chip byte by byte.
  • a fun project programming the mixer/behaviour of the sound MCU yourself :) (or you can use someone else's firmware as if it were a reprogrammable dedicated sound chip. Now you would have the same experience as programming a sound chip except you'd be using whatever physical and software interface this sound firmware author provided for you)

As a compromise, you may be surprised to find that there are sound firmwares for certain MCUs that specifically emulate the capabilities, signature sound and (as much as practically possible) physical interface of specific old sound chips. A 28 pin MCU with lots of IO pins can be very close to a SID, FM or PSG style chip in both form and use if you want it to be.

Also see this similar question on EE stack https://electronics.stackexchange.com/questions/98003/where-have-the-8-bit-sound-chips-gone

In that question, the asker mentions using a modern Parallax Propellor MCU to provide SID, FM or PSG sound in their project.

7
  • 2
    Yes, probably the cheapest current route is to use a µc. See for instance 4-channel polyphony from an ATTiny85: Tiny Synth
    – scruss
    Commented Jul 28, 2019 at 15:28
  • I thought using a microcontroller but I would like to have something easier to make complex waveforms such as noise... Do you have any idea to do this?
    – Spyro 999
    Commented Jul 28, 2019 at 17:28
  • The 'synth card' idea could make analogue or digital noise as one of its programmable sections.An audio DSP MCU like the dsPIC would be able to generate PRNG noise and mix it into its output analogue pins. The SN PSG used in the Master System has a well analysed noise output using shifts and a configurable period which gives each value a distinct timbre (of noise) if I recall. This would be easy to program into the sound core of an MCU with an analogue output.
    – Kobolter
    Commented Jul 28, 2019 at 21:51
  • smspower.org/Development/… The SN algorithms are detailed here. - Naturally, a program that emulates the system would have to emulate the behaviour of the sound chips, so these algorithms are of interest. :p
    – Kobolter
    Commented Jul 28, 2019 at 21:53
  • It's worth noting that many 1980s arcade machines including Defender, Joust, Robotron, and countless pinball machines, all used sound hardware consisting of a 6802 (not a 6502, and not a 68000) microprocessor, 256 bytes of ROM, a peripheral interface chip, and a DAC. So pretty much like using a microcontroller to generate sound, except spread out over six chips rather than one. Definitely a period-appropriate architecture (since it debuted in the early 1980s).
    – supercat
    Commented Jul 29, 2019 at 15:11
11

AY-3-8910

https://en.wikipedia.org/wiki/General_Instrument_AY-3-8910

http://www.vgmpf.com/Wiki/index.php/AY-3-8910

Pretty popular chip used in arcade machines and home computers. eBay has clones for quite cheap.

Yamaha YM3812 (OPL2)

https://en.wikipedia.org/wiki/Yamaha_YM3812

http://www.vgmpf.com/Wiki/index.php?title=YM3812

Used in home computer sound cards in the late 90s. eBay has many chips still floating around for cheap.

3
  • 2
    I have bought many AY-3-8910 chips from various eBay sellers for as little as $1 each, all were 'pulls' and all worked perfectly. I have a YM3812 but I haven't used it yet. It needs a YM3014 DAC to convert the output to analog. Commented Jul 28, 2019 at 19:46
  • 2
    The other advantage to the AY-3-8910 is you can actually get brand new ones. There are still clones that are in current manufacture. Last time I looked into it, I was able to confirm that at bare minimum one of these three clones (Winbond WF19054, JFC 95101 and the File KC89C72) was still in active manufacture (don't recall which one) and available in large quantities for very cheap.
    – mnem
    Commented Jul 31, 2019 at 0:31
  • AY8912 have a lot of SW written already as it was the sound chip for ZX128 and clones(google Melodik) ... I do not remember exactly what was the difference between it and AY8910 but IIRC it was just a missing IO port which has nothing to do with sound ...
    – Spektre
    Commented Oct 29, 2019 at 4:23
7

There is a project called SwinSID that uses an ATMega to replicate the original C64 SID chip here: SwinSID based on ATMEGA88.

You could conceivably use an ATMega with the firmware developed by this project to get what you are looking for. I've no idea if this solution is like is using a bazooka to shoot a fly, or what the cost looks like, but at a minimum you might get some ideas from the project.

2
  • SwinSID are typically around €40 shipped
    – scruss
    Commented Jul 28, 2019 at 15:09
  • 1
    @Scruss, thanks for that info. I was thinking more along the lines of the OP just buying the ATMega88 and integrating it directly into his architecture, and maybe using an adapted version of the SwinSID firmware.
    – Geo...
    Commented Jul 28, 2019 at 15:32
3

Sounds like a job for SAA1099P. It is a 6 channel square wave tone genrator with stereo output. Each channel has volume control and it includes two envelope generators and two noise channels. While it directly does not support triagle and sawtooth waveforms, the envelope generator has these waveforms so low frequency basses are available as triangle and sawtooth.

4
2

I have a lateral thinking answer which may be of greater interest if you have the equipment:

Instead of using a sound chip, connect your project to a MIDI instrument through a MIDI-compatible serial connection.

Information about the physical specifications of MIDI can be found here. http://www.personal.kent.edu/~sbirch/Music_Production/MP-II/MIDI/midi_physical_layer.htm

Seems like the MCUs UART and a buffer and a resistor or two is all it'll take to make your system a compliant MIDI message source.

'A MIDI instrument' can be anything here that takes in a MIDI signal, like a sampler or a PCs game port.

1

I can't think of anything that would directly match your requirements other than using another uC programmed to act as if it's a soundchip.

SID... has the waveforms, at least most of them, but doesn't have the envelopes, and probably too expensive these days

AY3 / YM2149 ... has the envelope (of a sort), but only squares and noise

SN7 is essentially the same thing just with certain subtle differences, none of which are relevant, other than the loss of the envelope.

Nintendo chips are themselves also CPUs, so a bit beyond the scope.

Various Yamaha FM chips come close, particularly the OPL3 may offer a wide enough range of timbres to more or less cover your requirements - or the simpler OPL2 or OPLL may yet be flexible enough to displace that requirement; alternatively the OPN series combine an AY3 core with various levels of vaguely OPL-ish FM and/or (AD)PCM (the latter needs a source of sample data of course) which can cover a lot of the bases, and built-in ADSR is a given for all of the FM engines (albeit only programmable for a single voice with the OPLL). Again, the issue is availability and cost. I wouldn't even want to guess how much any one chip may set you back.

About the closest direct hit is the Atari POKEY, it may not have those exact waveforms but it has a variety of interesting algorithmic ones which are probably fairly close. Though admittedly IDK if it does hardware enveloping so it may still be worse than the SID, and it's probably no cheaper.

If all you want is some bloops with at least 2-channel polyphony, I'd suggest looking for an AY3 or its Yamaha clone (especially, if you don't need the IO ports, the cut-down later models, as those are rather more compact and thus more suitable for a dinky microcontroller project, plus probably less sought after/collectable overall), or the Texas Instruments soundalike as featured in the BBC Micro, Mockingbird PC board, cloned in the various Sega VDPs etc, which is even smaller and probably cheaper even as NOS. You can get some reasonable sound out of them, as demonstrated by the systems they were installed in (the SN often doing about as well as the AY/YM because it has a few nonobvious advantages that compensate for e.g. lack of hardware envelope), and if you figure you can knock together a replayer routine for your chosen controller there's an absolutely humongous library of ready-to-run music capture dumps out there waiting to be plundered. The cleverer ones for the AY include stuff like SIDvoice, syncbuzzer, digidrum, even samples, etc which make use of the envelope, or note retriggering, so on and so forth to e.g. emulate the SID triangle/saw waves, make a fair stab at a sine, adjust the duty cycle of the squarewave into something more like a Nintendo pulsewave, create a reasonable set of 303 drums using square-noise combos... and use volume control abusing sample replay to emulate everything else. Potentially computationally expensive, but at the end of the day all the replayer really has to do is decompress the packed file on the fly (if it's not been pre-unpacked) and then fling the data contained within at the relevant registers in accordance with the internal timestamps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .