muse-sequencer / muse

MusE is a digital audio workstation with support for both Audio and MIDI
https://muse-sequencer.github.io/
Other
645 stars 69 forks source link

Hangs when closing with JACK setup, not when RtAudio setup #1078

Open Oscar65 opened 2 years ago

Oscar65 commented 2 years ago

MusE 4.1 hangs when closing application and is setup with JACK (not hangs when is setup with RtAudio or jackd is not running).

Steps to reproduce the behavior:

  1. Activate JACK on qjackctl or cadence
  2. Run muse4 from terminal.
  3. Close muse4.
  4. muse4 hangs and does not return to $ prompt from console.

muse4 must close the application and return to $ prompt from console.

System information:

*** Build info ***
LV2 support:        Enabled
DSSI support:       Enabled
Native VST support: Enabled (using VESTIGE compatibility layer)

*** Runtime information ***
Running audio driver:   JackAudioDevice
Sample rate:        48000
Segment size:   1024
Segment count:  2

*** Timer ***
Type:       AlsaTimer
Frequency:      300

*** Miscellaneous ***
debugMode:      false
midInputTrace:  false
midiOutputTrace:    false
unityWorkaround:    false
debugMsg:       false
heavyDebugMsg:  false
debugSync:      false
loadPlugins:        true
loadMESS:       true
loadVST:        true
loadNativeVST:  true
loadDSSI:       true
usePythonBridge:    false
useLASH:        true
loadLV2:        true
useAlsaWithJack:    false
noAutoStartJack:    false
populateMidiPortsOnStart:   true
realtimeScheduling: true
midiRTPrioOverride: true
realtimePriority:   5
midiSeqRunning: true
automation:     true

jack version:

$ jackd --version
jackdmp version 1.9.21 tmpdir /dev/shm protocol 9
$
 - OS: 5.18.13-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 22 Jul 2022 13:05:04 +0000 x86_64 GNU/Linux
 - Desktop: Gnome, KDE and OpenBox.

Reaper neither Waveform12 neither Waveform11 have this issue.

GNOME_console_output.log

terminator356 commented 2 years ago

Hello. Run muse with the -D option for more detailed debug output, post if possible.

The log shows some peculiar errors: ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave etc.

Curious, is it possible you are using a custom ALSA configuration file? I can't remember the exact name, I think it is alsa.conf somewhere in your home directory. It's the place where for example two sound cards can be custom combined using ALSA's dmix and so on. Or is Cadence running in the background or something? It just seems a bit odd that pcm_dmix is being called although it may just be normal courtesy calls.

If you are indeed custom combining two cards, try to run just one, say by choosing a specific card in QJackCtl.

Sometimes these errors turn out to be a system setup problem or conflicts between MusE and other apps.

Thanks. T.

Oscar65 commented 2 years ago

Hi

I haven't any alsa.conf file in my home directory:

$ find . -iname alsa.conf 
$

cadece is runnig in background, I have he same issue with qjackctl.

This is my sound card's configuration:

$ sudo lshw -C sound
  *-multimedia              
       description: Audio device
       product: GK208 HDMI/DP Audio Controller
       vendor: NVIDIA Corporation
       physical id: 0.1
       bus info: pci@0000:09:00.1
       version: a1
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list
       configuration: driver=snd_hda_intel latency=0
       resources: irq:147 memory:fc080000-fc083fff
  *-multimedia
       description: Audio device
       product: Starship/Matisse HD Audio Controller
       vendor: Advanced Micro Devices, Inc. [AMD]
       physical id: 0.4
       bus info: pci@0000:0b:00.4
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: pm pciexpress msi bus_master cap_list
       configuration: driver=snd_hda_intel latency=0
       resources: irq:149 memory:fcc00000-fcc07fff
$

and this is my .asoundrc:

$ cat .asoundrc
pcm.!default {
    type plug
    slave { pcm "pulse" }
}

pcm.pulse {
    type pulse
}

