Looking for sound generation suggestions
Looking for sound generation suggestions
Hi,
I thought I'd ask for suggestions about adding sound to my 6502 SBC (a Replica 1). Specifically, I want it to be a fairly minimal board that I could connect to the expansion interface. This is really just to amuse my kids, so it doesn't need to be polyphonic - even just a few notes would do. Maybe the simplest thing would be to use a DTMF chip? But if there is an easy way to build a more general solution, I'd like to do it.
Any and all suggestions and pointers to info is very welcome.
Thanks,
Ken
I thought I'd ask for suggestions about adding sound to my 6502 SBC (a Replica 1). Specifically, I want it to be a fairly minimal board that I could connect to the expansion interface. This is really just to amuse my kids, so it doesn't need to be polyphonic - even just a few notes would do. Maybe the simplest thing would be to use a DTMF chip? But if there is an easy way to build a more general solution, I'd like to do it.
Any and all suggestions and pointers to info is very welcome.
Thanks,
Ken
-
leeeeee
- In Memoriam
- Posts: 347
- Joined: 30 Aug 2002
- Location: UK
- Contact:
The simplest is to hang a speaker on a port line much as is done in this diagram ..
http://www.themotionstore.com/leeedavis ... mpf02.html
.. but this costs in software effort to make it do much more than 'beep'.
A more usefull solution is to use one of the sound chips such as the AY-3-89xx series. These have tone and noise sources as well as ADSR envelope generators and can make a wide range of noises with little processor effort. They are also fairly easy to interface to the 6502.
Lee.
http://www.themotionstore.com/leeedavis ... mpf02.html
.. but this costs in software effort to make it do much more than 'beep'.
A more usefull solution is to use one of the sound chips such as the AY-3-89xx series. These have tone and noise sources as well as ADSR envelope generators and can make a wide range of noises with little processor effort. They are also fairly easy to interface to the 6502.
Lee.
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
From tip #5 at viewtopic.php?t=342 :
If you go down to Tip #11, it gives the idea of how to do MIDI (musical instrument digital interface) which you can use with a MIDI-capable musical keyboard if you have one, and Tip #15 suggests using a simple 8-bit parallel D/A converter like the DAC0808 (MC1408) on an output port.
Quote:
The 6522's SR can also be used in mode 100 (shift out free-running at T2 rate) to output a 9-level PWM (0 to 8 bits high), which when followed by an RC filter, is suitable for a 9-level D/A. I've used it to generate DTMF. This is slightly better than 3-bit resolution. Some talking toys only use 2-bit resolution!
I like the suggestion to connect up an AY-3-8910 Programmable Sound Generator. But there are other choices: how about connecting a SID chip from a junked Commodore 64? Or you could use the TI sound chip, the SN76477:
http://www.mkv.mh.se/staff/per/diy/76477/
A similar chip, the SN76489, was used in the BBC Micro:
http://web.inter.nl.net/users/J.Kortink ... /index.htm
Or maybe desolder an OPL-3 sound chip from an old ISA soundcard:
http://www.ucapps.de/mbhp_opl3.html
Or, if you can get one, how about the polyphonic ring-tone generator from a mobile phone? That's what the XGameStation uses, for instance.
http://www.mkv.mh.se/staff/per/diy/76477/
A similar chip, the SN76489, was used in the BBC Micro:
http://web.inter.nl.net/users/J.Kortink ... /index.htm
Or maybe desolder an OPL-3 sound chip from an old ISA soundcard:
http://www.ucapps.de/mbhp_opl3.html
Or, if you can get one, how about the polyphonic ring-tone generator from a mobile phone? That's what the XGameStation uses, for instance.
Since none of the chips discussed so far are in regular production, another solution that might interest you is to use an ATmega microcontroller chip.
The microcontroller has an internal SPI port which you can bit-bang with a VIA chip. This would form the communications link between the Apple I and the microcontroller.
The microcontroller also has a VIA-like parallel port, which you can use with a simple R-2R DAC to provide digital audio. Just feed that into a lowish-noise op-amp (741 is OK, but it tends to be noisy) for filtration and isolation, and you should have a reasonable audio generator.
The microcontroller can be programmed to synthesize audio through various waveforms in ROM and, if your adventurous, through downloadable audio waveforms in RAM. In amateur radio designs, the technique used is called "Phase-Accumulator Synthesis," or "Direct Digital Synthesis." The only difference is, instead of IF or RF frequencies, you're scaling it down to audio frequencies.
The microcontroller has an internal SPI port which you can bit-bang with a VIA chip. This would form the communications link between the Apple I and the microcontroller.
The microcontroller also has a VIA-like parallel port, which you can use with a simple R-2R DAC to provide digital audio. Just feed that into a lowish-noise op-amp (741 is OK, but it tends to be noisy) for filtration and isolation, and you should have a reasonable audio generator.
The microcontroller can be programmed to synthesize audio through various waveforms in ROM and, if your adventurous, through downloadable audio waveforms in RAM. In amateur radio designs, the technique used is called "Phase-Accumulator Synthesis," or "Direct Digital Synthesis." The only difference is, instead of IF or RF frequencies, you're scaling it down to audio frequencies.
I've wrote a sound synth that runs on an 18F PIC on my NES cartridge. Pretty much how kc5tja is saying.
I've got waveforms in RAM (which can be gradually modified to do SID-like effects such as pulse-width modulation, or pre-set to any kind of waveform). Use fixed-point to get the sound frequency (resampling), multiply the wave sample by a volume setting to scale volume control, then I do that 4 times (for 4 channels polyphony) and add it together, shift it to fit the DAC's bit-range, and there it is. And doing it 22,050 times per second. Really fun stuff.
Wrote a random # generator to make noise output, that works too.
You can do all this on the 6502 itself too of course, just need something like an IRQ coming at a constant rate so you get a steady sample rate. Get IRQ, write previous sample, calculate next one, RTI. Using a PIC in my setup I get to skip the (pretty intensive) calculate sample part.
I've got waveforms in RAM (which can be gradually modified to do SID-like effects such as pulse-width modulation, or pre-set to any kind of waveform). Use fixed-point to get the sound frequency (resampling), multiply the wave sample by a volume setting to scale volume control, then I do that 4 times (for 4 channels polyphony) and add it together, shift it to fit the DAC's bit-range, and there it is. And doing it 22,050 times per second. Really fun stuff.
Wrote a random # generator to make noise output, that works too.
You can do all this on the 6502 itself too of course, just need something like an IRQ coming at a constant rate so you get a steady sample rate. Get IRQ, write previous sample, calculate next one, RTI. Using a PIC in my setup I get to skip the (pretty intensive) calculate sample part.
Im Pursing this my self and found some good books on it. "Musical Appllications of Microprocessors" by Hal Camberlin has an enourmous about of information for the 6502. Wave Look Up Tables, Digital Sound Generation, Midi Keyboards with Midi Interfaces and there respective Chips to them, and even DSP (FFT and Such). I bought this book awhile back before i started working the 6502 and later looked back to find a cove of useful information. "Programming the 6502 with Experiments" by Blacksburg Contining Education Series, has a few cool little tricks on D/A Convertion for making Tones with OP AMps for generating chords and w/ formulas for implemating a F# in Hex and Such. Its worth a look.
Re: Looking for sound generation suggestions
Kallikak wrote:
Hi,
I thought I'd ask for suggestions about adding sound to my 6502 SBC (a Replica 1). Specifically, I want it to be a fairly minimal board that I could connect to the expansion interface. This is really just to amuse my kids, so it doesn't need to be polyphonic - even just a few notes would do. Maybe the simplest thing would be to use a DTMF chip? But if there is an easy way to build a more general solution, I'd like to do it.
Any and all suggestions and pointers to info is very welcome.
Thanks,
Ken
I thought I'd ask for suggestions about adding sound to my 6502 SBC (a Replica 1). Specifically, I want it to be a fairly minimal board that I could connect to the expansion interface. This is really just to amuse my kids, so it doesn't need to be polyphonic - even just a few notes would do. Maybe the simplest thing would be to use a DTMF chip? But if there is an easy way to build a more general solution, I'd like to do it.
Any and all suggestions and pointers to info is very welcome.
Thanks,
Ken
Toshi
-
Nightmaretony
- In Memoriam
- Posts: 618
- Joined: 27 Jun 2003
- Location: Meadowbrook
- Contact:
ninTENdo, will have to get in that book. a later project involves a dsound synthesizer planned from a wave table architecture to an FPGA. (it had some other tricks I dont want to divulge just yet, but it involves throwing everything together in a huge pile of data 
Cheap and easy is still an 8 bit D/A port and send out sound samples or waveforms. Gottlieb pinball boards used this architecture.
The SN76477 and SN76489 were NOT the same architectgure or even remotely related. The 76477 used discrete analog sound units within and oyu set with RC components. Very limited chip. The 76489 used simple tone generators and has much more in common with the AY3-8910/12/13 series and SID chips.
The OPL FM series can be a little pain and seem this kind of obsolete these days. Sound was thin, just check out the DX7 sometime.
Wavetables I like, from the Ensoniq Mirage series and Apple ][ GS sound system, also used in the ESQ-1.
Later systems loved using a DSP with a D/A output.
Cheap and easy is still an 8 bit D/A port and send out sound samples or waveforms. Gottlieb pinball boards used this architecture.
The SN76477 and SN76489 were NOT the same architectgure or even remotely related. The 76477 used discrete analog sound units within and oyu set with RC components. Very limited chip. The 76489 used simple tone generators and has much more in common with the AY3-8910/12/13 series and SID chips.
The OPL FM series can be a little pain and seem this kind of obsolete these days. Sound was thin, just check out the DX7 sometime.
Wavetables I like, from the Ensoniq Mirage series and Apple ][ GS sound system, also used in the ESQ-1.
Later systems loved using a DSP with a D/A output.
"My biggest dream in life? Building black plywood Habitrails"
Agreed. TMorita's suggestion of constructing a 1-bit DAC is doable, but it requires MASSIVE CPU bandwidth. That's not something 6502s are known for.
For only 20 cents more, you can use 16 resistors (arranged as an R-2R ladder) on an 8-bit port, and you'll have the equivalent of one quarter of a Paula.
Get four of those going together, and you'll be able to match the Amiga's Paula chip capabilities. Most microcontrollers are powerful enough these days to handle limited audio mixing too, so you can perhaps simulate multiple voices (suppose 3 8-bit ports, and enough RAM to store 3 look-up tables; if you need 9 voices, you can assign 3 voices to the same wavetable).
For only 20 cents more, you can use 16 resistors (arranged as an R-2R ladder) on an 8-bit port, and you'll have the equivalent of one quarter of a Paula.
leeeeee wrote:
The simplest is to hang a speaker on a port line much as is done in this diagram ..
http://www.themotionstore.com/leeedavis ... mpf02.html
.. but this costs in software effort to make it do much more than 'beep'.
A more usefull solution is to use one of the sound chips such as the AY-3-89xx series. These have tone and noise sources as well as ADSR envelope generators and can make a wide range of noises with little processor effort. They are also fairly easy to interface to the 6502.
Lee.
http://www.themotionstore.com/leeedavis ... mpf02.html
.. but this costs in software effort to make it do much more than 'beep'.
A more usefull solution is to use one of the sound chips such as the AY-3-89xx series. These have tone and noise sources as well as ADSR envelope generators and can make a wide range of noises with little processor effort. They are also fairly easy to interface to the 6502.
Lee.
Rich Cini
http://cini.classiccmp.org
http://altair32.classiccmp.org
GitHub Repro: https://github.com/RichCini
http://cini.classiccmp.org
http://altair32.classiccmp.org
GitHub Repro: https://github.com/RichCini
-
Nightmaretony
- In Memoriam
- Posts: 618
- Joined: 27 Jun 2003
- Location: Meadowbrook
- Contact:
-
smilingphoenix
- Posts: 43
- Joined: 20 May 2006
- Location: Brighton, England
I like the AY-3-891x chips. They can be connected directly to the 6502 bus at clock speeds of 2MHz, they might work OK at faster speeds but my data sheet doesn't have the timing data
Only problem is, I havn't been able to locate a source for them recently.
If you are using the original datasheets, take care. All the programming data, for some weird reason, is in octal instead of hex. This can be very confusing for the unaware. (eg me)
If you are using the original datasheets, take care. All the programming data, for some weird reason, is in octal instead of hex. This can be very confusing for the unaware. (eg me)
smilingphoenix wrote:
I like the AY-3-891x chips. They can be connected directly to the 6502 bus at clock speeds of 2MHz, they might work OK at faster speeds but my data sheet doesn't have the timing data
Only problem is, I havn't been able to locate a source for them recently.
If you are using the original datasheets, take care. All the programming data, for some weird reason, is in octal instead of hex. This can be very confusing for the unaware. (eg me)
If you are using the original datasheets, take care. All the programming data, for some weird reason, is in octal instead of hex. This can be very confusing for the unaware. (eg me)
Search for userid "honestcard" or "ay38910".
Rich Cini
http://cini.classiccmp.org
http://altair32.classiccmp.org
GitHub Repro: https://github.com/RichCini
http://cini.classiccmp.org
http://altair32.classiccmp.org
GitHub Repro: https://github.com/RichCini