New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume Control Behaviour #99

Closed
hackel opened this Issue Oct 23, 2017 · 61 comments

Comments

Projects
None yet
5 participants
@hackel

hackel commented Oct 23, 2017

One thing I've noticed with PulseEffects 3+ under Ubuntu 17.10 (Gnome Shell) is that, when I activate PE, it changes which output device my system volume control (hotkeys or the volume slider in the gnome-shell menu) responds to. Normally, it controls the "Built-in Audio Analogue Stereo" hardware device. When I enable PE, the volume control switches over to the "PulseEffects(apps)" virtual device, which is set at 100%. Changing this volume causes a very noticeable static sound each time, and there's no way to turn the volume up above 100%. In pavucontrol, I can see that "PulseEffects(apps)" is set as the "fallback" device. If I change this back to "Built-in Audio Analogue Stereo", then audio continues playing through PE, but my volume controls the hardware device as expected.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Oct 23, 2017

Owner

This is very strange. There is no code in PulseEffects that would set it as fallback device. I only read pulseaudio default device setting. I do not write anything to it.

I also use gnome (3.26) and I have media keys in my keyboard. Everything is fine here. Volume keys control the built-in analog device and not PulseEffects(apps). I am using Arch Linux.

What is the log printed by PulseEffects when this strange behaviour happens?

Owner

wwmm commented Oct 23, 2017

This is very strange. There is no code in PulseEffects that would set it as fallback device. I only read pulseaudio default device setting. I do not write anything to it.

I also use gnome (3.26) and I have media keys in my keyboard. Everything is fine here. Volume keys control the built-in analog device and not PulseEffects(apps). I am using Arch Linux.

What is the log printed by PulseEffects when this strange behaviour happens?

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Oct 23, 2017

Owner

Did you try to remove the files under ~/.config/pulse and restarting pulseaudio?

Owner

wwmm commented Oct 23, 2017

Did you try to remove the files under ~/.config/pulse and restarting pulseaudio?

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor

I also have an issue like this, both in PulseEffects and my script https://github.com/mikhailnov/dumacast
After Dumacast runs chromium-browser with special PULSE_SOURCE and PULSE_SINK environmental variables, further applications, launched in this desktop session, can be ran with the same PULSE_SINK / PULSE_SOURCE, but they are not set as default or session-wide ones
Sth similar happens after running PulseEffects, but I haven't explored this issue yet

Contributor

mikhailnov commented Nov 9, 2017

I also have an issue like this, both in PulseEffects and my script https://github.com/mikhailnov/dumacast
After Dumacast runs chromium-browser with special PULSE_SOURCE and PULSE_SINK environmental variables, further applications, launched in this desktop session, can be ran with the same PULSE_SINK / PULSE_SOURCE, but they are not set as default or session-wide ones
Sth similar happens after running PulseEffects, but I haven't explored this issue yet

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor

@wwmm please post your system-wide and user config of PulseAudio to compare it with the one in Ubuntu 17.10 (I developed Dumacast on and for Ubuntu 16.04 and do not remember such problems)

Contributor

mikhailnov commented Nov 9, 2017

@wwmm please post your system-wide and user config of PulseAudio to compare it with the one in Ubuntu 17.10 (I developed Dumacast on and for Ubuntu 16.04 and do not remember such problems)

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor

After I launch PulseEffects (Ubuntu 17.10) and enable it for, e.g., Chromium, I hear no sound:
deepinscreenshot_select-area_20171109053302
PulseEffects(mic) gets set as a fallback device:
deepinscreenshot_select-area_20171109053323

I click here:
deepinscreenshot_select-area_20171109053611
And then I here sound from Chromium again, PulseEffects's output device changes to the new pulseaudio fallback device automatically:
deepinscreenshot_select-area_20171109053703

Contributor

mikhailnov commented Nov 9, 2017

After I launch PulseEffects (Ubuntu 17.10) and enable it for, e.g., Chromium, I hear no sound:
deepinscreenshot_select-area_20171109053302
PulseEffects(mic) gets set as a fallback device:
deepinscreenshot_select-area_20171109053323

I click here:
deepinscreenshot_select-area_20171109053611
And then I here sound from Chromium again, PulseEffects's output device changes to the new pulseaudio fallback device automatically:
deepinscreenshot_select-area_20171109053703

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor
$ cat /etc/pulse/default.pa
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

### Make some devices default
#set-default-sink output
#set-default-source input

### Use hot-plugged devices like Bluetooth or USB automatically (LP: #1702794)
.ifexists module-switch-on-connect.so
load-module module-switch-on-connect
$ pulseaudio --version
pulseaudio 10.0
$ ls ~/.config/pulse
cookie  fb595fde254c46ae9aa68e0665046eb0-card-database.tdb  fb595fde254c46ae9aa68e0665046eb0-default-sink  fb595fde254c46ae9aa68e0665046eb0-default-source  fb595fde254c46ae9aa68e0665046eb0-device-volumes.tdb  fb595fde254c46ae9aa68e0665046eb0-stream-volumes.tdb
Contributor

mikhailnov commented Nov 9, 2017

$ cat /etc/pulse/default.pa
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

### Make some devices default
#set-default-sink output
#set-default-source input

### Use hot-plugged devices like Bluetooth or USB automatically (LP: #1702794)
.ifexists module-switch-on-connect.so
load-module module-switch-on-connect
$ pulseaudio --version
pulseaudio 10.0
$ ls ~/.config/pulse
cookie  fb595fde254c46ae9aa68e0665046eb0-card-database.tdb  fb595fde254c46ae9aa68e0665046eb0-default-sink  fb595fde254c46ae9aa68e0665046eb0-default-source  fb595fde254c46ae9aa68e0665046eb0-device-volumes.tdb  fb595fde254c46ae9aa68e0665046eb0-stream-volumes.tdb
@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor

The default configs of PulseAudio in Arch and Ubuntu 17.10 do not have any important differences (I thought that maybe some special options are enabled or disabled)
deepinscreenshot_chromium-browser_20171109055209

Contributor

mikhailnov commented Nov 9, 2017

The default configs of PulseAudio in Arch and Ubuntu 17.10 do not have any important differences (I thought that maybe some special options are enabled or disabled)
deepinscreenshot_chromium-browser_20171109055209

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor

I launch Dumacast https://github.com/mikhailnov/dumacast/blob/master/usr/bin/dumacast , it creates the sink null1, and PulseAudio thinks that it's a default output device, but my script does not make it default (lines 135-149)!
It looks like a Pulseaudio 10 bug.
deepinscreenshot_select-area_20171109055703

Contributor

mikhailnov commented Nov 9, 2017

I launch Dumacast https://github.com/mikhailnov/dumacast/blob/master/usr/bin/dumacast , it creates the sink null1, and PulseAudio thinks that it's a default output device, but my script does not make it default (lines 135-149)!
It looks like a Pulseaudio 10 bug.
deepinscreenshot_select-area_20171109055703

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Nov 9, 2017

Contributor

@wwmm it must be easy to downgrade PulseAudio to version 10 on Arch to try to reproduce this bug to make sure that Pulseaudio is to be blamed

Contributor

mikhailnov commented Nov 9, 2017

@wwmm it must be easy to downgrade PulseAudio to version 10 on Arch to try to reproduce this bug to make sure that Pulseaudio is to be blamed

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 9, 2017

Owner

Unfortunately it will not be so easy to downgrade Pulseaudio. I don't have the old version anymore in my cache.

In any case I used Pulseaudio 10 for a few months and I never saw any of the PulseEffects sinks becoming default devices automatically.

Owner

wwmm commented Nov 9, 2017

Unfortunately it will not be so easy to downgrade Pulseaudio. I don't have the old version anymore in my cache.

In any case I used Pulseaudio 10 for a few months and I never saw any of the PulseEffects sinks becoming default devices automatically.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 9, 2017

Owner
pulseaudio 11.1
wallace@wwmm ~/.config/pulse $ ls
767c0755fd35486daf42d8e1a6d41540-card-database.tdb  767c0755fd35486daf42d8e1a6d41540-default-source      767c0755fd35486daf42d8e1a6d41540-stream-volumes.tdb  daemon.conf
767c0755fd35486daf42d8e1a6d41540-default-sink       767c0755fd35486daf42d8e1a6d41540-device-volumes.tdb  cookie

daemon.conf

; daemonize = no
; fail = yes
; allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no

; high-priority = yes
; nice-level = -11

; realtime-scheduling = yes
; realtime-priority = 5

; exit-idle-time = 20
; scache-idle-time = 20

; dl-search-path = (depends on architecture)

; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa

; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0

resample-method = speex-float-5
avoid-resampling = true
enable-remixing = yes
remixing-use-all-sink-channels = yes
enable-lfe-remixing = yes
; lfe-crossover-freq = 0

flat-volumes = no
; flat-volumes = yes

; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000

; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
; default-sample-channels = 2
; default-channel-map = front-left,front-right

; default-fragments = 4
; default-fragment-size-msec = 25

; enable-deferred-volume = yes
; deferred-volume-safety-margin-usec = 8000
; deferred-volume-extra-delay-usec = 0
Owner

wwmm commented Nov 9, 2017

pulseaudio 11.1
wallace@wwmm ~/.config/pulse $ ls
767c0755fd35486daf42d8e1a6d41540-card-database.tdb  767c0755fd35486daf42d8e1a6d41540-default-source      767c0755fd35486daf42d8e1a6d41540-stream-volumes.tdb  daemon.conf
767c0755fd35486daf42d8e1a6d41540-default-sink       767c0755fd35486daf42d8e1a6d41540-device-volumes.tdb  cookie

daemon.conf

; daemonize = no
; fail = yes
; allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no

; high-priority = yes
; nice-level = -11

; realtime-scheduling = yes
; realtime-priority = 5

; exit-idle-time = 20
; scache-idle-time = 20

; dl-search-path = (depends on architecture)

; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa

; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0

