for a project, I am trying to generate a sound by directly accessing a loudspeaker. I can send a one-bit signal to the speaker and I know how to generate simple sounds by controlling the frequency (due to the rectangular pattern of my curve, it sounds very artificial, but that does not matter).
I would like to do chords, too, though. It must be possible to generate those. What is the general idea behind doing polyphonic sounds with a simple speaker?
So how do I need to go about this if I can only control this one bit stream? Thanks in advance.
UPDATE: I now have four signals, freq(3) down to freq(0) that all carry a frequency.
For each of them, I have a signal SE (for "sound enable"), which tells me whether that signal is currently active. I achieve that by a simple "AND", so that every signal is always zero if the corresponding SE signal is zero and that it mirrors the actual frequency when SE is set to one.
So, the remaining problem: How do I connect the four signals? Connecting them with "OR" is probably not good, because with four signals the output will almost always be one. Any suggestions?
(a+b+c+d+2)>>2(adding 2 to round to closest integer, which will be 0 or 1). Another way of saying this is that if at least two of the inputs are 1, then the output should be 1. You could do that using binary logic, a lookup table (which would fit into 16 bits) or simply by adding and shifting. – Jul 22 '11 at 18:36