I need to be able to generate 16 pitches simultaneously for a project I'm working on at the moment. I plan on using the Tone library, but it currently maxes out at 3 timers on the 168/328. Ideas?
What else will be running on the board?
Most likely a Centipede shield.
"What else will be running on the board?" was an invitation for you to tell us more about the project. What is the Arduino doing besides making noise? Why is it making these noises? Using a centipede shield implies the need for more I/O pins than the Arduino has, which implies lots of stuff going on.
But rather than implying stuff, get specific.
Specific it is: I'm trying to make a hardware version of the Sound Matrix. I've already got a general plan. It's a 16x16 board, so at a max, I'll need to drive 16 pitches at once at most. For the buttons, SFE sells small 4x4 buttons/PCBs that seem to go perfect for this project.
Sorry about being reluctant to share details, I just generally fear people ripping off my project ideas.
You dont need all those timers, but you need to learn how to generate sound using software and not only hardware timers, search for avr chiptunes.
Maximum frequency?
The lowest tone is 220 Hz, highest is 1760.
1 / 1760 = 0.000568181818 seconds per sample
Assuming your Sketch only runs 1 cycle machine instructions...
1 / 16000000 = 6.25 × 10-8 seconds per instruction
(1/1760) / (1/16000000) = 9090 instructions per sample
9090 / 16 = 568 instructions per sample per channel
There's plenty of horsepower to drive 16 channels. Given the fact that you plan to do more than generate 16 tones, you will be battling latency.
Correct, as it seems, since monitoring 64 inputs is not latency-free or simple business.
You might want to take a cue from the early electronic organ designs: use a "top octave synthesizer" (aka "top octave generator") chip, and some binary counters to divide down the lower octaves. Then you can use multiplexers to pick off the exact frequency you want for each channel.
Or you could use a programmable logic chip (CPLD or FPGA) for each channel, and combine the multiplexer and divider logic in it.