Adding the callback makes this code much more flexible; I needed it to control the power of an LED in sync with the playback of music; I think others will like this feature. It is possible the playFrequency should be called at the end of a play() or for a pause with a frequency of 0 to terminate the song; I did not add this callback; but it would make the end of a song more consistent. The example illustrates the idea.
Thanks for the very useful functionality to start from.
Adding the callback makes this code much more flexible; I needed it to control the power of an LED in sync with the playback of music; I think others will like this feature. It is possible the playFrequency should be called at the end of a play() or for a pause with a frequency of 0 to terminate the song; I did not add this callback; but it would make the end of a song more consistent. The example illustrates the idea.
Thanks for the very useful functionality to start from.