resample-method = speex-float-5
avoid-resampling = true
enable-remixing = yes
remixing-use-all-sink-channels = yes
enable-lfe-remixing = yes
; lfe-crossover-freq = 0

flat-volumes = no
; flat-volumes = yes

; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000

; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
; default-sample-channels = 2
; default-channel-map = front-left,front-right

; default-fragments = 4
; default-fragment-size-msec = 25

; enable-deferred-volume = yes
; deferred-volume-safety-margin-usec = 8000
; deferred-volume-extra-delay-usec = 0
@hackel

This comment has been minimized.

Show comment
Hide comment
@hackel

hackel Nov 10, 2017

Sorry for the delay. I spent some time debugging this, and determined that it is being caused by the module-switch-on-connect module which, as of Ubuntu 17.10, is now activated by default. The purpose of this module is to "Use hot-plugged devices like Bluetooth or USB automatically." Apparently it is detecting the new PulseEffects virtual devices as real ones, and automatically switching to them.

I simply copied my /etc/pulse/default.pa into ~/.config/pulse and commented out the module and this appears to have solved the issue for me.

I would say that this is an Ubuntu bug, but might be worth adding to the FAQ.

hackel commented Nov 10, 2017

Sorry for the delay. I spent some time debugging this, and determined that it is being caused by the module-switch-on-connect module which, as of Ubuntu 17.10, is now activated by default. The purpose of this module is to "Use hot-plugged devices like Bluetooth or USB automatically." Apparently it is detecting the new PulseEffects virtual devices as real ones, and automatically switching to them.

I simply copied my /etc/pulse/default.pa into ~/.config/pulse and commented out the module and this appears to have solved the issue for me.

I would say that this is an Ubuntu bug, but might be worth adding to the FAQ.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 11, 2017

Owner

It is not only worth to be in the FAQ it has to be there. This explains lots of problems that users have reported over time that I was never able to reproduce. There is no way PulseEffects will work well with this module loaded.

As Arch Linux does not enable this module it never crossed my mind to think about it as cause for this kind of problem

Owner

wwmm commented Nov 11, 2017

It is not only worth to be in the FAQ it has to be there. This explains lots of problems that users have reported over time that I was never able to reproduce. There is no way PulseEffects will work well with this module loaded.

As Arch Linux does not enable this module it never crossed my mind to think about it as cause for this kind of problem

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 21, 2017

I have just packaged PulseEffects for Mageia and have a 'similar' although not identical issue.
First may I congratulate you on a much needed PulseAudio add-on!
When I have PE set up and running it's fine, however if I stop it and re-start it there is no output because the pavucontrol setting under 'Recording' is recreated and where there was 'Monitor of PE(apps)' it becomes 'Built-in Analogue Audio Stereo'. After replacing this and in some cases (depending on the source) switching the Applications switch in PE OFF and ON the original sound controlled by PE is restored.
I don't have module-switch-on-connect mentioned in /etc/pulse/default.pa and there is only a cookie in ~/.config/pulse. Any thoughts?

barjac commented Nov 21, 2017

I have just packaged PulseEffects for Mageia and have a 'similar' although not identical issue.
First may I congratulate you on a much needed PulseAudio add-on!
When I have PE set up and running it's fine, however if I stop it and re-start it there is no output because the pavucontrol setting under 'Recording' is recreated and where there was 'Monitor of PE(apps)' it becomes 'Built-in Analogue Audio Stereo'. After replacing this and in some cases (depending on the source) switching the Applications switch in PE OFF and ON the original sound controlled by PE is restored.
I don't have module-switch-on-connect mentioned in /etc/pulse/default.pa and there is only a cookie in ~/.config/pulse. Any thoughts?

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 21, 2017

Owner

Just to be sure could you run the command pactl list modules short and check if there is no line with module-switch-on-connect?

In any case something outside of PulseEffects is changing the device it should be recording from. Run PulseEffects in a terminal and post here its output when this problem happens. It may help to figure out what is happening

Owner

wwmm commented Nov 21, 2017

Just to be sure could you run the command pactl list modules short and check if there is no line with module-switch-on-connect?

In any case something outside of PulseEffects is changing the device it should be recording from. Run PulseEffects in a terminal and post here its output when this problem happens. It may help to figure out what is happening

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 22, 2017

The outputs requested are below.
I cannot get around the missing limiters despite having all the following BuildRequires: and run time Requires: in the package (some are probably not needed), maybe you could clarify these as the build notes don't differentiate between build and run deps.
Also in meson.build I have to patch out the following line:
gstbad = dependency('gstreamer-plugins-bad-1.0', version: '>= 1.12')
our package is gstreamer1.0-plugins-bad.
Even with
gstbad = dependency('gstreamer1.0-plugins-bad', version: '>= 1.12')
it still fails.

###############################################
BuildRequires: gstreamer1.0-ladspa >= 1.12
BuildRequires: gstreamer1.0-plugins-bad >= 1.12
BuildRequires: gstreamer1.0-plugins-good >= 1.12
BuildRequires: ladspa-devel
BuildRequires: ladspa-plugins-swh
BuildRequires: meson >= 0.43
BuildRequires: ninja
BuildRequires: pkgconfig(fftw3)
BuildRequires: pkgconfig(gstreamer-1.0) >= 1.12
BuildRequires: pkgconfig(gtk+-3.0) >= 3.18
BuildRequires: pkgconfig(libpulse)
BuildRequires: python3
BuildRequires: python3-cairo-devel
BuildRequires: python3-gobject3
BuildRequires: python3-numpy
BuildRequires: python3-scipy >= 1.0
BuildRequires: python3-setuptools
BuildRequires: python-gobject3-devel
BuildRequires: python-gobject-devel

Requires: gstreamer1.0-python >= 1.12
Requires: gstreamer1.0-ladspa >= 1.12
Requires: python3-numpy >= 1.13
Requires: python3-scipy >= 1.0
Requires: ladspa-plugins-swh

#######################################
[baz@jackodesktop ~]$ pactl list modules short
0 module-device-restore
1 module-stream-restore
2 module-card-restore
3 module-augment-properties
4 module-switch-on-port-available
5 module-udev-detect
6 module-alsa-card device_id="0" name="pci-0000_00_1b.0" card_name="alsa_card.pci-0000_00_1b.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"
7 module-bluetooth-policy
8 module-bluetooth-discover
9 module-bluez5-discover
10 module-esound-protocol-unix
11 module-native-protocol-unix
12 module-gconf
13 module-default-device-restore
14 module-rescue-streams
15 module-always-sink
16 module-intended-roles
17 module-suspend-on-idle
18 module-systemd-login
19 module-position-event-sounds
20 module-role-cork
21 module-filter-heuristics
22 module-filter-apply
23 module-x11-publish display=:0
24 module-device-manager do_routing=1

25 module-x11-xsmp display=:0 session_manager=local/jackodesktop:@/tmp/.ICE-unix/4155,unix/jackodesktop:/tmp/.ICE-unix/4155

##############################################

14:44:58.741 - PulseEffects - INFO - pulseaudio context started
14:44:58.747 - PulseEffects - INFO - connected to server: unix:/run/user/1000/pulse/native
14:44:58.752 - PulseEffects - INFO - server protocol version: 32
14:44:58.762 - PulseEffects - INFO - pulseaudio version: 10.0.0-1.1.mga6
14:44:58.762 - PulseEffects - INFO - default pulseaudio source: alsa_input.pci-0000_00_1b.0.analog-stereo
14:44:58.762 - PulseEffects - INFO - default pulseaudio sink: alsa_output.pci-0000_00_1b.0.analog-stereo
14:44:58.763 - PulseEffects - INFO - default pulseaudio sink audio format: s16le
14:44:58.763 - PulseEffects - INFO - default pulseaudio sink sampling rate: 44100 Hz. We will use the same rate.
14:44:58.773 - PulseEffects - INFO - default pulseaudio source audio format: s16le
14:44:58.773 - PulseEffects - INFO - default pulseaudio source sampling rate: 48000 Hz. We will use the same rate.
14:44:58.773 - PulseEffects - INFO - loading Pulseeffects applications sink...
14:44:58.774 - PulseEffects - INFO - sink owner module index: 52
14:44:58.775 - PulseEffects - INFO - Pulseeffects apps sink was successfully loaded
14:44:58.775 - PulseEffects - INFO - Pulseeffects apps sink index:27
14:44:58.775 - PulseEffects - INFO - Pulseeffects apps sink monitor name: PulseEffects_apps.monitor
14:44:58.775 - PulseEffects - INFO - loading Pulseeffects microphone output sink...
14:44:58.776 - PulseEffects - INFO - sink owner module index: 53
14:44:58.781 - PulseEffects - INFO - Pulseeffects mic sink was successfully loaded
14:44:58.781 - PulseEffects - INFO - Pulseeffects mic sink index:28
14:44:58.781 - PulseEffects - INFO - Pulseeffects mic sink monitor name: PulseEffects_mic.monitor
14:44:58.788 - PulseEffects - WARNING - Limiter plugin was not found. Disabling it!
14:44:58.789 - PulseEffects - WARNING - Compressor plugin was not found. Disabling it!
14:44:58.794 - PulseEffects - INFO - limiter plugin was enabled
14:44:58.794 - PulseEffects - INFO - compressor plugin was enabled
14:44:58.795 - PulseEffects - INFO - reverb plugin was enabled
14:44:58.795 - PulseEffects - INFO - highpass plugin was enabled
14:44:58.795 - PulseEffects - INFO - lowpass plugin was enabled
14:44:58.795 - PulseEffects - INFO - equalizer plugin was enabled
14:44:58.795 - PulseEffects - INFO - spectrum plugin was enabled
14:44:58.797 - PulseEffects - WARNING - Limiter plugin was not found. Disabling it!
14:44:58.797 - PulseEffects - INFO - apps: panorama plugin was enabled
14:44:58.797 - PulseEffects - INFO - apps: output plugin was enabled
14:44:58.799 - PulseEffects - WARNING - Limiter plugin was not found. Disabling it!
14:44:58.799 - PulseEffects - WARNING - Compressor plugin was not found. Disabling it!
14:44:58.802 - PulseEffects - INFO - limiter plugin was enabled
14:44:58.802 - PulseEffects - INFO - compressor plugin was enabled
14:44:58.803 - PulseEffects - INFO - reverb plugin was enabled
14:44:58.803 - PulseEffects - INFO - highpass plugin was enabled
14:44:58.803 - PulseEffects - INFO - lowpass plugin was enabled
14:44:58.803 - PulseEffects - INFO - equalizer plugin was enabled
14:44:58.803 - PulseEffects - INFO - spectrum plugin was enabled
14:44:58.885 - PulseEffects - INFO - apps: equalizer plugin was enabled
14:44:58.986 - PulseEffects - INFO - apps: spectrum plugin was enabled
14:44:58.987 - PulseEffects - INFO - mic: spectrum plugin was enabled
14:44:59.129 - PulseEffects - INFO - pipeline state: playing
14:44:59.136 - PulseEffects - INFO - pulsesrc latency-time [us]: 10000
14:44:59.136 - PulseEffects - INFO - pulsesrc buffer-time [us]: 100000

