This is really dependent on platform and audio setup, but PortAudio seems to be cutting off the beginning and primarily end of audio played.
At least on ALSA on Linux (because PortAudio only implemented a PulseAudio backend last year and hasn't had a stable release in 3 years), this can sometimes be observed by changing the frames per buffer in TonePlayer.cpp from paFramesPerBufferUnspecified to varying values. The higher the frames per buffer, the more audio it truncates.
This could be "resolved" by just starting and ending the audio data with about 20ms of silence. (I could try just using another audio library, but PortAudio is the most commonly used and packaged on Linux distributions meaning most people will already have it, and Qt Multimedia would mean shoving about 15MB of FFmpeg libraries into Windows bundles.)
This is really dependent on platform and audio setup, but PortAudio seems to be cutting off the beginning and primarily end of audio played.
At least on ALSA on Linux (because PortAudio only implemented a PulseAudio backend last year and hasn't had a stable release in 3 years), this can sometimes be observed by changing the frames per buffer in TonePlayer.cpp from
paFramesPerBufferUnspecified
to varying values. The higher the frames per buffer, the more audio it truncates.This could be "resolved" by just starting and ending the audio data with about 20ms of silence. (I could try just using another audio library, but PortAudio is the most commonly used and packaged on Linux distributions meaning most people will already have it, and Qt Multimedia would mean shoving about 15MB of FFmpeg libraries into Windows bundles.)