SPIN Tone Generator
Rayman
Posts: 14,826
I'm now learning how to do DAC with the Prop...
I've written this little·dual tone generator in SPIN.· Works from ~8 to 2000 Hz with a fixed 16 ksps rate.
It's set up to drive the stereo output of the Demo board.· Kinda fun to plug in speakers and mix frequencies...
I've seen that Tracy Allen has done something like this before, but this is my own·take on it (with fixed sample rate)...
I'm hoping to do a WAV player from SD card.· I think I could do this now at 16 ksps, but this isn't so great...· Definitely need assembly for descent quality...· Still, it might be fun to try it in SPIN...· I know David already did a WAV player in assembly.
Update:· Well, I just fixed a rookie error that made the output not quite as pretty a sine wave as it is now.· I've updated this post with the revised file.
Post Edited (Rayman) : 11/9/2007 1:44:13 PM GMT
I've written this little·dual tone generator in SPIN.· Works from ~8 to 2000 Hz with a fixed 16 ksps rate.
It's set up to drive the stereo output of the Demo board.· Kinda fun to plug in speakers and mix frequencies...
I've seen that Tracy Allen has done something like this before, but this is my own·take on it (with fixed sample rate)...
I'm hoping to do a WAV player from SD card.· I think I could do this now at 16 ksps, but this isn't so great...· Definitely need assembly for descent quality...· Still, it might be fun to try it in SPIN...· I know David already did a WAV player in assembly.
Update:· Well, I just fixed a rookie error that made the output not quite as pretty a sine wave as it is now.· I've updated this post with the revised file.
Post Edited (Rayman) : 11/9/2007 1:44:13 PM GMT
zip
1K
Comments
I'd love to see a more advanced interactive sound synthesizer similar to a AVRSYN ( or SoundGin ). With high-speed operation, multiple Cogs and shared Hub memory something quite impressive should be possible and MIDI control should be fairly easy to add. Make it SoundGin compatible and their visual programming software can be used
I've had some fun poking around and making noises out of Chip's Vocal Tract object and I guess Hydra Sound System FX Synth would be a good place to start, but it's a all a bit beyond me and I've got a long list of fun things to try with a Propeller first.
The worst thing about the Propeller - It can easily consume your life
nemesis.lonestar.org/reference/telecom/signaling/dtmf.html
Not sure how accurate it is, but it sounded close.. If I had a phone closer to my prop, I'd test. [noparse]:)[/noparse]
Remember those old portable DTMF dialer Radio Shack used to sell?
Oldbitcollector
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
The versions are the incremental steps I went through which hopefully makes it clearer what's going on for anyone, like I was, who's starting off clueless.
Edit : See post two down for latest source code attachment.
Post Edited (hippy) : 11/16/2007 4:16:56 PM GMT
Very Cool. It's neat to see some more sound stuff appearing!
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
Post Edited (Oldbitcollector) : 11/13/2007 5:35:49 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
using a propeller. Who said they were bored??! If you are bored with a Propeller in the same house, you've
got real issues.. <smirk> I wish I had more time to play myself...
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.
— Calvin, of 'Calvin and Hobbes.
SoundGin runs six VCO and six ADSR's plus Mixer on an 18F1320 at (probably) 10MIPs, so a Cog should be able to do twice as much. With a Cog for MIDI or keyboard scanning, another for mixing and scheduling/allocating notes, it should be possible to get twelve note polyphonic sound from one Propeller.
As with SoundGin, the configuration should be able to do allophone speech, so that's potentially 12 Propeller 'conversations' going on at once
The VCO's use a Sine table but there's no reason any wave table couldn't be used, or that it couldn't use 'samples'.
There's still scope for plenty of expansion in what I've done; Frequency Modulation being the main lacking feature, and I don't have a clue about how to implement digital filtering to emulate a VCF.
This was really thrown together to see where it would go. Ultimately I think it would best be rewritten to be SoundGin compatible and that appears to do things in a different way. That gets round the problem of not having lots of pots and sliders, MIDI or a keyboard for testing or use.
Post Edited (hippy) : 11/14/2007 7:23:17 PM GMT
Tone Generator re-written in Assembler attached. It emulates almost all of the Soundgin functionality for a main oscillator, max frequency is 7,812Hz with a 64uS tick rate at 80MHz. That's enough to handle 12 oscillators so each Cog should be able to emulate one Soundgin each. Going to 96MHz would be the obvious solution if it gets tight or the tick rate can be upped to 100uS ( 5,000Hz ) with little noticeable affect on the sound quality at 1kHz.
The oscillators and mixers need to run once per tick for quality but ADSR's and other ramping / targeting controls can probably be sequentially run one per tick which keeps the per loop overhead down. About 40% of the Cog is used so far, generally unoptimised code.
One Cog for TV text, one for TV diagnostic reports, one for serial / MIDI / keyboard scanning, one for serial command processing, leaves four for music generation. The TV Cogs could be reclaimed for music use. So that's four to six note polyphonic with a Soundgin per Cog and allocating Cogs for different functions ( VCO / ADSR ) would increase that. I'm aiming for a single Soundgin per Propeller emulation to start with; five Cogs including TV.
The biggest effort I foresee is in mapping what I have to what the Soundgin has to make the same parameter control available, plus understanding how the Soundgin functions all fit together.
Did you happen to do any more work on this project, or do you have additional examples
of this code in use which you would be willing to share for learning?
Thanks
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS