6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 29, 2024 11:28 pm

All times are UTC




Post new topic Reply to topic  [ 48 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Adding Sound Generation
PostPosted: Sat Jun 10, 2017 9:17 am 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
So, I've been looking at how I might add sound generation hardware to my computer.

The options I've found thus far:
  • The TI SN76489, as used in the BBC Micro - No longer manufactured and I don't like the idea of scrounging for used parts. Also probably not 3.3V compatible from what I can tell.
  • One of the Yamaha YMxxxx / OPLx synthesizer chips, as used in the Adlib and some Sega machines - Ditto to the TI chips.
  • Program up a modern microcontroller to act as a sound chip - complex to implement and feels like cheating
  • The VIA Serial port based sound generation used by the VIC-20 and pnoyes' Dodo - Works well enough, but I was hoping for more than one voice, and it ties up the Serial port which I intended to use as an I/O expansion port.

Does anyone have any comments or ideas? I'm a bit stuck...

I'm terms of available interfaces, I've got SPI ports, a 10-pin GPIO port and the VIA Serial broken out along with an aux/direction pin. Direct interfacing to the processor bus is possible but problematic.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 9:59 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10940
Location: England
Might be worth considering the brilliant and surprisingly simple approach of the Music 5000?
viewtopic.php?f=4&t=4436


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 10:02 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10940
Location: England
Or, look into BeebOPL which is one of a short series of modern OPL designs as an 8 bit peripheral for the BBC Micro:
http://stardot.org.uk/forums/viewtopic.php?t=11434


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 10:04 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
All the audio signal handling I've done has been with the processor babysitting it sample by sample (usually tens of thousands of times per second, governed by a VIA timer generating interrupts); however:
Alarm Siren wrote:
[In] terms of available interfaces, I've got SPI ports,

I can't take the time to find you any part numbers right now, but I know there are signal-generator ICs with SPI.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 7:46 pm 
Offline

Joined: Thu Jan 21, 2016 7:33 pm
Posts: 276
Location: Placerville, CA
Alarm Siren wrote:
  • The TI SN76489, as used in the BBC Micro - No longer manufactured and I don't like the idea of scrounging for used parts. Also probably not 3.3V compatible from what I can tell.
  • One of the Yamaha YMxxxx / OPLx synthesizer chips, as used in the Adlib and some Sega machines - Ditto to the TI chips.

This is gonna be true of pretty much any sound generator that isn't either an industry-standard PC solution (i.e. AC97) or a bare-bones DAC or square-wave generator, so I wouldn't let that constrain you too much. I'd lean towards a Yamaha FM chip, as that gets you a pretty good return on investment as far as sound quality/flexibility vs. CPU horsepower goes (although the OPLx chips do have an annoying requirement for delays after writes, but still.) Rolling up your own sound generator on a microcontroller is also a fun idea, although it can be a bit of a project in itself.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 8:21 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
commodorejohn wrote:
Rolling up your own sound generator on a microcontroller is also a fun idea, although it can be a bit of a project in itself.


I'm increasingly coming to the conclusion that that's the best way forward. It just feels so... dirty. "I want my retro computer to have decent sound capabilities. So I'm going to put on another, much more powerful computer to act as a sound card... wait what?"

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 9:48 pm 
Offline

Joined: Thu Jan 21, 2016 7:33 pm
Posts: 276
Location: Placerville, CA
Yeah, I get that. On the other hand, you can think of it less as another computer and more as (effectively) a fixed-function large-scale integrated circuit, which is what other sound generators are. What kind of sound generator are you thinking of trying to create? If you're interested in FM, it's actually surprisingly easy to do - I can point you to some documentation on the internals of the DK Synergy, which manages 32 sine-wave operators configured in an arbitrary fashion using only phase accumulators and a lookup table, implemented entirely in TTL logic. (Doesn't even require a multiplier for level attenuation - it's absolutely freaking brilliant.)


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 10:06 pm 
Offline

Joined: Sat May 02, 2015 6:59 pm
Posts: 134
It might be worth a look at the FTDI FT801, just for it's audio sub section.

http://www.ftdichip.com/Products/ICs/FT801.html
http://www.ftdichip.com/Support/Documen ... _FT801.pdf


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 10, 2017 11:19 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
You may also take a look at the 82C54 (intersil and others), an old style "CTC". There are 3 16bit counters with seperate clock in- and outputs. Not yet a soundchip but perhaps a part of it. I imagine that two of them and some glue logic (and software of course) could generate a lot of "noise" :D.

The 82C54 is still available (Mouser, Digikey..). Similar is the Z80-CTC (perhaps Digikey) or Motorola 6840 (obsolete).

Sorry, only parallel input (8 bit bus), no SPI :(


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 12:57 am 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
The 82C54 looks very promising, based on my best understanding of the datasheet.

Basically, wire up the master clock (2MHz) to the clock inputs of each of the three counters. Load the 16-bit counters with N = CLK/F, where N is the counter value, CLK is the master clock and F is the desired frequency. Set the counters to Mode 3.

Now, the output pin of the counter will be a 50% duty cycle square wave of the frequency F until it is changed. Optionally stick an RC filter on the output(s) to turn them into sine waves and then feed them into a combining op-amp structure, and voila, 3-voice sound. The range of possible frequencies is between approximately 30.5Hz at N=65535 to 2MHz at N=1, easily encompassing the human hearing range, and getting progressively more accurate the closer we approach the lower end.

For example, middle C has a frequency of approximately 261.626Hz...
N = 2000000/261.626 => therefore N = 7644.5.
Round up to 7645.
Check....
F = 1/(N/2000000) => therefore F = 261.608Hz, a margin of error of 0.00007%.

Main down side: no ability to vary the duty cycle (and thus relative volume) of the channels.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 1:27 am 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
Yes, this way it can go :D

FYI: it is not necessary to try to get sine waves - they sound pretty dull. A 50:50 square wave has lots of overtones (3., 5., 7.,... harmonics) that makes it sounds brighter. And perhaps you should try (if possible, I know it works for the 6840, but I didn't go deep into the 8254) variable duty cycle 10:90 or modulated (every few 10th of a second changed) from 10:90 .. 50:50. The smaller the duty cycle the brighter the sound (more overtones). But sadly the volume will change a bit. Thats a huge playfield. Have fun :D


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 9:53 am 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
Pretty sure its not possible to vary the duty cycle using the 82C54, unfortunately.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 10:43 am 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
Yes - sadly. To do so you would need twice as many PITs to combine them, still little pleasure. Well, in this case the 6840 could serve you better, but it is obsolete and AFAIK only for bus frequencies up to 2 MHz (68B40) suitable.

But you may try by software using any free port pin you may have to generate a signal with a selectable or slowly varying DC and listen. Perhaps the effect is less prominent as it looks (viewing at the FFT). Perhaps it is sufficient to have 50:50 and 25:75 available for mixing.

Perhaps you take a look at the Chorosynth http://www.appleii-box.de/S15_SynthisizerChorosynth00.htm. It is using three 555 timers and neat mixing to generate interseting sounds. Instead of the 555s a PIT should work well.

edit(1): you need to program the PITs output frequencies with a slight difference to get the chorus effect. Perhaps two instead of three timers for the base frequency are sufficient, or you just use two PITs :D


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 2:34 pm 
Offline
User avatar

Joined: Wed Mar 01, 2017 8:54 pm
Posts: 660
Location: North-Germany
A perhaps a bit too sophisticated (audio specs!) way to control the volume & panning: LM1973. It has a moderate price and can volume control 3 signals. Drawback: only SMD :|


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 11, 2017 2:58 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 362
How does this look to people?

I'm particularly unsure about my maths with regard to the 22k resistors, especially given I've thrown in that 10k pot for volume control.

Op-amps was always one my weakest subjects...

I have also never been able to find a straight answer with regards to what voltage a headphone output actually should be, peak to peak. Best I can work out? Somewhere between 0.5V and 1.5V depending on how fancy the audio equipment is - fancier equipment outputting higher voltages.


Attachments:
File comment: 82C54-based Sound Synth circuit schematic, revision 1.
soundsynth rev1.png
soundsynth rev1.png [ 69.55 KiB | Viewed 3103 times ]

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 48 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 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: