tone() - multiple instances for polyphony

Hiya,

I am very excited to see the addition of tone() to the regular Arduino release. I was experiencing compiler errors when I used the servo() and tone() libraries together in the previous version (0017). This new version seems to have fixed the problems I was experiencing before.

However, I have a new problem. The new implementation of tone() does not allow you to create multiple instances (new objects) to have more than one tone playing at a time. Perhaps the previous object-based implementation could be re-introduced in the next version.

I hope this is an easy fix/addition because as it is now I will have to use a separate Arduino board for each audio channel I want which is, of course, very costly.

The reason it only supports one tone was to provide compatibility with the servo library. We're hoping to provide some method to dynamically allocate timers, which should allow the creation of two simultaneous tones, but only if the servo library is not used.

Oh no. Oh well.

Is it possible that you will be able to resolve the conflict between Tone and Servo in the future, or is this a limitation of the hardware?

Here is a video of what we are working on and why we have a need for Servo and Tone together. http://www.youtube.com/watch?v=z8wpxj67paM

There will be several of these birds, and I was hoping I would be able to run more than one with each Arduino board (as opposed to having to buy a separate board for each bird).

Hi,

I tried using tone() today, with two piezos hooked up to different pins, and I found that when you call tone() to play a tone on one pin, you must call noTone() for that pin before calling tone() on another pin... even if the sound on the first pin has stopped playing.

Just wanted to mention that in case someone comes across this thread while investigating the same issue.