??? 08/10/12 05:24 Read: times |
#188032 - 5 sinewaves Responding to: ???'s previous message |
Good question. Very good.
I think you are exactly right and I need to calculate the 5 sinewave values internally with the MAC and use the onboard dac to output that waveform. A 256 byte lookup table gives a very good sinewave, I've tested that with the 89S52 and it looks perfect. Honestly, I don't know how to figure out a 5th or 3rd. The 2nd and 4th harmonics are simply 2 or 4 times the fundamental freq. A 5th would be having C as a bass note and G above it as the 5th. E would be a 3rd. Those actual frequencies for example (with a Lo C bass note): C 32.70 Hz G 49.00 Hz this is a fifth C 65.41 Hz 2nd harmonic is up one octave E 82.41 Hz This might be labeled as 2 2/3 G 98.00 Hz C 130.81 Hz 4th harmonic, up 2 octaves. So a solution might be: Use the one onboard dac of the AT89LP6440 to output all 5 harmonics from the one dac. We use only one timer. It is set for the bass note being played (X 256) Another timer reads the A/D inputs for the gain sliders. The main timer interrupt routine finds the values of all 5 harmonics. It multiplies each by it's associated gain slider, then adds these values internally using the MAC capabilities, and then outputs one calculated byte per interrupt. I like this one but figuring out the 5ths and 3rds will be a bit of trial and error I think. The 2nd harmonic is simply 2 X the fundamental frequency. The 4th is 4 X the freq. So outputting every other byte in the lookup table gives us the 2nd harmonic which is up one octave, outputting every 4th byte takes us up an octave above that. So the MAC routine calcs and outputs one accumulated byte of all 5 sinewaves. 256 of these interrupts produce one waveform. The bass note outputs this waveform at the freq of the note being played. looks like I might need 6 sinewaves. Rick |
Topic | Author | Date |
Faking an interrupt | 01/01/70 00:00 | |
or use a better part | 01/01/70 00:00 | |
More Interrupts | 01/01/70 00:00 | |
timer expansion | 01/01/70 00:00 | |
5 timers? | 01/01/70 00:00 | |
5 sinewaves | 01/01/70 00:00 | |
Phases | 01/01/70 00:00 |