Changing output pins for the Talkie.h library

Hey, I've been working with the talkie.h library and am fairly inexperienced. Due to the reset of the circuit, the speaker that I am using is connected to a different digital pin on my nano rather than the pin 3 or pin 11 that the library uses by default, is there a way to attach the output to a different pin in the code? Any help would be great thanks.

You'd have to modify the library, but you'd sacrifice the functionality of other PWM pins.

It's easier to modify your connections.

Righto, I thought that might be the case any idea suggestions on how to edit the library. I'll have a look and see if I find anything and post back if I find a fix

Do NOT modify library code. It likely isn;t needed, and it is bad practice. IF it has a bug then use github to do a fork, fix it and submit it back to github for acceptance.

It's not a bug, its just for the project I am working on, due to the circuit board I am unable to connect the speaker to pin 3 or pin 11, it has to be pin 4.

Why not? That is where the PWM audio output appears, and you can't change those pins.

Please describe the real problem.

Note: an Arduino cannot directly drive a speaker. That will damage the output pin.

Not really. Talkie uses Timer 2, and its outputs are PD7(pin 3) and PB3(pin 11). Those outputs are fixed.

You could potentially move it to Timer 0, whose outputs are PD5 (pin 5) and PD6 (pin 6), but that would not be a trivial exercise. You'd sacrifice millis() for one thing.

None of the ATmega328's timers output to pin 4.

I found a mistake in my code which has resolved the issue. However I believe that I have found how to change the output pins in the library by assigning a pin output to the int in the attached image. Thanks for the help everyone. (If it wouldn't work feel free to let me know)
image

3 and 11 are the ONLY possibilities (for ATmega328 Arduinos).

It won't work. Read the library code and see for yourself. ALL the code.

Hello again everyone, I have just spent the last few days learning how to write and read a library. Through this I have found that by using the digitalWriteInvertedOutput(); function and the digitalWriteNonInvertedOutput(); function you are able to reassign the output pins to another digital pin. Granted this only works on Arduino nanos and unos on digital pins 3,5,6,9,10,11 because they have PWM compatibility. Also if you just need to disable an output you can use the doNoUseInvertedOutput(); or doNotUseNonInvertedOutput(); functions. I have now fix my initial problem that required these fixes, however if you have any questions feel free to reach out.

Misleading statement.

You can use only the digital pins that are assigned to the timer PWM outputs by the manufacturer.

He said that [quote="wgell08, post:11, topic:1395709"]
Granted this only works on Arduino nanos and unos on digital pins 3,5,6,9,10,11 because they have PWM compatibility.
[/quote]

One cannot "reassign the output pins" on AVR processors, only choose them.

On more modern MCUs, it is possible to reassign output pins using the hardware abstraction layer.