LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.16k stars 1.01k forks source link

Freeze on export using PortAudio backend #5919

Open HardwareHaquer opened 3 years ago

HardwareHaquer commented 3 years ago

Searching through the Issues I found a similar problem listed in Linux with JACK, but as this is a different OS and backend I thought I should make a report.

Bug Summary

When exporting a wav file with PortAudio as the backend the export will complete to 95% and then LMMS will hang forever. Have to force quit. However, the wav file successfully exports, yay!

Steps to reproduce

  1. Choose PortAudio as the Audio interface. 2. Export as WAV with default settings.

Expected behavior

No crash on Export

Actual behavior

Crash

Screenshot

Affected LMMS versions

LMMS 1.2.2

Logs

Click to expand: Last two lines of log not sure if the first is involved.

QMetaMethod::invoke: Unable to handle unregistered datatype 'MidiTime'
PortAudio error: Stream is not stopped
ExperiBass commented 3 years ago

wait wasnt MidiTime renamed in #5684? @M374LX, you might wanna look at this

ExperiBass commented 3 years ago

Successfully reproduced using 1.14 build on 1.14.6, will compile latest master later to see if its still there

ExperiBass commented 3 years ago

Reproduced on latest master (89fc6c960). Logs below

Input device: 'Streaming' backend: 'Core Audio'
Output device: 'Streaming' backend: 'Core Audio'
PERFLOG |       Project Render | 0.10user, 0.06system 0.07elapsed
PortAudio error: Stream is not stopped
M374LX commented 3 years ago

As 1.2.2 was released before MidiTime was renamed to TimePos, it does not seem to be related.

I have had no success in trying to reproduce the problem on the latest master on Linux. Was it reproduced only on OSX?

ExperiBass commented 3 years ago

yes, i havent had a issue on Mint.

jimstutt commented 2 years ago

I'm not using portaudio but hit a similar or the possibly the same bug. Export .wav or .mp3 (haven't tried .ogg) exports successfully but hangs LMMS and forces quit. I tried it with loops marked and the "export between loop markers" box ticked with the same result.

lmms --version: LMMS 1.2.2 (Linux x86_64, Qt 5.12.8, GCC 9.3.0)

jackd --version: jackdmp version 1.9.12 tmpdir /dev/shm protocol 8 jim@jim-HP-Pavilion-Laptop-14-bk0xx:~$

pasuspender -- \ jackd -d alsa --device hw:0 --rate 44100 --period 128 \ &>/tmp/jackd.out &

pulseaudio --version: pulseaudio 13.99.1

lsb_release:

Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

ExperiBass commented 2 years ago

@jimstutt could you try building the latest master version? If not I'll build and package for you

jimstutt commented 2 years ago

@ExperiBass tnx for the offer to build the latest version. I'll certainly test it if you do and notify me. Sorry I haven't got the mileage to do it myself atm.

ExperiBass commented 2 years ago

@jimstutt i wasnt able to build the appimage (im assuming its cause im not using ubuntu), so youll have to download the zip, extract it, cd into it, and then run ./lmms. https://mega.nz/file/kVtGVKiY#kbF5vzfdSyXiKdLpaC9sV8RfFqdcggpXZnH7-DJQWvk

jimstutt commented 2 years ago

Did that but: I renamed build LMMS but: "./lmms ./lmms: error while loading shared libraries: libsoundio.so.2: cannot open shared object file: No such file or directory" ~/Dev/LMMS$ ./lmms Searched for libsoundio on ubuntu on askubuntu, stackexchange but nfu. Seems ubuntu's only got so.1 ~/Dev/LMMS$ ldconfig -p | grep libsoundio libsoundio.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libsoundio.so.1 Is there an obvious fix by tweaking some file in the download?

ExperiBass commented 2 years ago

ah i see, im using arch so my packages are a bit newer. Let me re-compile in my Mint VM, sorry bout that!

ExperiBass commented 2 years ago

or not. i cant seem to get it to build a appimage or work outside of my vm...

luzpaz commented 1 year ago

Is this still relevant ?

ExperiBass commented 1 year ago

doesn't seem so, i just built gc53f3d981 on macOS 13.4, exporting worked fine.

luzpaz commented 1 year ago

Close issue please

zonkmachine commented 1 year ago

I'm tagging this as possible macos as I've been bumped on the topic. (Now unsubscribing... ;-)

tresf commented 1 year ago

No, this bug is not fixed and seems to have been incorrectly closed in https://github.com/LMMS/lmms/issues/4864. It also occurs for other formats. Title updated.

PERFLOG |       Project Render | 0.06user, 0.14system 0.07elapsed
PortAudio error: Stream is not stopped

image image

I'm not sure if this is still valid or even related, but I found a possible explanation from 14 years ago:

I also noticed the same behavior when I was using DirectSound through PortAudio a few months ago, the implementation is sort of broken when it comes to stopping the stream properly. I solved it by inserting x milliseconds of silence after my actual audio was meant to stop, x being the set delay for the device which in my case was 50 milliseconds. So in short, when I wanted to stop it smoothly I wrote the 50 milliseconds silence to my ring buffer and then set a flag that made the callback return paComplete, and then waited for the stream not to be active. Since the stream stops a little before all data has been played, this made the stream stop almost exactly after the real data had finished without crackling since there was just silence there.

I hope this rant made some kind of sense.