As for generating sine waves - it's all a question of precision. It is
a huge drain on resources to calculate sine waves at audio rates using
CORDIC methods. But you can get very close with table lookups or
splined approximations at a fraction of the CPU usage. I suspect you
will be underwhelmed with the result though. Sine waves are the
plainest sounding of all waveforms. The imperfections actually give
electronic music it's character. One of the most coveted synthesisers
of the 80's - the Commodore 64's SID chip - had a triangle wave, but
no sine wave.
And Travis - if you're desperate, you can always pick up a second
Arduino. They're not expensive. And bonus feature - the pentatonic
scale means you can play then play duets without hitting discordant
notes.
On Apr 16, 9:01 pm, laduke13 <
travislad...@gmail.com> wrote:
> Is this FOF thing anything like how a Class-D amp works?
No, class D and FOF are different. FOF generates a stream of audio
samples. Class D (which is how the analogue output works) renders that
analogue level in a way that the amplifier is compatible with.
It works like this:
Controls ==(variables)==> FOF synthesis engine ==(samples)==> Class D
output ==(audio output)==>
> If yes (but I'm assuming no), have you ever put a low-pass filter on
> the output?
All amplifiers have some form of low pass filter. Many have a tone
control that will do very nicely. If you don't low pass filter, you
get short-wave radio like warbles and whistles, which has musical
possibilities in its own right.
> If no, is the Arduino fast enough to calculate audio rate sine waves?
Yes - although it depends on what you mean by 'calculate', and what
you define as a 'sine wave'. Sine is a function that is very amenable
to table look-up methods, particularly if you don't mind dropping to 8
bit precision and a little numerical error. However, a triangle wave
sounds particularly close to a sine wave and takes a fraction of the
effort to calculate - so that is what Auduino uses.
> I don't know how hard that would be to code in assembly or c, but I'm
> kind of avoiding looking up how to do it.
Step 1) Build it.
Step 2) Play with it. Learn what sorts of sounds it makes and how to
control it.
Step 3) Work out what you want to do with it, and how you could change
it to make it your own.
Then, step 4) change the code.
One step at time, friend!
> Man, I can't wait to finish this project that is occupying my Arduino,
> so I can free it up and start using it for Auduino purposes.
You could always pick up a second one. They're not expensive. I've got
a drawer of them, and several more are sitting in projects.