After using ArdVoice, tunes does not work anymore [Solved]


Is that a known issue?


does not play anything else even if I reinitialize the audio again after using:


1 Like

Are you trying to use the ArduboyPlaytune and ArdVoice libraries in the same sketch? If so, there may be a problem when both libraries try to use the same speaker output pins in different modes.

1 Like

I see, thanks.

Do you know any quick hack to reinitialize ArduboyPlaytune?

1 Like

Doing a closeChannels() then calling initChannel() again for each pin should reinitialise ArduboyPlaytune. If that doesn’t work then it’s possible that the ArdVoice interrupt service routine is interfering.

Maybe the problem is that ArdVoice is putting the speaker pins in PWM mode, which prevents ArduboyPlaytune toggling them as normal output pins.

If reinitialising ArduboyPlaytune, as I described above, doesn’t work you could try:

Before using ArduboyPlaytune functions do:

TCCR4A = 0; // disable PWM on speaker pins

Before using ArdVoice functions do:

TCCR4A = bit(COM4A0) | bit(PWM4A); // enable PWM on speaker pins 
1 Like

Awesome!!! thanks a lot! Works perfect :smiley:

1 Like

What worked? Reinitialising ArduboyPlaytune, disable/enable PWM, or both?

1 Like

The PWM part :smiley: works perfectly

1 Like