hydrogen-music / hydrogen

The advanced drum machine for Linux, macOS, and Windows
http://www.hydrogen-music.org
GNU General Public License v2.0
1.07k stars 172 forks source link

Support further audio formats (#2023) #2034

Closed theGreatWhiteShark closed 1 month ago

theGreatWhiteShark commented 2 months ago

Turns out we already support a lot more audio formats via the library libsndfile we use to reading them, like mp3 and Opus encoded Ogg files. We just needed to add the appropriate file filters in AudioFileBrowser.

Song export was overhauled too to support all these new formats and expose the compression level for FLAC and formats based on lossy compression. Instead of WAV, FLAC is now the new default format selected on first opening. The different WAV and AIFF options in the template combo box were dropped and replaced by a format combo box exposing only the available formats. The previous setup was outdated. In case someone really want to export to WAV that persons most probably do not want to do so with reduced sample rate and depth. For more concise files FLAC or lossy compression will be used.

About failure of full test on Windows

For reasons not yet clear to me, the full test fails on Windows with a "bad alloc" exception. Checking the memory required by the test process one can see that virtual memory is constantly increasing and physical one looks like an irregular saw pattern. The process is quite hungry for memory and at times the OS frees it. Though, at some point memory consumption seems to get too big and something in the stack get's killed.

memory_consumption The upper figure shows the export of a WAV file with 16 bit depth and 48kHz over and over again. The lower figure shows the same export but in addition waits 5 seconds between each export (giving the OS time to free memory.) For both trials the exceptions occurs at roughly the same point.

But the behavior above does not seem to be related to the audio export code. At least, virtual memory consumption also increases linear when running the whole XmlTest suite instead of the audio export and other platforms do not show this issue. Therefore, I would consider this "solved" for now.

implements #2023