ctl.mixer1 {
    type hw
    card 1
}
$

aplay -l:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALCS1200A Analog [ALCS1200A Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALCS1200A Digital [ALCS1200A Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
$

muse4_logwith-d_parameter.log

terminator356 commented 2 years ago

Thanks, yes asoundrc that's what I meant, sorry. Was that put there by the system or by you? (Is it in your home directory?)

So we have the message: MusE: Exiting JackAudio but not the very next line's message which should be: MusE: Exiting DummyAudio and so on.

So it is getting stuck in MusECore::exitJackAudio(). But... We don't do anything special in there. Just deactivate the client, then close the client, then destroy the JackAudioDevice instance. All normal stuff.

Hm... Sounds like it could be a system problem, maybe Cadence is interfering? Often Pulse working with Jack can be a problem, sometimes causing freezing etc. DBus as well.

If your goal was to simply make Pulse work with Jack, there is a trick that works quite well. Here is a script that you might want to try instead of using asoundrc, it works flawlessly for me. It tells you on-screen that the Pulse driver is using Jack, then tells you it is returning to Pulse when Jack is stopped. DBus is enabled as well:

https://github.com/brummer10/pajackconnect

You install the file 'pajackconnect' and add these lines in QJackCtl:

Execute script after startup: /home/user/bin/pajackconnect start & Execute script on shutdown: /home/user/bin/pajackconnect stop & Execute script after shutdown: /home/user/bin/pajackconnect reset &

It works very nicely.

Hope that helps. T.

terminator356 commented 1 year ago

Hi, are you still having trouble with that? Hope you solved it...

Oscar65 commented 1 year ago

Hi,

No. It's solved.

Very thanks, Oscar

domichel commented 1 year ago

I get the same issue on gentoo. Muse start fine with both jack and rtaudio, but hangg with jack wheen I close it. Close work fine with rtaudio: ` $ muse4 -> 13:29:16.054 Read configuration... Config File </home/dom/.config/MusE/MusE/MusE-seq.cfg> LOCALE fr_CH -> 13:29:16.060 Load theme... Config File </usr/share/muse-4.1/themes/Dark Flat.cfc> -> 13:29:16.465 Scan plugins... -> 13:29:16.806 Init audio... open projectfile: Aucun fichier ou dossier de ce type Denormal protection enabled. Select audio device from configuration : 3 User RtAudio backend - backend selected through configuration: RtAudio ALSA Init RtAudioDevice Using rtAudio -> 13:29:17.334 Init MIDI... Trying RTC timer... fatal error: open /dev/rtc failed: Permission non accordée Trying ALSA timer... AlsaTimer::initTimer(): best available ALSA timer: HR timer got timer = 25 -> 13:29:17.690 Init plugins... -> 13:29:17.692 Init VST plugins... -> 13:29:17.693 Init native VST plugins... -> 13:29:17.693 Init DSSI plugins... -> 13:29:17.693 Init LV2 plugins... -> 13:29:18.093 Init OSC / metronome... -> 13:29:18.186 Populating Track context menu... -> 13:29:18.189 Show GUI...

RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:2,0), Périphérique ou ressource occupé.

RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:2,0), Périphérique ou ressource occupé.

RtAudio alsa: running realtime scheduling

RtApiAlsa::probeDeviceOpen: unable to synchronize input and output devices.

INFO: Requested timer frequency:1024 actual:1000 Acquired timer frequency: 1000 -> 13:29:19.623 Load default project starting with template /usr/share/muse-4.1/templates/default.med register output port [Out 1-0] length 7 char 0 register output port [Out 1-1] length 7 char 1

RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:2,0), Périphérique ou ressource occupé.

RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:2,0), Périphérique ou ressource occupé.

RtAudio alsa: running realtime scheduling

RtApiAlsa::probeDeviceOpen: unable to synchronize input and output devices.

INFO: Requested timer frequency:1024 actual:1000 -> 13:29:26.983 Start application loop... Total start-up time: 11063 ms unknown NRT Msg 0x01 dump 4 7e 7f 09 01`

domichel commented 1 year ago

But with jack, muse4 just hang and I must hit Ctrl+C at the console it was started: $ muse4 -> 13:34:05.783 Read configuration... Config File </home/dom/.config/MusE/MusE/MusE-seq.cfg> LOCALE fr_CH -> 13:34:05.788 Load theme... Config File </usr/share/muse-4.1/themes/Dark Flat.cfc> -> 13:34:06.008 Scan plugins... -> 13:34:06.472 Init audio... open projectfile: Aucun fichier ou dossier de ce type Denormal protection enabled. Select audio device from configuration : 0 User JackAudio backend - backend selected through configuration MusE:initJackAudio: jack_get_version() returned zeros. Setting version major to 1. Using Jack -> 13:34:06.960 Init MIDI... -> 13:34:07.262 Init plugins... -> 13:34:07.264 Init VST plugins... -> 13:34:07.264 Init native VST plugins... -> 13:34:07.264 Init DSSI plugins... -> 13:34:07.264 Init LV2 plugins... -> 13:34:07.538 Init OSC / metronome... -> 13:34:07.664 Populating Track context menu... -> 13:34:07.676 Show GUI... JACK: buffersize changed 1024 -> 13:34:08.385 Load default project starting with template /usr/share/muse-4.1/templates/default.med jack connect <MusE:jack-midi-0_out> - <alsa_pcm:Virtual-Raw-MIDI-3-0/midi_capture_1> failed with err:17 jack connect <alsa_pcm:Virtual-Raw-MIDI-3-0/midi_playback_1> - <MusE:jack-midi-0_in> failed with err:17 jack connect <MusE:jack-midi-1_out> - <alsa_pcm:Virtual-Raw-MIDI-3-1/midi_capture_1> failed with err:17 jack connect <alsa_pcm:Virtual-Raw-MIDI-3-1/midi_playback_1> - <MusE:jack-midi-1_in> failed with err:17 jack connect <MusE:jack-midi-2_out> - <alsa_pcm:Virtual-Raw-MIDI-3-2/midi_capture_1> failed with err:17 jack connect <alsa_pcm:Virtual-Raw-MIDI-3-2/midi_playback_1> - <MusE:jack-midi-2_in> failed with err:17 jack connect <MusE:jack-midi-3_out> - <alsa_pcm:Virtual-Raw-MIDI-3-3/midi_capture_1> failed with err:17 jack connect <alsa_pcm:Virtual-Raw-MIDI-3-3/midi_playback_1> - <MusE:jack-midi-3_in> failed with err:17 jack connect <MusE:jack-midi-4_out> - <a2j:Midi Through [14] (playback): Midi Through Port-0> failed with err:17 jack connect <a2j:Midi Through [14] (capture): Midi Through Port-0> - <MusE:jack-midi-4_in> failed with err:17 jack connect <MusE:jack-midi-5_out> - <a2j:Virtual Raw MIDI 3-0 [28] (playback): VirMIDI 3-0> failed with err:17 jack connect <a2j:Virtual Raw MIDI 3-0 [28] (capture): VirMIDI 3-0> - <MusE:jack-midi-5_in> failed with err:17 jack connect <MusE:jack-midi-6_out> - <a2j:Virtual Raw MIDI 3-1 [29] (playback): VirMIDI 3-1> failed with err:17 jack connect <a2j:Virtual Raw MIDI 3-1 [29] (capture): VirMIDI 3-1> - <MusE:jack-midi-6_in> failed with err:17 jack connect <MusE:jack-midi-7_out> - <a2j:Virtual Raw MIDI 3-2 [30] (playback): VirMIDI 3-2> failed with err:17 jack connect <a2j:Virtual Raw MIDI 3-2 [30] (capture): VirMIDI 3-2> - <MusE:jack-midi-7_in> failed with err:17 jack connect <MusE:jack-midi-8_out> - <a2j:Virtual Raw MIDI 3-3 [31] (playback): VirMIDI 3-3> failed with err:17 jack connect <a2j:Virtual Raw MIDI 3-3 [31] (capture): VirMIDI 3-3> - <MusE:jack-midi-8_in> failed with err:17 jack connect <MusE:jack-midi-9_out> - <alsa_pcm:CH345/midi_capture_1> failed with err:17 jack connect <alsa_pcm:CH345/midi_playback_1> - <MusE:jack-midi-9_in> failed with err:17 jack connect <MusE:jack-midi-10_out> - <a2j:CH345 [32] (playback): CH345 MIDI 1> failed with err:17 jack connect <a2j:CH345 [32] (capture): CH345 MIDI 1> - <MusE:jack-midi-10_in> failed with err:17 jack connect <MusE:jack-midi-11_out> - <alsa_pcm:Midi-Through/midi_capture_1> failed with err:17 jack connect <alsa_pcm:Midi-Through/midi_playback_1> - <MusE:jack-midi-11_in> failed with err:17 MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! MidiJackDevice::queueEvent() evTime:2336088371 < syncFrame:2336089088!! -> 13:34:12.671 Start application loop... Total start-up time: 7033 ms unknown NRT Msg 0x01 dump 4 7e 7f 09 01 unknown NRT Msg 0x01 dump 4 7e 7f 09 01 unknown NRT Msg 0x01 dump 4 7e 7f 09 01 unknown NRT Msg 0x01 dump 4 7e 7f 09 01 unknown NRT Msg 0x01 dump 4 7e 7f 09 01 unknown NRT Msg 0x01 dump 4 7e 7f 09 01

domichel commented 1 year ago

With the -D option, the output is too long to be pasted here. It is into that file: muse4.txt

domichel commented 1 year ago

And yes, I have a ~/.asoundrc file:

$ cat .asoundrc
pcm.!default {
    type plug
    slave.pcm "jack";
}

ctl.!default {
    type hw card 0
}

pcm.jack {
    type jack
    playback_ports {
    0 system:playback_1
    1 system:playback_2
    }
    capture_ports {
    0 system:capture_1
    1 system:capture_2
    }
}
ctl.mixer0 {
    type hw
    card 0
}
domichel commented 1 year ago
$ cat /etc/modprobe.d/alsa.conf
# Alsa kernel modules' configuration file.

# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##  ALSA portion
alias snd-card-0 snd-aloop
alias snd-card-1 snd-intel
alias snd-card-2 snd-intel
alias snd-card-3 virmidi
alias snd-card-4 snd-usb-audio
##  OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3
alias sound-slot-4 snd-card-4
##

options snd-aloop index=0
# for the model option, see the output of 'lspci -s ... -n'##
options snd-hda-intel index=1 model=8086:1c20
options snd-hda-intel index=2 model=10de:0bea
options snd-virmidi index=3
options snd-usb-audio index=4

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
##  OSS/Free portion - card #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
##  OSS/Free portion - card #3
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
##  OSS/Free portion - card #4
alias sound-service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcm-oss
alias sound-service-3-12 snd-pcm-oss
##  OSS/Free portion - card #5
alias sound-service-4-0 snd-mixer-oss
alias sound-service-4-3 snd-pcm-oss# IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
alias sound-service-4-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.
options snd cards_limit=4
domichel commented 1 year ago

These 2 files are configuraation files I have from years on several computers with a few differences. The main advantages I get using them is than the ALSA only software will use the default ALSA card and it just work transparently when jackd is running. That way, I don't need pulse. Also, I get a consistent sound card order which let me script things in a reliable manner. That imply than, frrom my pov, it is an issue that must be solved into muse.

domichel commented 1 year ago

I get hit by that issue with both muse-4.1 and git. I don't know for older recent versions, because the last time I used muse was with the 2.1.1 version, but it was working fine with jack at that time.