(pulseeffects:29037): Gtk-WARNING **: Negative content width -2 (allocation 0, extents 1x1) while allocating gadget (node block, owner GtkLevelBar)
14:44:59.149 - PulseEffects - INFO - pulsesink latency-time [us]: 10000
14:44:59.149 - PulseEffects - INFO - pulsesink buffer-time [us]: 100000
14:46:00.197 - PulseEffects - INFO - pipeline state: null
14:46:00.198 - PulseEffects - INFO - pipeline state: null
14:46:00.198 - PulseEffects - INFO - sinks unloaded
14:46:00.198 - PulseEffects - INFO - disconnecting pulseaudio context
14:46:00.198 - PulseEffects - INFO - pulseaudio context terminated
14:46:00.198 - PulseEffects - INFO - unferencing pulseaudio context object
14:46:00.198 - PulseEffects - INFO - stopping pulseaudio threaded main loop
14:46:00.198 - PulseEffects - INFO - freeing pulseaudio main loop object

barjac commented Nov 22, 2017

The outputs requested are below.
I cannot get around the missing limiters despite having all the following BuildRequires: and run time Requires: in the package (some are probably not needed), maybe you could clarify these as the build notes don't differentiate between build and run deps.
Also in meson.build I have to patch out the following line:
gstbad = dependency('gstreamer-plugins-bad-1.0', version: '>= 1.12')
our package is gstreamer1.0-plugins-bad.
Even with
gstbad = dependency('gstreamer1.0-plugins-bad', version: '>= 1.12')
it still fails.

###############################################
BuildRequires: gstreamer1.0-ladspa >= 1.12
BuildRequires: gstreamer1.0-plugins-bad >= 1.12
BuildRequires: gstreamer1.0-plugins-good >= 1.12
BuildRequires: ladspa-devel
BuildRequires: ladspa-plugins-swh
BuildRequires: meson >= 0.43
BuildRequires: ninja
BuildRequires: pkgconfig(fftw3)
BuildRequires: pkgconfig(gstreamer-1.0) >= 1.12
BuildRequires: pkgconfig(gtk+-3.0) >= 3.18
BuildRequires: pkgconfig(libpulse)
BuildRequires: python3
BuildRequires: python3-cairo-devel
BuildRequires: python3-gobject3
BuildRequires: python3-numpy
BuildRequires: python3-scipy >= 1.0
BuildRequires: python3-setuptools
BuildRequires: python-gobject3-devel
BuildRequires: python-gobject-devel

Requires: gstreamer1.0-python >= 1.12
Requires: gstreamer1.0-ladspa >= 1.12
Requires: python3-numpy >= 1.13
Requires: python3-scipy >= 1.0
Requires: ladspa-plugins-swh

#######################################
[baz@jackodesktop ~]$ pactl list modules short
0 module-device-restore
1 module-stream-restore
2 module-card-restore
3 module-augment-properties
4 module-switch-on-port-available
5 module-udev-detect
6 module-alsa-card device_id="0" name="pci-0000_00_1b.0" card_name="alsa_card.pci-0000_00_1b.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"
7 module-bluetooth-policy
8 module-bluetooth-discover
9 module-bluez5-discover
10 module-esound-protocol-unix
11 module-native-protocol-unix
12 module-gconf
13 module-default-device-restore
14 module-rescue-streams
15 module-always-sink
16 module-intended-roles
17 module-suspend-on-idle
18 module-systemd-login
19 module-position-event-sounds
20 module-role-cork
21 module-filter-heuristics
22 module-filter-apply
23 module-x11-publish display=:0
24 module-device-manager do_routing=1

25 module-x11-xsmp display=:0 session_manager=local/jackodesktop:@/tmp/.ICE-unix/4155,unix/jackodesktop:/tmp/.ICE-unix/4155

##############################################

14:44:58.741 - PulseEffects - INFO - pulseaudio context started
14:44:58.747 - PulseEffects - INFO - connected to server: unix:/run/user/1000/pulse/native
14:44:58.752 - PulseEffects - INFO - server protocol version: 32
14:44:58.762 - PulseEffects - INFO - pulseaudio version: 10.0.0-1.1.mga6
14:44:58.762 - PulseEffects - INFO - default pulseaudio source: alsa_input.pci-0000_00_1b.0.analog-stereo
14:44:58.762 - PulseEffects - INFO - default pulseaudio sink: alsa_output.pci-0000_00_1b.0.analog-stereo
14:44:58.763 - PulseEffects - INFO - default pulseaudio sink audio format: s16le
14:44:58.763 - PulseEffects - INFO - default pulseaudio sink sampling rate: 44100 Hz. We will use the same rate.
14:44:58.773 - PulseEffects - INFO - default pulseaudio source audio format: s16le
14:44:58.773 - PulseEffects - INFO - default pulseaudio source sampling rate: 48000 Hz. We will use the same rate.
14:44:58.773 - PulseEffects - INFO - loading Pulseeffects applications sink...
14:44:58.774 - PulseEffects - INFO - sink owner module index: 52
14:44:58.775 - PulseEffects - INFO - Pulseeffects apps sink was successfully loaded
14:44:58.775 - PulseEffects - INFO - Pulseeffects apps sink index:27
14:44:58.775 - PulseEffects - INFO - Pulseeffects apps sink monitor name: PulseEffects_apps.monitor
14:44:58.775 - PulseEffects - INFO - loading Pulseeffects microphone output sink...
14:44:58.776 - PulseEffects - INFO - sink owner module index: 53
14:44:58.781 - PulseEffects - INFO - Pulseeffects mic sink was successfully loaded
14:44:58.781 - PulseEffects - INFO - Pulseeffects mic sink index:28
14:44:58.781 - PulseEffects - INFO - Pulseeffects mic sink monitor name: PulseEffects_mic.monitor
14:44:58.788 - PulseEffects - WARNING - Limiter plugin was not found. Disabling it!
14:44:58.789 - PulseEffects - WARNING - Compressor plugin was not found. Disabling it!
14:44:58.794 - PulseEffects - INFO - limiter plugin was enabled
14:44:58.794 - PulseEffects - INFO - compressor plugin was enabled
14:44:58.795 - PulseEffects - INFO - reverb plugin was enabled
14:44:58.795 - PulseEffects - INFO - highpass plugin was enabled
14:44:58.795 - PulseEffects - INFO - lowpass plugin was enabled
14:44:58.795 - PulseEffects - INFO - equalizer plugin was enabled
14:44:58.795 - PulseEffects - INFO - spectrum plugin was enabled
14:44:58.797 - PulseEffects - WARNING - Limiter plugin was not found. Disabling it!
14:44:58.797 - PulseEffects - INFO - apps: panorama plugin was enabled
14:44:58.797 - PulseEffects - INFO - apps: output plugin was enabled
14:44:58.799 - PulseEffects - WARNING - Limiter plugin was not found. Disabling it!
14:44:58.799 - PulseEffects - WARNING - Compressor plugin was not found. Disabling it!
14:44:58.802 - PulseEffects - INFO - limiter plugin was enabled
14:44:58.802 - PulseEffects - INFO - compressor plugin was enabled
14:44:58.803 - PulseEffects - INFO - reverb plugin was enabled
14:44:58.803 - PulseEffects - INFO - highpass plugin was enabled
14:44:58.803 - PulseEffects - INFO - lowpass plugin was enabled
14:44:58.803 - PulseEffects - INFO - equalizer plugin was enabled
14:44:58.803 - PulseEffects - INFO - spectrum plugin was enabled
14:44:58.885 - PulseEffects - INFO - apps: equalizer plugin was enabled
14:44:58.986 - PulseEffects - INFO - apps: spectrum plugin was enabled
14:44:58.987 - PulseEffects - INFO - mic: spectrum plugin was enabled
14:44:59.129 - PulseEffects - INFO - pipeline state: playing
14:44:59.136 - PulseEffects - INFO - pulsesrc latency-time [us]: 10000
14:44:59.136 - PulseEffects - INFO - pulsesrc buffer-time [us]: 100000

(pulseeffects:29037): Gtk-WARNING **: Negative content width -2 (allocation 0, extents 1x1) while allocating gadget (node block, owner GtkLevelBar)
14:44:59.149 - PulseEffects - INFO - pulsesink latency-time [us]: 10000
14:44:59.149 - PulseEffects - INFO - pulsesink buffer-time [us]: 100000
14:46:00.197 - PulseEffects - INFO - pipeline state: null
14:46:00.198 - PulseEffects - INFO - pipeline state: null
14:46:00.198 - PulseEffects - INFO - sinks unloaded
14:46:00.198 - PulseEffects - INFO - disconnecting pulseaudio context
14:46:00.198 - PulseEffects - INFO - pulseaudio context terminated
14:46:00.198 - PulseEffects - INFO - unferencing pulseaudio context object
14:46:00.198 - PulseEffects - INFO - stopping pulseaudio threaded main loop
14:46:00.198 - PulseEffects - INFO - freeing pulseaudio main loop object

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 22, 2017

