Off-the-shelf PSG

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Off-the-shelf PSG

Post by Pokun »

So I'm looking for some suitable sound chips that can be used in retro designs (like a retro computer/console/arcade system). I know about common ones like the AY-3-8910, SN76489 and a whole range of Yamaha chips. There's even the YM2608 which includes an internal YM2149F, FM synthesis and ADPCM stuff all in one chip. Though Yamaha chips often seems to require a specific DAC, which complicates things a bit.

FM synthesis, rectangle wave and white noise are very common in standard chips, but many of the features used in custom chips like triangle wave (like in NES and GB APUs), sawtooth wave (like in Konami VRC6 and Commodore's SID) and wavetable synthesis (like in Konami SCC, Famicom Disk System, Namco 163 and PC Engine's PSG) doesn't seem to be very common in off-the-shelf chips.

Are there no off-the-shelf chips that can do these? I rather not use custom stuff like the NES APU if I can help it.
Emulation is cheating but an FPGA implementation might be fine, even if it's not an implementation of a real existing chip.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Off-the-shelf PSG

Post by lidnariq »

In my admittedly limited experience, there aren't very many of note.

As far as I can tell, there's a few major groups:
* the two progenitors (General and Texas Instruments, AY-3-8910 and SN764*)
* Yamaha's subsequent hundreds of sound devices, PSG and OPL and sampling
* Dedicated parts inside musical instruments
* Built out of discrete logic
* integrated into other silicon (NES, PCE)
* A few things that weren't intended to be used for sound but sometimes are (e.g. PC speaker used in PWM mode)

... And that may be it? Following plogue / plgDavid (old blog) (twitter) might find something...
* e.g. misusing a speech synthesizer ICs into serving as a musical instrument.
User avatar
TmEE
Posts: 960
Joined: Wed Feb 13, 2008 9:10 am
Location: Norway (50 and 60Hz compatible :P)
Contact:

Re: Off-the-shelf PSG

Post by TmEE »

There are not many off the shelf sound chips, Lidanriq has pretty much nailed the options.

Sawtooth is very easy to do on a FM chip, requiring only two operators to produce the all harmonics ramp that sawtooth has. Squarewave is also easy with same method, only difference being multiplication factor of one of the operators and by adjusting level of the modulating operator you get free filter parameter letting you crush the waveform to basic sine if one needs or overmodulate and add distortion like effect.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Off-the-shelf PSG

Post by Pokun »

Thank you for your answers.

Yeah sawtooth and triangle could be made using wavetable synthesis and FM synthesis. But part of the reason to limit to a hardware triangle or sawtooth PSG is to give the device character. Like I ranted in another thread recently, the limitation is part of what I think gives the system character. I'm trying to find a good balance of limitation and freedom by mixing and matching various things.

The one I'm mostly looking for is wavetable synthesis though. A PSG with short low-resolution programmable samples. Only thing I found was the Ensoniq 5503 DOC used in Apple IIGS and some Ensoniq keyboard. It also has sequels in 5505 and 5506. Only I can't find it for sale, so I'm not sure it was an off-the-shelf part.

I guess FPGA is the most attractive solution after all. Pretty much all the mentioned sound chips have an FPGA implementation, so I guess I may have to look into the PC Engine PSG which I like a lot.
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Off-the-shelf PSG

Post by turboxray »

Are you putting together a retro system or just specing out one? As for replicating PSG to WSG (PCE) range, I mean you can do that with a tiny dedicated off-the-shelf MCU if needed as opposed to an FPGA - if you're not experienced with FPGAs. Like a 20mhz TinyAVR 8bit MCU (everything is internal). Some versions have two PWM ports you can output for stereo (no need for a DAC, or cheaper IO to resistor ladder dac haha). The average pin package seems to be 18-22 DIPs.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Off-the-shelf PSG

Post by Pokun »

Are you putting together a retro system or just specing out one?
Just specing one out for now. I have been planning it since forever, and it finally felt like I powered up enough to move it out of dreamland and in to the speculation room. One day it may even move up to the drawing board. I will probably build a simpler breadboard computer or something first though to see what it takes. I already built a prototype for the joystick though. :wink: It works!
3button.JPG
Seimitsu LS-32-1 joystick and Sanwa buttons (OBSF-30)

For some reason Sanwa and Seimitsu arcade parts are cheaper than common pushbuttons and industrial joysticks found in electronic parts stores. Not mentioning that they are of high quality and have highly responsive microswitches with little contact bounce. Ideal to use for game controllers. Only downside is that they make for quite large controllers (standard arcade buttons like above has a 30 mm mounting hole diameter). I'm going with Neo Geo pinout (DA-15 connector) so I don't have to make up a new standard, and because inputs are parallel (one wire per button like Atari, JAMMA etc). Makes it easier to adapt other controllers and I guess it should minimize input lag as well. I plan to make boards/adapters for it so it can be used on other systems like Famicom, NES, SNES and PC Engine as well.

As for replicating PSG to WSG (PCE) range, I mean you can do that with a tiny dedicated off-the-shelf MCU if needed as opposed to an FPGA - if you're not experienced with FPGAs. Like a 20mhz TinyAVR 8bit MCU (everything is internal). Some versions have two PWM ports you can output for stereo (no need for a DAC, or cheaper IO to resistor ladder dac haha).
A modern MCU for glue logic is OK, and it might be OK to use one as a sound chip as well, although it's kind of emulation. Something like a Raspberry Pi would defeat the purpose of the project though. I'm learning some Verilog and I hope I would be able to use an FPGA or an CPLD for something useful at some point. If I use an MCU, wouldn't I need a DAC to drive a TV speaker or headphones?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Off-the-shelf PSG

Post by lidnariq »

Pokun wrote: Sun Jan 12, 2020 6:21 pm If I use an MCU, wouldn't I need a DAC to drive a TV speaker or headphones?
No, that's what the PWM is.

They're not usually particularly high quality - e.g. the default 8-bit PIC PWM can't do better than 47kHz and 10b depth - but it turns out that the default RasPi audio output is also the same PWM (and, historically, almost exactly the same quality-wise.)
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Off-the-shelf PSG

Post by Pokun »

I see, PWM is a type of DAC. I still need an amplifier though? I have an LM386 which is said to be popular.

I have another question, but it's not only PSG-related so I'll start a proper thread for it.
Edit: And here it is.
Last edited by Pokun on Fri Jan 17, 2020 7:14 pm, edited 1 time in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Off-the-shelf PSG

Post by lidnariq »

Depends on the source of the PWM and the place sound is going afterwards.

Most PIC PWM drivers are already high current (up to 25mA) and voltage (up to 5V) for an audio signal, and are more than enough to directly drive a pair of headphones. (20mW into headphones is quite loud).

The Raspberry Pi GPIO pins are only a little lower power (up to 16mA and 3.3V).

"Line level audio" is only 1Vpp, so some attenuation will be necessary before the signal goes into an external amplifier.

Other devices may only be rated for 2mA on the PWM output, in which case an amplifier will be necessary.

LM386s are fine if you have them on hand, but a newer amplifier may give better results.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Off-the-shelf PSG

Post by Pokun »

The sound should mainly go to external speaker(s) at some point. Normally the TV's, and preferably safe for audio/video equipment (not speaker level). Headphones aren't really important unless it's a portable device (making it portable is an interesting thing to do though). Same goes for internal speaker(s).

Most PIC PWM drivers are already high current (up to 25mA) and voltage (up to 5V) for an audio signal, and are more than enough to directly drive a pair of headphones. (20mW into headphones is quite loud).

"Line level audio" is only 1Vpp, so some attenuation will be necessary before the signal goes into an external amplifier.
Being loud is not very good either if the lowest volume is too high. And since headphones usually doesn't have an amplifier I would need some way for volume control on the machine if I add a headphone port.
What does that mean? Is line level still too high voltage for audio output to the TV?

LM386s are fine if you have them on hand, but a newer amplifier may give better results.
Oh I see, LM386 is old stuff. But since I have it I might as well use it I guess.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Off-the-shelf PSG

Post by lidnariq »

Pokun wrote: Wed Jan 15, 2020 5:59 pm The sound should mainly go to external speaker(s) at some point. Normally the TV's, and preferably safe for audio/video equipment (not speaker level). Headphones aren't really important unless it's a portable device (making it portable is an interesting thing to do though). Same goes for internal speaker(s).
[...]
Being loud is not very good either if the lowest volume is too high. And since headphones usually doesn't have an amplifier I would need some way for volume control on the machine if I add a headphone port.
What does that mean? Is line level still too high voltage for audio output to the TV?
"Line level" audio is ... uh, just the standard for emitting audio?
https://en.wikipedia.org/wiki/Line_level

A design for something that would be not-too-loud when plugged into headphones, but still within a permissible range when plugged into an external amplifer, might be something like this:

Code: Select all

Vpwm --+
       |
       R1
       |
       +-----jack
       |
       R2
       |
      gnd----jack
Say we're talking about a 3.3V device that can source 15mA.
External amplifiers are usually assumed to have an input impedance of 10kΩ, and want an input voltage range of 1Vpp. So in this case, we want 10kΩ//R2÷(R1+10kΩ//R2) = 1/3.3V
In contrast, if we're talking about headphones, that's usually something in the range of 16Ω-32Ω per channel, and want an effective max output of maybe 200mVpp (which will still be pretty loud). So in this case, we want 16Ω//R2 ÷ (R1+16Ω//R2) = 0.2/3.3V
Take the two together and you'll end up with R1 ≈ 211Ω and R2 ≈ 93Ω.

Because 3.3V/15mA = 220Ω, and R1+R2 > 220Ω, we don't even need any amplification for this.
On the other hand, if the output couldn't source that much current, one would have to increase R1 and R2 and accept quieter input into a directly-connected pair of headphones. Or add an extra amplifier.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Off-the-shelf PSG

Post by Pokun »

I see, thanks for explaining!

"Line level" audio is ... uh, just the standard for emitting audio?
Yeah that's what I read. Then what do you mean that some attenuation is necessary before it goes into an external amplifier?
Assuming that attenuation means lowering the voltage.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Off-the-shelf PSG

Post by lidnariq »

Pokun wrote: Thu Jan 16, 2020 3:35 am Then what do you mean that some attenuation is necessary before it goes into an external amplifier?
Assuming that attenuation means lowering the voltage.
A device that's running at 3.3V will be emitting PWM that's 3.3Vpp, which is too loud for consumer line level. Hence all the stuff I wrote in my preceeding post...
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Off-the-shelf PSG

Post by Pokun »

OK now I think I get it. Consumer line level audio should be 1 Vpp, but this example is 3.3 Vpp and therefore not line level audio.
Post Reply