dakrk / manatools

Collection of tools for Dreamcast audio and music formats
GNU General Public License v3.0
6 stars 0 forks source link

mpbgui: playing tone data can cut off beginning and end #4

Closed dakrk closed 3 months ago

dakrk commented 3 months ago

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.)