I know nothing about meson, however I don't see any mention of ladspa in the build log or in meson.build so is it tested for?

barjac commented Nov 22, 2017

I know nothing about meson, however I don't see any mention of ladspa in the build log or in meson.build so is it tested for?

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 23, 2017

Owner

I did not understand the build requires lines. Are they being printed by meson? Here in Arch Linux the command meson _build has the following output:

The Meson build system
Version: 0.43.0
Source dir: /home/wallace/Documents/programas/python/pulseeffects
Build dir: /home/wallace/Documents/programas/python/pulseeffects/_build
Build type: native build
Project name: PulseEffects
Build machine cpu family: x86_64
Build machine cpu: x86_64
Message: Checking dependencies
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Native dependency libpulse found: YES 11.1
Native dependency gtk+-3.0 found: YES 3.22.26
Native dependency pygobject-3.0 found: YES 3.26.1
Native dependency py3cairo found: YES 1.15.4
Native dependency pangocairo found: YES 1.40.13
Native dependency gstreamer-1.0 found: YES 1.12.3
Native dependency gstreamer-plugins-bad-1.0 found: YES 1.12.3
Message: Getting python install path
Message: Installing PulseEffects
Configuring pulseeffects using configuration
Message: Installing data files
Program meson_post_install.py found: YES (/usr/bin/env python3 /home/wallace/Documents/programas/python/pulseeffects/meson_post_install.py)
Build targets in project: 5
Found ninja-1.8.2 at /usr/bin/ninja

@AsavarTzeth can tell you more about meson but what it is doing is using pkg-config to find dependencies. Run the command pkg-config --list-all | grep -i gst in your machine and see if you have gstreamer-plugins-bad-1.0 as one of the outputs. In case not you have to find out which package has the pkg-config files for gstreamer-plugin-bad.

Assuming you have installed the ladspa swh-plugins the errors about the limiter and the compressor are probably related to missing gstreamer-plugins-bad files. Check which package has the file /usr/lib/gstreamer-1.0/libgstladspa.so.

As far as I know there is nothing in the output of pkg-config --list-all related to ladspa. So meson will not be able to check if the plugins are available or not.

Owner

wwmm commented Nov 23, 2017

I did not understand the build requires lines. Are they being printed by meson? Here in Arch Linux the command meson _build has the following output:

The Meson build system
Version: 0.43.0
Source dir: /home/wallace/Documents/programas/python/pulseeffects
Build dir: /home/wallace/Documents/programas/python/pulseeffects/_build
Build type: native build
Project name: PulseEffects
Build machine cpu family: x86_64
Build machine cpu: x86_64
Message: Checking dependencies
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Native dependency libpulse found: YES 11.1
Native dependency gtk+-3.0 found: YES 3.22.26
Native dependency pygobject-3.0 found: YES 3.26.1
Native dependency py3cairo found: YES 1.15.4
Native dependency pangocairo found: YES 1.40.13
Native dependency gstreamer-1.0 found: YES 1.12.3
Native dependency gstreamer-plugins-bad-1.0 found: YES 1.12.3
Message: Getting python install path
Message: Installing PulseEffects
Configuring pulseeffects using configuration
Message: Installing data files
Program meson_post_install.py found: YES (/usr/bin/env python3 /home/wallace/Documents/programas/python/pulseeffects/meson_post_install.py)
Build targets in project: 5
Found ninja-1.8.2 at /usr/bin/ninja

@AsavarTzeth can tell you more about meson but what it is doing is using pkg-config to find dependencies. Run the command pkg-config --list-all | grep -i gst in your machine and see if you have gstreamer-plugins-bad-1.0 as one of the outputs. In case not you have to find out which package has the pkg-config files for gstreamer-plugin-bad.

Assuming you have installed the ladspa swh-plugins the errors about the limiter and the compressor are probably related to missing gstreamer-plugins-bad files. Check which package has the file /usr/lib/gstreamer-1.0/libgstladspa.so.

As far as I know there is nothing in the output of pkg-config --list-all related to ladspa. So meson will not be able to check if the plugins are available or not.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 23, 2017

Owner

I see nothing in PulseEffects log that could give a hint about the source of the problem :-( But if PulseEffects is recording from Built-in Analogue Audio Stereo instead of PulseEffects_apps.monitor there is no doubt this was made by an external process. But I do not have any idea yet of what could be doing this

Owner

wwmm commented Nov 23, 2017

I see nothing in PulseEffects log that could give a hint about the source of the problem :-( But if PulseEffects is recording from Built-in Analogue Audio Stereo instead of PulseEffects_apps.monitor there is no doubt this was made by an external process. But I do not have any idea yet of what could be doing this

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 23, 2017

Thanks, and sorry for the confusion.
To create an rpm package (which gets built in a chrooted minimal base-system) all the extra packages required for the build are specified in an rpm spec file. The list of BuildRequires: and Requires: I posted were from that, as I had it at that time.
None of the *-devel packages that include the headers and .pc (pkgconfig) files get onto my local machine, as they only get pulled into the build chroot.
The Requires: are what are needed on the final user's machine and are only in addition to the automatically generated autorequires that rpm lists in the final package.
I think this is the final list from my current rpm spec:
BuildRequires: meson
BuildRequires: pkgconfig(fftw3)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gstreamer-1.0) >= 1.12
BuildRequires: pkgconfig(gstreamer-bad-base-1.0) >= 1.12
BuildRequires: pkgconfig(libpulse) >= 11.0
BuildRequires: pkgconfig(py3cairo)
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(pygobject-3.0)
BuildRequires: python3-numpy-devel >= 1.13
BuildRequires: python3-scipy >= 1.0

Requires: python3-numpy >= 1.13
Requires: python3-scipy >= 1.0
Requires: gstreamer1.0-python >= 1.12
Requires: gstreamer1.0-ladspa >= 1.12
Requires: ladspa-plugins-swh >= 0.4

Could you please confirm that gstreamer-plugins-good is also required?
It gets pulled in by plasma5 on my system so I can't test easily without it.
Your build output was a great help and now I see the same after fixing some missing deps.

Regarding the recording source issue, I will try the approach used by hackel above and play with the enabled modules while trying to understand the docs :\

barjac commented Nov 23, 2017

Thanks, and sorry for the confusion.
To create an rpm package (which gets built in a chrooted minimal base-system) all the extra packages required for the build are specified in an rpm spec file. The list of BuildRequires: and Requires: I posted were from that, as I had it at that time.
None of the *-devel packages that include the headers and .pc (pkgconfig) files get onto my local machine, as they only get pulled into the build chroot.
The Requires: are what are needed on the final user's machine and are only in addition to the automatically generated autorequires that rpm lists in the final package.
I think this is the final list from my current rpm spec:
BuildRequires: meson
BuildRequires: pkgconfig(fftw3)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gstreamer-1.0) >= 1.12
BuildRequires: pkgconfig(gstreamer-bad-base-1.0) >= 1.12
BuildRequires: pkgconfig(libpulse) >= 11.0
BuildRequires: pkgconfig(py3cairo)
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(pygobject-3.0)
BuildRequires: python3-numpy-devel >= 1.13
BuildRequires: python3-scipy >= 1.0

Requires: python3-numpy >= 1.13
Requires: python3-scipy >= 1.0
Requires: gstreamer1.0-python >= 1.12
Requires: gstreamer1.0-ladspa >= 1.12
Requires: ladspa-plugins-swh >= 0.4

Could you please confirm that gstreamer-plugins-good is also required?
It gets pulled in by plasma5 on my system so I can't test easily without it.
Your build output was a great help and now I see the same after fixing some missing deps.

Regarding the recording source issue, I will try the approach used by hackel above and play with the enabled modules while trying to understand the docs :\

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 23, 2017

Owner

gstreamer-plugins-good is a dependency. The equalizer plugin is in this package for example

Something you may try is testing in a new user account and see if there is any change. This should remove user config out of the equation. But system wide configs or services will still take place.

Another test you could try is running in a different desktop like xfce or gnome and see if there is any difference. As I only use gnome it is possible that there is something specific to kde I am not aware of.

Owner

wwmm commented Nov 23, 2017

gstreamer-plugins-good is a dependency. The equalizer plugin is in this package for example

Something you may try is testing in a new user account and see if there is any change. This should remove user config out of the equation. But system wide configs or services will still take place.

Another test you could try is running in a different desktop like xfce or gnome and see if there is any difference. As I only use gnome it is possible that there is something specific to kde I am not aware of.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 23, 2017

Thanks - I thought so - I have added it.
I will try your suggestions, but in the meantime I put a query on #pulseaudio irc and had a debugging session which was very interesting. Here is the full text with some links to log files which you may find interesting.
You will see at the end that I ended up with it working correctly but have no idea why or what changed.
Hello - first time here. I wonder it anyone with good knowledge of PA could suggest what may cause the recording source (as shown under puvucontrol) to be re-set to 'Built-in Audio Analogue Stereo' when PulseEffects (python equalizer/limiter etc) is stopped and re-started? It should be 'PulseEffects(apps)'.
s/it/if/
barjac: On which tab do you see that the recording source is reset to built-in audio?
(Which tab of pavucontrol, that is.)
tanuk: It's under the Recording tab and on starting PE the entry PulseEffects recording from... says Built-in audio
Switching that to PE(apps) makes it work
..until next time
barjac: Can you pastebin the output of "pactl list"? I have trouble understanding the setup...
Yes - in what state - working or not?
Both would be nice.
tanuk: :) OK
Not working https://paste.ee/p/1HkuT
tanuk: Working (playing) https://paste.ee/p/Jh4WG
barjac: I don't know what PulseEffects does on restart. Can you pastebin "pactl list" before and after stopping PulseEffects (don't restart it).
tanuk: So you have the running one now I will just stop it and run pactl again?
Yes.
tanuk: https://paste.ee/p/WHdak
barjac: It seems that the PulseEffects_apps and PulseEffects_mic sinks are not removed when you stop PulseEffects. Maybe that confuses PulseEffects when you restart it?
The only difference between working and not working is that there's one less recording stream in PulseEffects, and I don't know why that stream is missing.
Correction: another difference is that the recording stream named "Record Stream" in PulseEffects is routed differently.
I don't know the reason for that either.
I'm guessing confusion in PulseEffects due to the already-existing sink PulseEffects_apps when restarting.
It's best to report the problem to the PulseEffects developers. I don't see evidence of bugs in PulseAudio.
tanuk: I see the same problem starting PE from fresh boot it always ends up with Built-in Audio in the recording tab.
What makes it work? Does it work only after you manually reroute the stream in pavucontrol?
There is a bug report with PE upstream that includes this and he says that it has to be external to PE but he's no idea what is causing it.
Yes I need to go into pavucontrol and the recording tab and select PE(apps) instead of the Built-in and it works instantly
Ok. My question to the PE developer would be: how do you configure the routing of the "Record stream" stream? Do you let PulseAudio to choose just something, or do you set some source explicitly when creating the stream?
tanuk: I guess I could paste this conversation into the bug report which is: #99 (comment)
If the stream must be routed to PulseEffects_apps.monitor, then that should be set explicitly when creating the stream instead of just hoping that PulseAudio will pick the right source.
Yes you could.
I joined the thread about 60% down same nick :)
If PulseEffects is configuring the source correctly, then apparently something is moving the stream. In that case the verbose PulseAudio server log is needed to figure out who is moving the stream.
tanuk: Where would I find the log?
Do you use ubuntu?
tanuk: No Mageia
The verbose log doesn't get generated by default. You'll need to run pulseaudio in a terminal, I can walk you through it.
tanuk: OK, I just packaged PE for the distro so would like to get to bottom of this ;)
Does "systemctl --user mask pulseaudio.service pulseaudio.socket" work without errors?
tanuk: Failed to connect to bus: No such file or directory
Is this a normal user session (not sudo or ssh)?
tanuk: Ah sorry as root
Created symlink /home/baz/.config/systemd/user/pulseaudio.service → /dev/null.
Created symlink /home/baz/.config/systemd/user/pulseaudio.socket → /dev/null.
Ok, good. Run "systemctl stop pulseaudio.service pulseaudio.socket"
tanuk: Auth required OK?
Oops, I meant "systemctl --user stop pulseaudio.service pulseaudio.socket"
OK no error
Then run "pulseaudio -vv" (logs go to terminal) or "pulseaudio -vv --log-target=newfile:/tmp/pulselog.txt" (logs go to that file).
Reproduce the problem (bad routing) and stop pulseaudio with ctrl-c.
To return back to normal, run "systemctl --user unmask pulseaudio.service pulseaudio.socket"
tanuk: OK I started PA then started PE and as the pb always happens on PE start, I stopped PA and...https://paste.ee/p/WN0Mq
barjac: The log doesn't show any source outputs getting created.
(source output = recording stream)
barjac: Maybe you need to run clementine before PulseEffects will do anything?
Or well, it does something (creates the null sinks), but it doesn't create any streams.
tanuk: Yes I saw that - I will do it again, but start clementine before starting PE
tanuk: Normally clementine appears in the PE dialog but it did not just now - I was going to turn it on in PE but it was not there
tanuk: https://paste.ee/p/L2v57
Now PulseEffects doesn't even create the null sinks... It does connect, though.
tanuk: That does not look right
tanuk: I think it crashed when PA stopped last time
tanuk: I found a process and killed it - trying again
tanuk: I don't beleive it! It actually ran with the debug output going - started correctly - never done that before!
tanuk: https://paste.ee/p/yCYHI
barjac: So now there's no bug to be observed...
tanuk: Yeah - just great! :
One thing that the log shows is that PulseEffects seems to be setting the source as it should.
tanuk: Except that the issue may be that the input times out if a stream is not actually present.
I don't follow...
tanuk: Just my simple logic - When I started PE without clem it created an input but then closed it if I understood the log?
https://paste.ee/p/WN0Mq doesn't show any streams getting created.
So PE didn't close anything, because it didn't open anything.
tanuk: It said "Hmm no stream present" and closed something
That's not related to PE.
When pulseaudio starts, the devices start in the "idle" state, and after 5 seconds they go to "suspended" state.
sink.c: Suspend cause of sink PulseEffects_apps is 0x0004, suspending
D: [pulseaudio] core.c: Hmm, no streams around, trying to vacuum.
I: [pulseaudio] main.c: Got signal SIGINT.
Nothing was playing to PulseEffects_apps, so the sink got suspended, and that triggered "vacuuming" since there were no streams around.
At no point was any stream created.
tanuk: OK - I think we are out of ideas then for now
Does the problem come back when you return to normalcy with "systemctl --user unmask pulseaudio.service pulseaudio.socket"?
tanuk: Di I need to restart service?
s/Di/Do/
It should restart automatically (that's what pulseaudio.socket is for - when an application tries to use the socket, the service gets started).
tanuk: It removed symlinks but it's not going AFAICT
clem on hitting play says Failed to connect: Connection refused
Hmm, ok, maybe "systemctl --user start pulseaudio.socket" is needed after unmasking.
tanuk: With --user?
Yes.
tanuk: Yes it's now working correctly - started clem hit play - launched PE and no problems /o
tanuk: Paused clem - stopped PE and restarted it and it;s still working
Ok, if it's now hard to reproduce, you could put "log-target = newfile:/tmp/pulselog.txt" and "log-level = debug" to /etc/pulse/daemon.conf and wait until the problem reappears.
There will be multiple /tmp/pulselog.txt.* files (one per started daemon).
tanuk: OK that's great I will do that in the mornig - many many thanks for your help tonight - I will let you know when I have any useful output. Cheers!
No problem :)

barjac commented Nov 23, 2017

Thanks - I thought so - I have added it.
I will try your suggestions, but in the meantime I put a query on #pulseaudio irc and had a debugging session which was very interesting. Here is the full text with some links to log files which you may find interesting.
You will see at the end that I ended up with it working correctly but have no idea why or what changed.
Hello - first time here. I wonder it anyone with good knowledge of PA could suggest what may cause the recording source (as shown under puvucontrol) to be re-set to 'Built-in Audio Analogue Stereo' when PulseEffects (python equalizer/limiter etc) is stopped and re-started? It should be 'PulseEffects(apps)'.
s/it/if/
barjac: On which tab do you see that the recording source is reset to built-in audio?
(Which tab of pavucontrol, that is.)
tanuk: It's under the Recording tab and on starting PE the entry PulseEffects recording from... says Built-in audio
Switching that to PE(apps) makes it work
..until next time
barjac: Can you pastebin the output of "pactl list"? I have trouble understanding the setup...
Yes - in what state - working or not?
Both would be nice.
tanuk: :) OK
Not working https://paste.ee/p/1HkuT
tanuk: Working (playing) https://paste.ee/p/Jh4WG
barjac: I don't know what PulseEffects does on restart. Can you pastebin "pactl list" before and after stopping PulseEffects (don't restart it).
tanuk: So you have the running one now I will just stop it and run pactl again?
Yes.
tanuk: https://paste.ee/p/WHdak
barjac: It seems that the PulseEffects_apps and PulseEffects_mic sinks are not removed when you stop PulseEffects. Maybe that confuses PulseEffects when you restart it?
The only difference between working and not working is that there's one less recording stream in PulseEffects, and I don't know why that stream is missing.
Correction: another difference is that the recording stream named "Record Stream" in PulseEffects is routed differently.
I don't know the reason for that either.
I'm guessing confusion in PulseEffects due to the already-existing sink PulseEffects_apps when restarting.
It's best to report the problem to the PulseEffects developers. I don't see evidence of bugs in PulseAudio.
tanuk: I see the same problem starting PE from fresh boot it always ends up with Built-in Audio in the recording tab.
What makes it work? Does it work only after you manually reroute the stream in pavucontrol?
There is a bug report with PE upstream that includes this and he says that it has to be external to PE but he's no idea what is causing it.
Yes I need to go into pavucontrol and the recording tab and select PE(apps) instead of the Built-in and it works instantly
Ok. My question to the PE developer would be: how do you configure the routing of the "Record stream" stream? Do you let PulseAudio to choose just something, or do you set some source explicitly when creating the stream?
tanuk: I guess I could paste this conversation into the bug report which is: #99 (comment)
If the stream must be routed to PulseEffects_apps.monitor, then that should be set explicitly when creating the stream instead of just hoping that PulseAudio will pick the right source.
Yes you could.
I joined the thread about 60% down same nick :)
If PulseEffects is configuring the source correctly, then apparently something is moving the stream. In that case the verbose PulseAudio server log is needed to figure out who is moving the stream.
tanuk: Where would I find the log?
Do you use ubuntu?
tanuk: No Mageia
The verbose log doesn't get generated by default. You'll need to run pulseaudio in a terminal, I can walk you through it.
tanuk: OK, I just packaged PE for the distro so would like to get to bottom of this ;)
Does "systemctl --user mask pulseaudio.service pulseaudio.socket" work without errors?
tanuk: Failed to connect to bus: No such file or directory
Is this a normal user session (not sudo or ssh)?
tanuk: Ah sorry as root
Created symlink /home/baz/.config/systemd/user/pulseaudio.service → /dev/null.
Created symlink /home/baz/.config/systemd/user/pulseaudio.socket → /dev/null.
Ok, good. Run "systemctl stop pulseaudio.service pulseaudio.socket"
tanuk: Auth required OK?
Oops, I meant "systemctl --user stop pulseaudio.service pulseaudio.socket"
OK no error
Then run "pulseaudio -vv" (logs go to terminal) or "pulseaudio -vv --log-target=newfile:/tmp/pulselog.txt" (logs go to that file).
Reproduce the problem (bad routing) and stop pulseaudio with ctrl-c.
To return back to normal, run "systemctl --user unmask pulseaudio.service pulseaudio.socket"
tanuk: OK I started PA then started PE and as the pb always happens on PE start, I stopped PA and...https://paste.ee/p/WN0Mq
barjac: The log doesn't show any source outputs getting created.
(source output = recording stream)
barjac: Maybe you need to run clementine before PulseEffects will do anything?
Or well, it does something (creates the null sinks), but it doesn't create any streams.
tanuk: Yes I saw that - I will do it again, but start clementine before starting PE
tanuk: Normally clementine appears in the PE dialog but it did not just now - I was going to turn it on in PE but it was not there
tanuk: https://paste.ee/p/L2v57
Now PulseEffects doesn't even create the null sinks... It does connect, though.
tanuk: That does not look right
tanuk: I think it crashed when PA stopped last time
tanuk: I found a process and killed it - trying again
tanuk: I don't beleive it! It actually ran with the debug output going - started correctly - never done that before!
tanuk: https://paste.ee/p/yCYHI
barjac: So now there's no bug to be observed...
tanuk: Yeah - just great! :
One thing that the log shows is that PulseEffects seems to be setting the source as it should.
tanuk: Except that the issue may be that the input times out if a stream is not actually present.
I don't follow...
tanuk: Just my simple logic - When I started PE without clem it created an input but then closed it if I understood the log?
https://paste.ee/p/WN0Mq doesn't show any streams getting created.
So PE didn't close anything, because it didn't open anything.
tanuk: It said "Hmm no stream present" and closed something
That's not related to PE.
When pulseaudio starts, the devices start in the "idle" state, and after 5 seconds they go to "suspended" state.
sink.c: Suspend cause of sink PulseEffects_apps is 0x0004, suspending
D: [pulseaudio] core.c: Hmm, no streams around, trying to vacuum.
I: [pulseaudio] main.c: Got signal SIGINT.
Nothing was playing to PulseEffects_apps, so the sink got suspended, and that triggered "vacuuming" since there were no streams around.
At no point was any stream created.
tanuk: OK - I think we are out of ideas then for now
Does the problem come back when you return to normalcy with "systemctl --user unmask pulseaudio.service pulseaudio.socket"?
tanuk: Di I need to restart service?
s/Di/Do/
It should restart automatically (that's what pulseaudio.socket is for - when an application tries to use the socket, the service gets started).
tanuk: It removed symlinks but it's not going AFAICT
clem on hitting play says Failed to connect: Connection refused
Hmm, ok, maybe "systemctl --user start pulseaudio.socket" is needed after unmasking.
tanuk: With --user?
Yes.
tanuk: Yes it's now working correctly - started clem hit play - launched PE and no problems /o
tanuk: Paused clem - stopped PE and restarted it and it;s still working
Ok, if it's now hard to reproduce, you could put "log-target = newfile:/tmp/pulselog.txt" and "log-level = debug" to /etc/pulse/daemon.conf and wait until the problem reappears.
There will be multiple /tmp/pulselog.txt.* files (one per started daemon).
tanuk: OK that's great I will do that in the mornig - many many thanks for your help tonight - I will let you know when I have any useful output. Cheers!
No problem :)

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 24, 2017

