Re: [pulseaudio-discuss] Virtual audio cable - high cpu usage

2021-02-03 Thread Alexander E. Patrakov
чт, 4 февр. 2021 г. в 03:10, Renaud GHIA :

> Thank you for the tip.
> Now I am sure that resampling does not apply (see below).
> But unfortunately pulseaudio always consumes 30% of one CPU core!
>

The reason is that you are using module-loopback. Due to a potential
difference between the clocks on the null sink and on the real sound card
(even though both report 44100 Hz), it always has to resample in order to
correct for the clock skew. If you don't understand, here is an analogy:
you have two mechanical watches. Even though both claim that their hour
hand makes one full circle every 12 hours, in fact, if left unattended,
they will diverge over time. There is no way to avoid that, except by
moving to Jack or PipeWire which simply don't introduce a null sink with an
independent clock.

If you decide to stay on PulseAudio, you can tweak the resampling method.
The default, speex-float-1, is light on the CPU resources and should
produce no distortions detectable by human ear on typical speech and music.
It does produce easily detectable distortions on specifically crafted
signals. If you want to make sure that the resampler is transparent no
matter what is thrown at it, use speex-float-5. There is no point in going
higher than that.

-- 
Alexander E. Patrakov
CV: http://u.pc.cd/wT8otalK
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Virtual audio cable - high cpu usage

2021-02-03 Thread Renaud GHIA
Thank you for the tip.
Now I am sure that resampling does not apply (see below).
But unfortunately pulseaudio always consumes 30% of one CPU core!

Renaud

driver: 
flags:
state: RUNNING
source: 8 
volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
0.00 dB
   balance 0.00
muted: no
current latency: 0.50 ms
requested latency: 2000.00 ms
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
resample method: (null)
owner module: 6
client: 29 
properties:
media.name = "record"
application.name = "Lavf58.20.100"
native-protocol.peer = "UNIX socket client"
native-protocol.version = "32"
application.process.id = "18295"
application.process.user = "vagrant"
application.process.host = "debian10.localdomain"
application.process.binary = "ffmpeg"
application.language = "C"
window.x11.display = ":0"
application.process.machine_id = "c79df160d01f4c7780e6da0aaf5515c3"
application.process.session_id = "8"
module-stream-restore.id = "source-output-by-application-name:Lavf58.20.100"

Le mer. 3 févr. 2021 à 21:04, Sean Greenslade  a
écrit :

> On Tue, Feb 02, 2021 at 10:40:51AM +0100, Renaud GHIA wrote:
> > Hi,
> >
> > Below the result of the command "pacmd list".
> > Here without any change of resampling method.
>
> This part here shows your ffmpeg client:
>
> > index: 1
> > driver: 
> > flags:
> > state: RUNNING
> > source: 2 
> > volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
> > 0.00 dB
> >balance 0.00
> > muted: no
> > current latency: 0.50 ms
> > requested latency: 2000.00 ms
> > sample spec: s16le 2ch 48000Hz
> > channel map: front-left,front-right
> > Stereo
> > resample method: speex-float-1
>
> It seems like ffmpeg is requesting 48 kHz audio, so pulse is forced to
> resample. If possible, can you try running your ffmpeg process with the
> flag "-sample_rate 44100" and see if that reduces the CPU usage?
>
> Everything else in your pulse chain is 44.1 kHz, so with that change
> there should be no resampling at all.
>
> --Sean
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] USB-connected headsets: no sound

2021-02-03 Thread Rich Shepard

On Wed, 3 Feb 2021, Sean Greenslade wrote:


The menu I was referring to is attached to each of the clients. In your
screenshot, it's the box that says "HD-Audio Generic Analog Stereo".
Click that and change it to "Logitech H570e Stereo Analog Stereo".


Sean,

Thanks for correcting me. When I change the upper port it displays "Headset
(unplugged)" while the headset is plugged in.

The lower port sill shows "Logitach H5703 Stereo Analog Stereo" with the
port remaining "Headphones".


Your system theme makes it a little hard to tell, but yes, the one that is
in the darkened state is the selected one. As I mentioned, this won't
directly affect existing streams, it simply sets the "fallback" device
that is selected if a new client appears and doesn't explicitly specify
which sound card it wants to send audio to.


