Bug 97352 - Very low volume with jack sink
Summary: Very low volume with jack sink
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: modules (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-15 12:31 UTC by trondsg+bugzilla+freedesktop
Modified: 2018-07-30 10:08 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
initial problem case - solved (34.67 KB, text/plain)
2016-08-17 10:57 UTC, trondsg+bugzilla+freedesktop
Details
standard setup with less clear sound (35.07 KB, text/plain)
2016-08-17 10:59 UTC, trondsg+bugzilla+freedesktop
Details
jack on and full volume - better sound (all these are pactl list outputs) (39.59 KB, text/plain)
2016-08-17 10:59 UTC, trondsg+bugzilla+freedesktop
Details
pulseaudio_stream_volume_not_preserved.txt (291.14 KB, text/plain)
2016-08-28 11:26 UTC, trondsg+bugzilla+freedesktop
Details

Description trondsg+bugzilla+freedesktop 2016-08-15 12:31:17 UTC
Version of pa: 1:4.0-0ubuntu11.1
jackd2 version: 1.9.9.5+20130622git7de15e7a-1ubuntu1
OS: Ubuntu Studio 14.04

The jack output has a very low volume.
Comment 1 Tanu Kaskinen 2016-08-16 15:55:03 UTC
Do other jack applications have normal volume?

Please attach the output from "pactl list" when you observe low volume.
Comment 2 trondsg+bugzilla+freedesktop 2016-08-17 10:56:16 UTC
(In reply to Tanu Kaskinen from comment #1)
> Do other jack applications have normal volume?
Good question, yes they do.

I found the problem: in the output tab of pa volume control, "jack sink" wasn't set to 100% volume, and I didn't see it, because it was hidden (I needed to scroll down).

1. I think this output should be set to 100% by default.

2. Another problem: all input clients don't get their volume preserved. I start jack and set spotify to 100%. Then stop jack, and the volume is set to 14% (almost unhearable). I set it to 100% again, then start jack. Volume is 14%. Stop jack, volume is 14%. Bug in spotify or pulseaudio?

3. Also, now that I can switch between audio outputs, I notice that when running output from audacity through pulseaudio jack sink I get better/clearer sound quality than when using pulseaudio analog output. Why? This can't be right. The sound file is 32-bit float.

It seems to be the same with Spotify, although it's more difficult to compare because the volume is set to 14% every time I turn jack on/off. I have been blaming Spotify for the poor sound quality, maybe it's pulseaudio that's the culprit.
Comment 3 trondsg+bugzilla+freedesktop 2016-08-17 10:57:47 UTC
Created attachment 125840 [details]
initial problem case - solved
Comment 4 trondsg+bugzilla+freedesktop 2016-08-17 10:59:00 UTC
Created attachment 125841 [details]
standard setup with less clear sound
Comment 5 trondsg+bugzilla+freedesktop 2016-08-17 10:59:41 UTC
Created attachment 125842 [details]
jack on and full volume - better sound (all these are pactl list outputs)
Comment 6 Tanu Kaskinen 2016-08-18 16:11:04 UTC
(In reply to trondsg+bugzilla+freedesktop from comment #2)
> 1. I think this output should be set to 100% by default.

It is set to 100% by default. I don't know what makes the volume lower on your system.

> 2. Another problem: all input clients don't get their volume preserved. I
> start jack and set spotify to 100%. Then stop jack, and the volume is set to
> 14% (almost unhearable). I set it to 100% again, then start jack. Volume is
> 14%. Stop jack, volume is 14%. Bug in spotify or pulseaudio?

Do you mean that the stream volume for spotify, not the sink volume, is behaving strangely? If you set "flat-volumes = no" in ~/.config/pulse/daemon.conf, does the issue go away? (I'd expect Ubuntu Studio to already have that option set, though. At least normal Ubuntu disables flat volumes by default.) If that doesn't help, maybe it is a spotify bug. I don't know what could be messing with the volume in pulseaudio.

> 3. Also, now that I can switch between audio outputs, I notice that when
> running output from audacity through pulseaudio jack sink I get
> better/clearer sound quality than when using pulseaudio analog output. Why?
> This can't be right. The sound file is 32-bit float.
> 
> It seems to be the same with Spotify, although it's more difficult to
> compare because the volume is set to 14% every time I turn jack on/off. I
> have been blaming Spotify for the poor sound quality, maybe it's pulseaudio
> that's the culprit.

There's no resampling done, according to the attached "pactl list" output, so the only thing that pulseaudio does to the audio is applying volume. The only explanation for the worse audio quality that I can think of is that jack opens the device in 32-bit mode, and somehow that has better quality even when original audio uses only 16 bits.

I tried running jackd myself, and with the default settings it opened the device in 32-bit mode. What does "cat /proc/asound/card1/pcm0p/sub0" print when jackd is running? For me it says "format: S32_LE". You can try setting a matching format (with S32_LE that would be "default-sample-format = s32le") in ~/.config/pulse/daemon.conf. Does that improve the sound quality?
Comment 7 trondsg+bugzilla+freedesktop 2016-08-22 11:47:45 UTC
1.
Ok, thanks.

However, after loading the pulseaudio equalizer module, I still had an episode with "low"
volume using the jack sink EVEN when it was set to 100%. The spotify source changed volume
from 55% to 74% automatically when starting jack, but the actual volume (from speakers)
didn't increase.
A few seconds later I can't reproduce it. The heard volume is now consistent with the %.

2.
The source spotify (listed in the playback tab of the volume control) was behaving
strangely. Every time I stopped/started jack it would reset to 14%. Today it works
properly, though. The volume stays the same unless I change it.

A little testing: After loading the pulseaudio equalizer module is loaded,
the stream does not preserve its volume when changing from "built-in audio analog stereo"
to jack sink.

But the next day, this works properly, even with the equalizer module is loaded.

3.
You're right, PA used 16-bit and Jack 32-bit. After setting PA to use 32-bit I can
no longer hear a difference.

# pulseaudio
~$ cat /proc/asound/card1/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 8192
buffer_size: 16384

# jack
~$ cat /proc/asound/card1/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 8
rate: 44100 (44100/1)
period_size: 256
buffer_size: 768

# pulseaudio with 32-bit
~$ cat /proc/asound/card1/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 4096
buffer_size: 8192

However, this isn't a solution, because it messed up the volume control:

I got a feeling that the volume from Spotify was somehow louder than it should be, compared to adobe flash.
After a while I discovered that the volume of spotify stream had somehow been tied loosely to analog output. So that when changing either, both changed (but not in a predictable way). Spotify was set to 38% and Analog output at 83%. When changing analog output to 80%, Spotify was changed to 37%.

Increasing the volume of spotify also increased the volume of analog output (even to beyond 100%).
Example: Analog output was set to -32dbA, after increasing the volume of spotify on the playback tab, it was set to -22dbA.
Comment 8 Tanu Kaskinen 2016-08-23 12:15:45 UTC
Did you set "flat-volumes = no" in ~/.config/pulse/daemon.conf? When flat volumes are enabled, hardware volume is affected by stream volumes, but when disabled, there should be no such coupling.
Comment 9 trondsg+bugzilla+freedesktop 2016-08-24 11:25:09 UTC
I already have flat-volumes = no in /etc/pulse/daemon.conf (it was the default and I've never changed anything in that file), but I'll try setting it again in my home folder.
Comment 10 Tanu Kaskinen 2016-08-24 16:55:17 UTC
The option can be set in either place, but note that if ~/.config/pulse/daemon.conf exists, /etc/pulse/daemon.conf won't be read at all, so if you set one thing in the home directory and a different thing in /etc, the thing you set in /etc doesn't have any effect.
Comment 11 trondsg+bugzilla+freedesktop 2016-08-25 15:01:20 UTC
Oh, that's really surprising. I expected them to be loaded in order (with the user-specific last). That means when setting sample rate to 32-bit in my home folder, I also "changed" several other options set in /etc.

For instance:
resample-method = speex-float-1

Which could potentially affect sound quality.

* I have solved the flat volume problem with setting it in my home folder. Thanks.

Back to point 2., stream volumes are still randomly not getting stored when changing outputs. For instance, I have flash (as alsa client), and when changing between analog output and equalizer sink, the volume jumps to 100% (right now, but I know it doesn't happen always).
Comment 12 Tanu Kaskinen 2016-08-27 13:39:05 UTC
(In reply to trondsg+bugzilla+freedesktop from comment #11)
> Back to point 2., stream volumes are still randomly not getting stored when
> changing outputs. For instance, I have flash (as alsa client), and when
> changing between analog output and equalizer sink, the volume jumps to 100%
> (right now, but I know it doesn't happen always).

That's weird, and I can't reproduce this.

If you could attach the log output from pulseaudio when moving a stream, that might provide some clues. To get the log, follow these steps:

1. Put "autospawn = no" to ~/.config/pulse/client.conf

2. killall pulseaudio

3. Run "pulseaudio -vv" in a terminal.

4. Open pavucontrol, select the "Playback" tab.

5. Open the flash application that you're able to reproduce this with. You should see it in pavucontrol.

6. Set the stream volume to something else than 100%.

7. Press enter a few times in the terminal where pulseaudio is running. The empty lines mark the beginning of the interesting part in the log.

8. Move the stream to another sink. It's volume should have changed - if not, then the log won't be interesting.

9. Press enter a few times again in the terminal where pulseaudio is running. The empty lines mark the end of the interesting part in the log.

10. Copy the part of the log that was generated between steps 7 and 9, and attach it to this bug.

You probably want to enable autospawning again after doing this, so that you don't need to manually start pulseaudio when logging in in the future.
Comment 13 trondsg+bugzilla+freedesktop 2016-08-28 11:26:09 UTC
Created attachment 126082 [details]
pulseaudio_stream_volume_not_preserved.txt
Comment 14 trondsg+bugzilla+freedesktop 2016-08-28 11:27:41 UTC
Thanks for the instructions. I got this behaviour logged. In this case it was Spotify stream, and switching between analog output and equalizer. In this case the volume was reset to 37% (not 100%). I attached the file as pulseaudio_stream_volume_not_preserved.txt.

Search the file for 123456789 (several places) to get to the interesting parts.
Comment 15 Tanu Kaskinen 2016-08-28 13:02:04 UTC
The logs didn't prove to be very useful, unfortunately. Any chance you could try a newer pulseaudio version?
Comment 16 GitLab Migration User 2018-07-30 10:08:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/225.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.