I just tried a 'clean' second user and the issue is there too, and on returning to my normal user that too is broken again, so whatever changed to fix it in the debugging session did not survive a log-in/out.
I will try to get some useful logs as suggested by tanuk.

barjac commented Nov 24, 2017

I just tried a 'clean' second user and the issue is there too, and on returning to my normal user that too is broken again, so whatever changed to fix it in the debugging session did not survive a log-in/out.
I will try to get some useful logs as suggested by tanuk.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 24, 2017

Owner

It is strange that there are sinks left once PE was closed. But this should not be a problem as I check if the sinks are already loaded and if yes I just use them.

I do not let Pulseaudio auto select source because this would not make sense in PE. The effects are being applied by a gstreamer pipeline that has a pulsesrc plugin recording from the PulseEffects_apps.monitor device. I am explicitly setting this using pulsesrc's method set_property like this set_property('device', 'PulseEffects_apps.monitor'). That is why I think that something external is changing the device. I have the correct one hardcoded.

Owner

wwmm commented Nov 24, 2017

It is strange that there are sinks left once PE was closed. But this should not be a problem as I check if the sinks are already loaded and if yes I just use them.

I do not let Pulseaudio auto select source because this would not make sense in PE. The effects are being applied by a gstreamer pipeline that has a pulsesrc plugin recording from the PulseEffects_apps.monitor device. I am explicitly setting this using pulsesrc's method set_property like this set_property('device', 'PulseEffects_apps.monitor'). That is why I think that something external is changing the device. I have the correct one hardcoded.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 24, 2017

Owner

I have just remembered that a user had a similar issue a long time ago like you can see here #1. At that time I asked him to run a test code that should mimic PulseEffects behavior. Try the following:

close PulseEffects and run:
pacmd load-module module-null-sink sink_name=test sink_properties=device.description=test

Put this code in a file test.py and run it:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst

import time

Gst.init(None)

class Test():

    def __init__(self):
        self.pipeline = self.build_pipeline()

        # Create bus to get events from GStreamer pipeline
        bus = self.pipeline.get_bus()
        bus.add_signal_watch()
        bus.connect('message', self.on_message)

        self.pipeline.set_state(Gst.State.PLAYING)
    def build_pipeline(self):
        pipeline = Gst.Pipeline()

        self.audio_src = Gst.ElementFactory.make('pulsesrc', 'audio_src')
        self.audio_sink = Gst.ElementFactory.make('pulsesink', 'audio_sink')

        self.audio_src.set_property('device', 'test.monitor')

        pipeline.add(self.audio_src)
        pipeline.add(self.audio_sink)

        self.audio_src.link(self.audio_sink)

        return pipeline
    def on_message(self, bus, msg):
        if msg.type == Gst.MessageType.ERROR:
            self.log.error(msg.parse_error())
            self.log.error(msg.parse_error_details())

t = Test()
time.sleep(60)

While the program is running open pavucontrol and see if it is recording from test.monitor device

To unload the null sink created for the test run pacmd unload-module module-null-sink

Owner

wwmm commented Nov 24, 2017

I have just remembered that a user had a similar issue a long time ago like you can see here #1. At that time I asked him to run a test code that should mimic PulseEffects behavior. Try the following:

close PulseEffects and run:
pacmd load-module module-null-sink sink_name=test sink_properties=device.description=test

Put this code in a file test.py and run it:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst

import time

Gst.init(None)

class Test():

    def __init__(self):
        self.pipeline = self.build_pipeline()

        # Create bus to get events from GStreamer pipeline
        bus = self.pipeline.get_bus()
        bus.add_signal_watch()
        bus.connect('message', self.on_message)

        self.pipeline.set_state(Gst.State.PLAYING)
    def build_pipeline(self):
        pipeline = Gst.Pipeline()

        self.audio_src = Gst.ElementFactory.make('pulsesrc', 'audio_src')
        self.audio_sink = Gst.ElementFactory.make('pulsesink', 'audio_sink')

        self.audio_src.set_property('device', 'test.monitor')

        pipeline.add(self.audio_src)
        pipeline.add(self.audio_sink)

        self.audio_src.link(self.audio_sink)

        return pipeline
    def on_message(self, bus, msg):
        if msg.type == Gst.MessageType.ERROR:
            self.log.error(msg.parse_error())
            self.log.error(msg.parse_error_details())

t = Test()
time.sleep(60)

While the program is running open pavucontrol and see if it is recording from test.monitor device

To unload the null sink created for the test run pacmd unload-module module-null-sink

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 24, 2017

Owner

At least for that user the test code was also recording from the wrong device despite of the line self.audio_src.set_property('device', 'test.monitor') telling gstreamer which was the correct device.

At the time this user tried to open a bug report in gstreamer https://bugzilla.gnome.org/show_bug.cgi?id=783464 but as he did not know how to do it properly things did not go further. And as I never could reproduce this issue in any of my machines I should not be the one taking this bug report forward.

Owner

wwmm commented Nov 24, 2017

At least for that user the test code was also recording from the wrong device despite of the line self.audio_src.set_property('device', 'test.monitor') telling gstreamer which was the correct device.

At the time this user tried to open a bug report in gstreamer https://bugzilla.gnome.org/show_bug.cgi?id=783464 but as he did not know how to do it properly things did not go further. And as I never could reproduce this issue in any of my machines I should not be the one taking this bug report forward.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 24, 2017

Running test.py the Recording tab shows 'Built-in Analogue Audio Stereo' selected, and 'Monitor of test' is available as an option.
Under the Playback tab 'Built-in Analogue Audio Stereo', is selected and 'test' is available as an option.
So I can reproduce the issue with your test.py.
My wording of the options that puvucontrol shows is exactly as above, i.e. 'Monitor of test' and just 'test'.
I have added a request on a Mageia ML for anyone running Cauldron with different DEs to test PE and report any issues.
Shall I set up debug logging on PA and run this again so that tanuk can take a look?

barjac commented Nov 24, 2017

Running test.py the Recording tab shows 'Built-in Analogue Audio Stereo' selected, and 'Monitor of test' is available as an option.
Under the Playback tab 'Built-in Analogue Audio Stereo', is selected and 'test' is available as an option.
So I can reproduce the issue with your test.py.
My wording of the options that puvucontrol shows is exactly as above, i.e. 'Monitor of test' and just 'test'.
I have added a request on a Mageia ML for anyone running Cauldron with different DEs to test PE and report any issues.
Shall I set up debug logging on PA and run this again so that tanuk can take a look?

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 24, 2017

Owner

If possible show him the test code. It should help him figure out why some installations are obeying the set device properties and others are not.

He probably can also tell if this is something that should be investigated by gstreamer developers instead of pulseaudio developers.

Owner

wwmm commented Nov 24, 2017

