6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 7:44 pm

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Oct 04, 2006 1:04 am 
Offline

Joined: Mon Mar 27, 2006 10:54 pm
Posts: 13
Location: Sydney
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Oct 04, 2006 1:20 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
The simplest is to hang a speaker on a port line much as is done in this diagram ..

http://www.themotionstore.com/leeedavison/z80/mpf1/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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Oct 04, 2006 2:12 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
From tip #5 at viewtopic.php?t=342 :
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!

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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Oct 04, 2006 1:19 pm 
Offline

Joined: Tue Mar 09, 2004 3:43 pm
Posts: 44
Location: Bristol, UK
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/home/articles/sn76489/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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Oct 04, 2006 4:26 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Oct 04, 2006 6:42 pm 
Offline

Joined: Thu Jan 16, 2003 12:55 pm
Posts: 64
Location: Indianapolis
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. :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 09, 2006 1:55 am 
Offline

Joined: Mon Mar 27, 2006 10:54 pm
Posts: 13
Location: Sydney
Thanks for the many and varied suggestions!

Ken


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Mar 18, 2007 10:32 pm 
Offline

Joined: Wed Jul 26, 2006 4:53 am
Posts: 12
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 19, 2007 9:44 pm 
Offline

Joined: Sun Sep 15, 2002 10:42 pm
Posts: 214
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


If you want a simple interface, just use a single bit output port connected to an LM386 or Rat Shack pocket amplifier, then use a software timing loop to tweak the output bit.

Toshi


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 12, 2007 7:18 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
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 :D

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"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 13, 2007 12:56 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
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).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 13, 2007 11:18 pm 
Offline
User avatar

Joined: Wed Sep 03, 2003 6:53 pm
Posts: 153
Location: Long Island, NY
leeeeee wrote:
The simplest is to hang a speaker on a port line much as is done in this diagram ..

http://www.themotionstore.com/leeedavison/z80/mpf1/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.


I like the AY389xx suggestion too. I pulled a copy of the data sheet that I have and it doesn't have an application circuit section. I was able to find a real simple schematic (for the 8080) and one in SYM-PHSIS #7. In that issue the schematic is actually textual rather than drawn and it includes code. The 8080-based one is connected directly to the CPU bus and the SYM version is connected to a VIA. Why that additional layer is needed I don't know - the 8910 should work well with a direct connection.

_________________
Rich Cini
Build Master and maintainer of the Altair32 Emulation project
http://cini.classiccmp.org
http://altair32.classiccmp.org


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 23, 2007 10:38 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
If you go for the AY3-89XX series, look for old Apple 2 code for the Mockingboard which used those...

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 29, 2007 12:51 pm 
Offline

Joined: Sat May 20, 2006 2:54 pm
Posts: 43
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)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 29, 2007 1:00 pm 
Offline
User avatar

Joined: Wed Sep 03, 2003 6:53 pm
Posts: 153
Location: Long Island, NY
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)


I just bought two from a guy on eBay who is in Florida. He had them for $15 each with free shipping. I bought two of the 315 he had.

Search for userid "honestcard" or "ay38910".

_________________
Rich Cini
Build Master and maintainer of the Altair32 Emulation project
http://cini.classiccmp.org
http://altair32.classiccmp.org


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: