Are you getting any volume like that? 5V thru a 4.7K resistor, that only leaves 1mA to go thru a speaker. If you have an 8 ohm speaker, that's only .008 milliWatts. Not sure that'd even be audible.Are you actually driving a speaker? Or are you going into an amplifier?If you were driving an 8 ohm speaker directly, you'd need a 120 ohm resistor in series to keep from blowing the output pin. 40mA & 8 ohm speaker is 12.8mW.What you could do is filter a PWM output, use that to drive a Voltage Controlled Amplifier, run the tone output thru that to a speaker amplifier.Let me see if I can look one up.
This one looks good toohttp://www.analog.com/en/digital-to-analog-converters/digital-potentiometers/ad8402/products/product.htmlPDIP for ease in prototyping also.
Alas, Dual Inline Package (DIP) availability is going away for many parts. Unless someone comes up with a line of really inexpensive breakout boards for the myriad of part types, the cost of prototyping will either rise with having to make custom board for any layout, or just become cumbersome with the one-size to accomodate many parts kind of breakout boards.
8402, DIP package, with TL072 opamp for output buffering, sounds like a good plan for driving earbuds or other high impedance (as compared to 8 ohm) drivers.
I am toying with the idea of making a 10" x 10" board of footprints for $95 here, cutting them up hacksaw and adding square posts for breadboard use as I go.https://www.internationalcircuits.com/layer_grid.php?cat_id=13