If possible show him the test code. It should help him figure out why some installations are obeying the set device properties and others are not.

He probably can also tell if this is something that should be investigated by gstreamer developers instead of pulseaudio developers.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 24, 2017

I asked him to look here and sent PA debug logs of a case where test.py works and one where it fails which are here for your reference:
Works (after running several tests):
http://mtf.no-ip.co.uk/pub/linux/barjac/tests/pulselog.txt.9
Fails after reboot:
http://mtf.no-ip.co.uk/pub/linux/barjac/tests/pulselog.txt
Hope that helps.
I already got a reply from a tester who seems to be hitting the same issue. "as soon as you start it it grabs audio stream from Clementine, and you cant seem to get it to then send output back to speakers"
So it's not just me :)
I asked him to look in pavucontrol and report back. Not sure yet which DE he is using.

barjac commented Nov 24, 2017

I asked him to look here and sent PA debug logs of a case where test.py works and one where it fails which are here for your reference:
Works (after running several tests):
http://mtf.no-ip.co.uk/pub/linux/barjac/tests/pulselog.txt.9
Fails after reboot:
http://mtf.no-ip.co.uk/pub/linux/barjac/tests/pulselog.txt
Hope that helps.
I already got a reply from a tester who seems to be hitting the same issue. "as soon as you start it it grabs audio stream from Clementine, and you cant seem to get it to then send output back to speakers"
So it's not just me :)
I asked him to look in pavucontrol and report back. Not sure yet which DE he is using.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 25, 2017

Owner

The links are not working

Owner

wwmm commented Nov 25, 2017

The links are not working

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 25, 2017

Hi - tanuk created a large patch for PA that creates more detailed debugging output. The link below is from running puseaudio-11.1 patched with the extra debugging, during a run of test.py where the wrong recording source was shown in pavucontrol.
http://mtf.no-ip.co.uk/pub/linux/barjac/tests/pulselog_extra.txt

barjac commented Nov 25, 2017

Hi - tanuk created a large patch for PA that creates more detailed debugging output. The link below is from running puseaudio-11.1 patched with the extra debugging, during a run of test.py where the wrong recording source was shown in pavucontrol.
http://mtf.no-ip.co.uk/pub/linux/barjac/tests/pulselog_extra.txt

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

This log is quite helpful although the source of the problem is still a mystery. I will detail here what I have found. First we have:

D: [pulseaudio] module-suspend-on-idle.c: Sink test becomes busy, resuming.

This means that something was using the test sink and because of that the sink was busy again. After that we have:

I: [pulseaudio] source-output.c: Created output 2 "Record Stream" on test.monitor with sample spec s16le 2ch 44100Hz and channel map front-left,front-right

This output 2 called Record Stream is the test code. So it is clear that it was the one making the sink busy. Everything seems fine but then for some reason I do not understand the test code was moved to another sink:

D: [pulseaudio] module-device-manager.c: Moving source output 2 "Record Stream" to source alsa_input.pci-0000_00_1b.0.analog-stereo
D: [pulseaudio] module-suspend-on-idle.c: Sink test becomes busy, resuming.
D: [pulseaudio] module-device-manager.c: Moving source output 2 "Record Stream" to source alsa_input.pci-0000_00_1b.0.analog-stereo.
D: [pulseaudio] module-suspend-on-idle.c: Sink test becomes idle, timeout in 5 seconds.
D: [pulseaudio] source-output.c: Starting to move source output 2 from 'test.monitor'
D: [pulseaudio] source-output.c: Successfully moved source output 2 to alsa_input.pci-0000_00_1b.0.analog-stereo.

Now we have to understanding why the test code is being moved from the correct device. Did you run the test code with pulseeffects opened or closed? It should not be a problem but it is best to limit the number of variables

Owner

wwmm commented Nov 26, 2017

This log is quite helpful although the source of the problem is still a mystery. I will detail here what I have found. First we have:

D: [pulseaudio] module-suspend-on-idle.c: Sink test becomes busy, resuming.

This means that something was using the test sink and because of that the sink was busy again. After that we have:

I: [pulseaudio] source-output.c: Created output 2 "Record Stream" on test.monitor with sample spec s16le 2ch 44100Hz and channel map front-left,front-right

This output 2 called Record Stream is the test code. So it is clear that it was the one making the sink busy. Everything seems fine but then for some reason I do not understand the test code was moved to another sink:

D: [pulseaudio] module-device-manager.c: Moving source output 2 "Record Stream" to source alsa_input.pci-0000_00_1b.0.analog-stereo
D: [pulseaudio] module-suspend-on-idle.c: Sink test becomes busy, resuming.
D: [pulseaudio] module-device-manager.c: Moving source output 2 "Record Stream" to source alsa_input.pci-0000_00_1b.0.analog-stereo.
D: [pulseaudio] module-suspend-on-idle.c: Sink test becomes idle, timeout in 5 seconds.
D: [pulseaudio] source-output.c: Starting to move source output 2 from 'test.monitor'
D: [pulseaudio] source-output.c: Successfully moved source output 2 to alsa_input.pci-0000_00_1b.0.analog-stereo.

Now we have to understanding why the test code is being moved from the correct device. Did you run the test code with pulseeffects opened or closed? It should not be a problem but it is best to limit the number of variables

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

I ran the test code with pulseeffects opened and it is not a problem. I see test.monitor in pavucontrol as the device being recorded. So PulseEffects should not be the one moving the test code to the wrong device in your machine

Owner

wwmm commented Nov 26, 2017

I ran the test code with pulseeffects opened and it is not a problem. I see test.monitor in pavucontrol as the device being recorded. So PulseEffects should not be the one moving the test code to the wrong device in your machine

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

I am wondering if this could be somehow related to kde phonon. I haven't used kde in a while But I remember it was possible to set default devices for playback and recording in phonon. Maybe he is the one moving recording applications to alsa_input.pci-0000_00_1b.0.analog-stereo

Owner

wwmm commented Nov 26, 2017

I am wondering if this could be somehow related to kde phonon. I haven't used kde in a while But I remember it was possible to set default devices for playback and recording in phonon. Maybe he is the one moving recording applications to alsa_input.pci-0000_00_1b.0.analog-stereo

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 26, 2017

Yes - I think so.
I bit the bullet and installed Mate DE alongside plasma5 and PE is performing flawlessly under Mate.
In plasma5 I looked at the phonon settings in systemsettings5 while Clementine and PE were working correctly, and it is possible to prioritize devices for different types of applications. Under the 'Playback' settings there is PE shown as an option and it can be moved up in priority, however under 'Recording' there was no sign of PE, despite it playing and in use., so I'm a bit lost.
All the above was in a new user, but Mate performs the same under my regular user, in fact I get the feeling that it's better than under plasma5 (levels seem to be less random). Unless that is an improvement in PA 11.1 which I switched to when I re-built PA with the extra debugging patch.

Regarding "Did you run the test code with pulseeffects opened or closed?" I'm not sure what you mean. I rebooted, loaded module-null-sink, started PE, started test.py, opened pavucontrol and checked that the recording source was not PE, allowed test.py to time out and copied the log over, before shutting down PE.
I did not switch on the test.py application under the Applications menu in PE during this if that was what you meant.

barjac commented Nov 26, 2017

Yes - I think so.
I bit the bullet and installed Mate DE alongside plasma5 and PE is performing flawlessly under Mate.
In plasma5 I looked at the phonon settings in systemsettings5 while Clementine and PE were working correctly, and it is possible to prioritize devices for different types of applications. Under the 'Playback' settings there is PE shown as an option and it can be moved up in priority, however under 'Recording' there was no sign of PE, despite it playing and in use., so I'm a bit lost.
All the above was in a new user, but Mate performs the same under my regular user, in fact I get the feeling that it's better than under plasma5 (levels seem to be less random). Unless that is an improvement in PA 11.1 which I switched to when I re-built PA with the extra debugging patch.

Regarding "Did you run the test code with pulseeffects opened or closed?" I'm not sure what you mean. I rebooted, loaded module-null-sink, started PE, started test.py, opened pavucontrol and checked that the recording source was not PE, allowed test.py to time out and copied the log over, before shutting down PE.
I did not switch on the test.py application under the Applications menu in PE during this if that was what you meant.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 26, 2017

/OT
Under Mate - I notice that if Clementine stream is stopped and started it re-appears back under Applications in PE but it is switched off - that's a bit inconvenient, is there a workaround to have it default to ON?

barjac commented Nov 26, 2017

/OT
Under Mate - I notice that if Clementine stream is stopped and started it re-appears back under Applications in PE but it is switched off - that's a bit inconvenient, is there a workaround to have it default to ON?

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

I asked if PE was running just to rule it out as possible cause of the moving. But it is clear now that something is odd in phonon. What is quite sad.

It makes sense that PE is not shown as a recording source in phonon. After all PE is not a source but it is a sink where apps can play sound. What I think it is happening is that phonon is automatically moving all recording apps to the default source. As PE applies effects using a gstreamer pipeline that should be recording from our null sink monitor and not from the system default source phonon is breaking us. I am not sure how we can fix this in kde. Maybe it would be good to contact a kde developer.

Clementine is probably recreating its stream. This will make the sink input related to it to also be recreated and in the end the behavior is the same as having a new app. Run PulseEffects in service mode that it will automatically switch on when the main window is closed.

Owner

wwmm commented Nov 26, 2017

I asked if PE was running just to rule it out as possible cause of the moving. But it is clear now that something is odd in phonon. What is quite sad.

It makes sense that PE is not shown as a recording source in phonon. After all PE is not a source but it is a sink where apps can play sound. What I think it is happening is that phonon is automatically moving all recording apps to the default source. As PE applies effects using a gstreamer pipeline that should be recording from our null sink monitor and not from the system default source phonon is breaking us. I am not sure how we can fix this in kde. Maybe it would be good to contact a kde developer.

Clementine is probably recreating its stream. This will make the sink input related to it to also be recreated and in the end the behavior is the same as having a new app. Run PulseEffects in service mode that it will automatically switch on when the main window is closed.

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