Unfortuately, changing the upper port to read "Headset (unplugged)" did not
make a difference; still no audio output.

Regards,

Rich
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Virtual audio cable - high cpu usage

2021-02-03 Thread Sean Greenslade
On Tue, Feb 02, 2021 at 10:40:51AM +0100, Renaud GHIA wrote:
> Hi,
> 
> Below the result of the command "pacmd list".
> Here without any change of resampling method.

This part here shows your ffmpeg client:

> index: 1
> driver: 
> flags:
> state: RUNNING
> source: 2 
> volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
> 0.00 dB
>balance 0.00
> muted: no
> current latency: 0.50 ms
> requested latency: 2000.00 ms
> sample spec: s16le 2ch 48000Hz
> channel map: front-left,front-right
> Stereo
> resample method: speex-float-1

It seems like ffmpeg is requesting 48 kHz audio, so pulse is forced to
resample. If possible, can you try running your ffmpeg process with the
flag "-sample_rate 44100" and see if that reduces the CPU usage?

Everything else in your pulse chain is 44.1 kHz, so with that change
there should be no resampling at all.

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] USB-connected headsets: no sound

2021-02-03 Thread Sean Greenslade
On Wed, Feb 03, 2021 at 07:25:31AM -0800, Rich Shepard wrote:
> On Tue, 2 Feb 2021, Sean Greenslade wrote:
> 
> > By default, new sound devices don't take over existing streams. In
> > pavucontrol under the playback tab, there should be a dropdown menu for
> > each client listing which card it is currently sending audio to. Try
> > starting a sound playback and switching its dropdown to the USB device.
> 
> Sean,
> 
> Thanks for the quick response.
> 
> I started a .mp3 using Audacious and pavucontrol's Playback tab shows
> Applications (see attached screenshot.)

The menu I was referring to is attached to each of the clients. In your
screenshot, it's the box that says "HD-Audio Generic Analog Stereo".
Click that and change it to "Logitech H570e Stereo Analog Stereo".

> > Under the "output devices" tab, there is a checkmark button next to the
> > sound devices. This lets you specify which device is the default. It won't
> > force existing streams over to it, however, and it won't prevent some
> > clients from remembering their previous soundcard, so you may still need
> > to manually move some clients over to the new soundcard.
> 
> There are two devices shown, including the headphones. The checkmark box has
> 2 states represented by light grey and lighter grey (see attached
> screenshot). Both tooltips say the active checkmark is to 'Set for
> fallback.' By trial-and-error I think the darker grey is the active state
> (it is for the mute button.) Regardless, no sound is heard with any
> combination of checkmark button states for the two output devices.

Your system theme makes it a little hard to tell, but yes, the one that
is in the darkened state is the selected one. As I mentioned, this won't
directly affect existing streams, it simply sets the "fallback" device
that is selected if a new client appears and doesn't explicitly specify
which sound card it wants to send audio to.

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] USB-connected headsets: no sound

2021-02-03 Thread Rich Shepard

On Tue, 2 Feb 2021, Sean Greenslade wrote:


By default, new sound devices don't take over existing streams. In
pavucontrol under the playback tab, there should be a dropdown menu for
each client listing which card it is currently sending audio to. Try
starting a sound playback and switching its dropdown to the USB device.


Sean,

Thanks for the quick response.

I started a .mp3 using Audacious and pavucontrol's Playback tab shows
Applications (see attached screenshot.)


Under the "output devices" tab, there is a checkmark button next to the
sound devices. This lets you specify which device is the default. It won't
force existing streams over to it, however, and it won't prevent some
clients from remembering their previous soundcard, so you may still need
to manually move some clients over to the new soundcard.


There are two devices shown, including the headphones. The checkmark box has
2 states represented by light grey and lighter grey (see attached
screenshot). Both tooltips say the active checkmark is to 'Set for
fallback.' By trial-and-error I think the darker grey is the active state
(it is for the mute button.) Regardless, no sound is heard with any
combination of checkmark button states for the two output devices.

If you have more ideas please share them with me and I'll report the
results.

Stay well,

Rich
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss