I was looking for generating multiple waveforms from Arduino simultaneously and independently. I came across the library called "arduino-playtune" and found that it can play up to six tones simultaneously from Arduino Mega. I went through the readme text of the library and found that this library can play tones simultaneously but can't do that independently.
I want to make a circuit that can generate multiple tones independently and simultaneously and can have independent control over each tone like play, pause and stop. It is possible to do that using this library or do I need another library to do that?
but can't do that independently.
Please define what you mean by independently. Given the fact that it can play up to six tones simultaneously.
Grumpy_Mike:
Please define what you mean by independently. Given the fact that it can play up to six tones simultaneously.
I am sorry if I have made my post obscure to you. I will try to explain my queries.
As per the instruction of the library, it says that the library is capable of playing up to 6 tones simultaneously through the digital pins. It means that the library can play 1 or 2 or 3 or 4 or 5 or 6 simultaneously and if I want to pause or stop all the tones pause/stop together. I want to do something like playing different tones in different pins and pause/stop them separately. For example, I want to play tone1, tone2 and tone3 on three different pins say pin1, pin2, and pin3. After 3s, I want to stop paying tone on pin3 and then after another 3s stop playing on pin2 and after another 3s stop playing tone on pin3. It means that I can play and control the tones simultaneously and independently.
Hope now I have cleared my queries.
I want to do something like playing different tones in different pins and pause/stop them separately. For example, I want to play tone1, tone2 and tone3 on three different pins say pin1, pin2, and pin3. After 3s, I want to stop paying tone on pin3 and then after another 3s stop playing on pin2 and after another 3s stop playing tone on pin3.
It looks like you can do all that with the libiary.
From the read me file on the link you posted it looks like the GitHub - LenShustek/Playtune_poll: A background polyphonic music generator for Arduino, using fast polling is the one you want to use.
Grumpy_Mike:
It looks like you can do all that with the libiary.
From the read me file on the link you posted it looks like the GitHub - LenShustek/Playtune_poll: A background polyphonic music generator for Arduino, using fast polling is the one you want to use.
Thank you for your suggestion. I was following the instructions of playtune_poll. I have created a sketch directory with the three files in it: Playtune_poll.h, Playtune_poll.ino and Playtune_poll_test.ino. Then I included the timer timer1 library. After that, I tried to compile the Playtune_poll_test.ino, it is showing the error messages. As the error message is too lengthy for the post I have attached a text file that contains the error message.
I don't know why this error message is showing. How to solve this issue?
Error Message.txt (28 KB)
It looks like you have not included or installed one or more libraries correctly.
You also need to post your code because because the error messages by themselves tell you little detail, they only tell you where the compiler got stuck.
Start with the first error message, and fix that.
It is saying you used a variable and the compiler does not think it was declared.
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Saddam\Documents\Arduino\Playtune_poll\Playtune_poll.ino: In function 'void tune_init_pins()':
Playtune_poll:519: error: 'SCOPE_PIN' was not declared in this scope
pinMode(SCOPE_PIN, OUTPUT);
That is the variable SCOPE_PIN has not been set up. It says you tried to use this variable in a function called tune_init_pins.