I will install clementine here and take a look at its behavior

Owner

wwmm commented Nov 26, 2017

I will install clementine here and take a look at its behavior

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

Here clementine is kept switched on when I click stop and play again after it has disappeared from PE window. No need to run in service mode. Which clementine version are you using? I have 1.3.1 and it is working fine

Owner

wwmm commented Nov 26, 2017

Here clementine is kept switched on when I click stop and play again after it has disappeared from PE window. No need to run in service mode. Which clementine version are you using? I have 1.3.1 and it is working fine

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

I forgot to tell you how to run in service mode https://github.com/wwmm/pulseeffects/wiki/Command-Line-Options. But at least here no need to use that. Clementine is fine

Owner

wwmm commented Nov 26, 2017

I forgot to tell you how to run in service mode https://github.com/wwmm/pulseeffects/wiki/Command-Line-Options. But at least here no need to use that. Clementine is fine

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 26, 2017

Owner

Pulseaudio is supposed to remember the last sink used by audio applications. As long as PulseEffects null sinks are kept loaded between applications restarts they will be switched on automatically. So what may be happening in you setup is that pulseaudio is not remembering the last used sink as it should be

Owner

wwmm commented Nov 26, 2017

Pulseaudio is supposed to remember the last sink used by audio applications. As long as PulseEffects null sinks are kept loaded between applications restarts they will be switched on automatically. So what may be happening in you setup is that pulseaudio is not remembering the last used sink as it should be

@tanuk

This comment has been minimized.

Show comment
Hide comment
@tanuk

tanuk Nov 26, 2017

This is a bug in PulseAudio, in module-device-manager. The reason why this doesn't happen on non-KDE systems is that module-device-manager is only loaded when using KDE (see /usr/bin/start-pulseaudio-x11).

When an application requests a specific device when creating a stream, module-device-manager will let the application use that device initially, but it doesn't remember that the stream had "special" routing that shouldn't be changed. There are many situations where module-device-manager will check the stream routing and move streams if their routing doesn't match what module-device-manager thinks the routing should be.

An extra bit of information should be added to the internal stream state: "this stream is routed according to the application's request". When that bit is set, module-device-manager should refrain from moving the stream. If the stream is moved for any reason (e.g. requested by user), then that bit should be cleared, since the initial routing isn't relevant any more.

tanuk commented Nov 26, 2017

This is a bug in PulseAudio, in module-device-manager. The reason why this doesn't happen on non-KDE systems is that module-device-manager is only loaded when using KDE (see /usr/bin/start-pulseaudio-x11).

When an application requests a specific device when creating a stream, module-device-manager will let the application use that device initially, but it doesn't remember that the stream had "special" routing that shouldn't be changed. There are many situations where module-device-manager will check the stream routing and move streams if their routing doesn't match what module-device-manager thinks the routing should be.

An extra bit of information should be added to the internal stream state: "this stream is routed according to the application's request". When that bit is set, module-device-manager should refrain from moving the stream. If the stream is moved for any reason (e.g. requested by user), then that bit should be cleared, since the initial routing isn't relevant any more.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 26, 2017

I can confirm that with the relevant line removed from /usr/bin/start-pulseaudio-x11 it is now behaving the same in plasma5 as in Mate.
Running as a service does fix the Stop/Start problem also.

barjac commented Nov 26, 2017

I can confirm that with the relevant line removed from /usr/bin/start-pulseaudio-x11 it is now behaving the same in plasma5 as in Mate.
Running as a service does fix the Stop/Start problem also.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 27, 2017

@tanuk
Is there an existing PA bug report for this?
What is the next step to resolving this issue?
I wonder why only KDE/Plasma feel it necessary to use module-device-manager?

barjac commented Nov 27, 2017

@tanuk
Is there an existing PA bug report for this?
What is the next step to resolving this issue?
I wonder why only KDE/Plasma feel it necessary to use module-device-manager?

@tanuk

This comment has been minimized.

Show comment
Hide comment
@tanuk

tanuk Nov 28, 2017

I submitted patches for fixing the PulseAudio bug: https://patchwork.freedesktop.org/series/34558/

I haven't tested the patches, can you do that?

The reason why KDE uses module-device-manager is that its UI for configuring audio device priorities depends on that module.

tanuk commented Nov 28, 2017

I submitted patches for fixing the PulseAudio bug: https://patchwork.freedesktop.org/series/34558/

I haven't tested the patches, can you do that?

The reason why KDE uses module-device-manager is that its UI for configuring audio device priorities depends on that module.

@tanuk

This comment has been minimized.

Show comment
Hide comment
@tanuk

tanuk Nov 28, 2017

I forgot that I should have rebased the patches on the 11.1 release. Here are the patches rebased: https://cgit.freedesktop.org/~tanuk/pulseaudio/log/?h=device-manager-fix

I'll also send the patches to @barjac like I did with the logging patch.

tanuk commented Nov 28, 2017

I forgot that I should have rebased the patches on the 11.1 release. Here are the patches rebased: https://cgit.freedesktop.org/~tanuk/pulseaudio/log/?h=device-manager-fix

I'll also send the patches to @barjac like I did with the logging patch.

@barjac

This comment has been minimized.

Show comment
Hide comment
@barjac

barjac Nov 28, 2017

Brilliant, stupendous, fantastic!
I rebuilt pulseaudio package with your new patches and also the extra_debugging (in case it was required).
I removed the change I made to /usr/bin/start-pulseaudio-x11, updated the package on my system running plasma5 and it's all working perfectly - much kudos to you :)
I also tested in Mate and see no regressions. I ran several audio generating apps simultaneously and all seems just perfect.
@wwmm I checked that stopping and starting applications worked correctly, and it does when running in daemon mode with the GUI closed as you suggested. Happy day!

barjac commented Nov 28, 2017

Brilliant, stupendous, fantastic!
I rebuilt pulseaudio package with your new patches and also the extra_debugging (in case it was required).
I removed the change I made to /usr/bin/start-pulseaudio-x11, updated the package on my system running plasma5 and it's all working perfectly - much kudos to you :)
I also tested in Mate and see no regressions. I ran several audio generating apps simultaneously and all seems just perfect.
@wwmm I checked that stopping and starting applications worked correctly, and it does when running in daemon mode with the GUI closed as you suggested. Happy day!

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Nov 28, 2017

Owner

Ok. I think that tanuk patches to module-device-manager and Georg patches to module-switch-on-connect fix the problems discussed in this issue. I will close it. Thank you for your help tanuk :-)

Owner

wwmm commented Nov 28, 2017

Ok. I think that tanuk patches to module-device-manager and Georg patches to module-switch-on-connect fix the problems discussed in this issue. I will close it. Thank you for your help tanuk :-)

@wwmm wwmm closed this Nov 28, 2017

fdo-mirror pushed a commit to freedesktop/pulseaudio that referenced this issue Dec 2, 2017

device-manager: don't override application routing requests
module-device-manager doesn't change the routing of those streams that
have been explicitly routed by the user, which is good. Similarly, it
should leave those streams alone whose routing was decided by the
application that created the stream. This patch implements that.

BugLink: wwmm/pulseeffects#99
@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Jan 20, 2018

Contributor

What is the status of upstream changes in PulseAudio to properly handle the problem with virtual sinks and module-switch-on-connect?

Contributor

mikhailnov commented Jan 20, 2018

What is the status of upstream changes in PulseAudio to properly handle the problem with virtual sinks and module-switch-on-connect?

@wwmm

This comment has been minimized.

Show comment
Hide comment
@wwmm

wwmm Jan 21, 2018

Owner

Pulseaudio git repository has the fixes for the modules module-switch-on-connect and module-device-manager:

pulseaudio/pulseaudio@e083357
pulseaudio/pulseaudio@d6a0dcc
pulseaudio/pulseaudio@3d698d1

I imagine that the next Pulseaudio version will have them

Owner

wwmm commented Jan 21, 2018

Pulseaudio git repository has the fixes for the modules module-switch-on-connect and module-device-manager:

pulseaudio/pulseaudio@e083357
pulseaudio/pulseaudio@d6a0dcc
pulseaudio/pulseaudio@3d698d1

I imagine that the next Pulseaudio version will have them

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Jan 21, 2018

Contributor

Thanks for the information.

Contributor

mikhailnov commented Jan 21, 2018

Thanks for the information.

@mikhailnov

This comment has been minimized.

Show comment
Hide comment
@mikhailnov

mikhailnov Jun 29, 2018

Contributor

I confirm it's fixed in PulseAudio 12.0

If you want to try PulseAudio 12.0 instead of Ubuntu's 11.1, use ppa:mikhailnov/desktop1-dev

sudo add-apt-repository ppa:mikhailnov/desktop1-dev
sudo apt dist-upgrade

In this testing PPA:

  • calf-plugins 0.90.0 is also built
  • PulseAudio is built with Ubuntu's patches for default configs, but patches for Apparmor and snappy were removed, so sound in snap applications may not work
  • PulseEffects is built with libpulse 12.0, not 11.1, and so is supposed to be used with PulseAudio 12
  • I may not continue maintaining ppa:mikhailnov/desktop1-dev, please use it carefully
Contributor

mikhailnov commented Jun 29, 2018

I confirm it's fixed in PulseAudio 12.0

If you want to try PulseAudio 12.0 instead of Ubuntu's 11.1, use ppa:mikhailnov/desktop1-dev

sudo add-apt-repository ppa:mikhailnov/desktop1-dev
sudo apt dist-upgrade

In this testing PPA:

  • calf-plugins 0.90.0 is also built
  • PulseAudio is built with Ubuntu's patches for default configs, but patches for Apparmor and snappy were removed, so sound in snap applications may not work
  • PulseEffects is built with libpulse 12.0, not 11.1, and so is supposed to be used with PulseAudio 12
  • I may not continue maintaining ppa:mikhailnov/desktop1-dev, please use it carefully
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment