View Full Version : Sound polyphony
RodSTAR
- 14th November 2007, 03:52
hi folks,
Is it possible to execute 2 or more simultaneous sound voices?
example:
-Having 3 buzzers on 3 different pins and playing a chord or a Bach 3 voices fugue?
I know the SOUND command doesn't play in background, it waits for the period and then goes to next command.
I guess if possible, it could be through interrupts,
any lights?
mister_e
- 14th November 2007, 04:06
Yes this could be done with Timer interrupts. You'll need to determine the highest frequency first, sometimes it might be too fast to have time enough to do something else.
Still possible to use a PIC with 3 different CCP module and who allow 3 different frequency.. but they're usually overkill and way too big. Unless i missed few models, i think the smallest would have more than 40 pins :eek:
Now, if all your buzzers runs with multiple of 2 of a frequency (which i doubt), an external frequency divider (JK or something like that) + 1 HPWM will do the trick.... but i doubt of the frequency multiplication stuff... to me this would sound really weird ... really not pleasant to hear... even Celine Dion would be more pleasant to hear...
Jerson
- 14th November 2007, 05:43
I think it can be done. I think the DTMFout command uses it. SOUND will not work for polyphony.
You definitely do not need 3 buzzers. But a lot of quality coding(highly optimized asm).
Then, you could play out samples(not just square waves of sound) which could be n-key polyphonic thru a single buzzer/speaker. Interrupts may give determinance of time between samples, but it may be hard to get the timing right.
You might like to read up on this for ideas even though it uses the PSoC
http://www.web-ee.com/Schematics/PolyPiano/piano.htm
Another using the PIC is a DDS
http://www.min.at/prinz/oe1rib/DDS/SineDDS.htm
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.