Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-09-04 Thread Sean Greenslade
On Fri, Sep 03, 2021 at 11:54:04AM +0200, mindfsck wrote:
> > Apologies for leading you down a dead-end. I've taken a closer look
> > at the code and found what the problem is. The pacat-simple.c example is
> > expecting raw PCM sample data in the file. Since you're giving it a .WAV
> > file, there is a metadata header at the beginning that it is trying to
> > interpret as audio.
> >
> > Try inserting this line just above the /* Read some data ... */ line:
> >
> > read(STDIN_FILENO, buf, 44); // Discard the .WAV header
>
> Thank you Sean, that did indeed the trick and my files play nicely now!
> Do you expect to add this WAV header detection (and skipping) in a future
> release or do you restrict it to PCM (and user code must skip)?

To be clear, I'm not a pulseaudio dev, just a [power] user. But it seems
to me that it's not within the purview of pulseaudio to do file parsing
/ interpretation. Especially in what purports to be a "simple" API.

Also, the code I showed above was just a quick and dirty hack to prove
what the issue was. If you're making an actual program, you would want
to do at least some basic parsing of the WAV header to select the
correct bitrate / channel / sample size values to fill out the
pa_sample_spec struct. As it sits now, those values are hard-coded, and
you would get glitchy / incorrect audio if you fed it a WAV file with
different parameters.

--Sean



Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-09-03 Thread mindfsck
Thank you Sean, that did indeed the trick and my files play nicely now!
Do you expect to add this WAV header detection (and skipping) in a future
release or do you restrict it to PCM (and user code must skip)?

On Fri, Sep 3, 2021 at 8:05 AM Sean Greenslade 
wrote:

> On Sun, Aug 29, 2021 at 07:02:25PM +0200, mindfsck wrote:
> > or use 'vlc' or use any Video/Audio playback you have on your
> machine.Sigh,
> > I may just reach out for alternative APIs instead of trying to convince
> > people that this might be a bug in the simple API you provide.
>
> Apologies for leading you down a dead-end. I've taken a closer look
> at the code and found what the problem is. The pacat-simple.c example is
> expecting raw PCM sample data in the file. Since you're giving it a .WAV
> file, there is a metadata header at the beginning that it is trying to
> interpret as audio.
>
> Try inserting this line just above the /* Read some data ... */ line:
>
> read(STDIN_FILENO, buf, 44); // Discard the .WAV header
>
> --Sean
>
>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-09-03 Thread Sean Greenslade
On Sun, Aug 29, 2021 at 07:02:25PM +0200, mindfsck wrote:
> or use 'vlc' or use any Video/Audio playback you have on your machine.Sigh,
> I may just reach out for alternative APIs instead of trying to convince
> people that this might be a bug in the simple API you provide.

Apologies for leading you down a dead-end. I've taken a closer look
at the code and found what the problem is. The pacat-simple.c example is
expecting raw PCM sample data in the file. Since you're giving it a .WAV
file, there is a metadata header at the beginning that it is trying to
interpret as audio.

Try inserting this line just above the /* Read some data ... */ line:

read(STDIN_FILENO, buf, 44); // Discard the .WAV header

--Sean



Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-29 Thread mindfsck
or use 'vlc' or use any Video/Audio playback you have on your machine.Sigh,
I may just reach out for alternative APIs instead of trying to convince
people that this might be a bug in the simple API you provide.

On Sun, Aug 29, 2021 at 6:53 PM mindfsck  wrote:

> I repeat myself...use 'paplay' or 'aplay' and the result is fine.
>
> On Sun, Aug 29, 2021 at 6:31 PM guest271314  wrote:
>
>> How do we know what the expected result is?
>>
>> On Sun, Aug 29, 2021 at 5:01 AM mindfsck  wrote:
>>
>>> you could try is making use of the buffering attributes in
 pa_simple_new. Specifically, setting prebuf to a suitable value.

>>>
>>> I tried setting prebuf to -1, 0, 1, 2, 4, 16, and 320. Made no
>>> difference to me.
>>>
>>> Another thing to check is if there are a couple of silent samples at the
 beginning of the problematic wav files

>>>
>>> I checked. The first 20ms are silent samples.
>>> Attached is the file.
>>>
>>> On Sun, Aug 29, 2021 at 12:06 AM Sean Greenslade <
>>> s...@seangreenslade.com> wrote:
>>>
 On Fri, Aug 27, 2021 at 04:57:07PM +0200, mindfsck wrote:
 > I seem to be to silly for it:
 > # sox in.wav -r 22050 out.wav resample
 > sox FAIL formats: can't open input file `out.wav': No such file or
 directory
 >
 > Of course there is no out.wav since that's what I want to create!

 I would not bother with trying to change sample rates, that's very
 unlikely to be the issue. Plus, a lot of sound cards only support 44.1
 kHz and 48 kHz, so pulse would just have to resample it again on
 playback.

 One thing you could try is making use of the buffering attributes in
 pa_simple_new. Specifically, setting prebuf to a suitable value. There's
 some helpful info in the buffer_attr docs page here:


 https://www.freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html

 Another thing to check is if there are a couple of silent samples at the
 beginning of the problematic wav files. If the first sample is non-zero,
 that could potentially cause pops on playback.

 --Sean




Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-29 Thread mindfsck
I repeat myself...use 'paplay' or 'aplay' and the result is fine.

On Sun, Aug 29, 2021 at 6:31 PM guest271314  wrote:

> How do we know what the expected result is?
>
> On Sun, Aug 29, 2021 at 5:01 AM mindfsck  wrote:
>
>> you could try is making use of the buffering attributes in
>>> pa_simple_new. Specifically, setting prebuf to a suitable value.
>>>
>>
>> I tried setting prebuf to -1, 0, 1, 2, 4, 16, and 320. Made no difference
>> to me.
>>
>> Another thing to check is if there are a couple of silent samples at the
>>> beginning of the problematic wav files
>>>
>>
>> I checked. The first 20ms are silent samples.
>> Attached is the file.
>>
>> On Sun, Aug 29, 2021 at 12:06 AM Sean Greenslade 
>> wrote:
>>
>>> On Fri, Aug 27, 2021 at 04:57:07PM +0200, mindfsck wrote:
>>> > I seem to be to silly for it:
>>> > # sox in.wav -r 22050 out.wav resample
>>> > sox FAIL formats: can't open input file `out.wav': No such file or
>>> directory
>>> >
>>> > Of course there is no out.wav since that's what I want to create!
>>>
>>> I would not bother with trying to change sample rates, that's very
>>> unlikely to be the issue. Plus, a lot of sound cards only support 44.1
>>> kHz and 48 kHz, so pulse would just have to resample it again on
>>> playback.
>>>
>>> One thing you could try is making use of the buffering attributes in
>>> pa_simple_new. Specifically, setting prebuf to a suitable value. There's
>>> some helpful info in the buffer_attr docs page here:
>>>
>>>
>>> https://www.freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html
>>>
>>> Another thing to check is if there are a couple of silent samples at the
>>> beginning of the problematic wav files. If the first sample is non-zero,
>>> that could potentially cause pops on playback.
>>>
>>> --Sean
>>>
>>>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-29 Thread guest271314
How do we know what the expected result is?

On Sun, Aug 29, 2021 at 5:01 AM mindfsck  wrote:

> you could try is making use of the buffering attributes in
>> pa_simple_new. Specifically, setting prebuf to a suitable value.
>>
>
> I tried setting prebuf to -1, 0, 1, 2, 4, 16, and 320. Made no difference
> to me.
>
> Another thing to check is if there are a couple of silent samples at the
>> beginning of the problematic wav files
>>
>
> I checked. The first 20ms are silent samples.
> Attached is the file.
>
> On Sun, Aug 29, 2021 at 12:06 AM Sean Greenslade 
> wrote:
>
>> On Fri, Aug 27, 2021 at 04:57:07PM +0200, mindfsck wrote:
>> > I seem to be to silly for it:
>> > # sox in.wav -r 22050 out.wav resample
>> > sox FAIL formats: can't open input file `out.wav': No such file or
>> directory
>> >
>> > Of course there is no out.wav since that's what I want to create!
>>
>> I would not bother with trying to change sample rates, that's very
>> unlikely to be the issue. Plus, a lot of sound cards only support 44.1
>> kHz and 48 kHz, so pulse would just have to resample it again on playback.
>>
>> One thing you could try is making use of the buffering attributes in
>> pa_simple_new. Specifically, setting prebuf to a suitable value. There's
>> some helpful info in the buffer_attr docs page here:
>>
>>
>> https://www.freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html
>>
>> Another thing to check is if there are a couple of silent samples at the
>> beginning of the problematic wav files. If the first sample is non-zero,
>> that could potentially cause pops on playback.
>>
>> --Sean
>>
>>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-29 Thread mindfsck
>
> you could try is making use of the buffering attributes in
> pa_simple_new. Specifically, setting prebuf to a suitable value.
>

I tried setting prebuf to -1, 0, 1, 2, 4, 16, and 320. Made no difference
to me.

Another thing to check is if there are a couple of silent samples at the
> beginning of the problematic wav files
>

I checked. The first 20ms are silent samples.
Attached is the file.

On Sun, Aug 29, 2021 at 12:06 AM Sean Greenslade 
wrote:

> On Fri, Aug 27, 2021 at 04:57:07PM +0200, mindfsck wrote:
> > I seem to be to silly for it:
> > # sox in.wav -r 22050 out.wav resample
> > sox FAIL formats: can't open input file `out.wav': No such file or
> directory
> >
> > Of course there is no out.wav since that's what I want to create!
>
> I would not bother with trying to change sample rates, that's very
> unlikely to be the issue. Plus, a lot of sound cards only support 44.1
> kHz and 48 kHz, so pulse would just have to resample it again on playback.
>
> One thing you could try is making use of the buffering attributes in
> pa_simple_new. Specifically, setting prebuf to a suitable value. There's
> some helpful info in the buffer_attr docs page here:
>
>
> https://www.freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html
>
> Another thing to check is if there are a couple of silent samples at the
> beginning of the problematic wav files. If the first sample is non-zero,
> that could potentially cause pops on playback.
>
> --Sean
>
>


out_short_clean.wav
Description: Wave audio


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-28 Thread Sean Greenslade
On Fri, Aug 27, 2021 at 04:57:07PM +0200, mindfsck wrote:
> I seem to be to silly for it:
> # sox in.wav -r 22050 out.wav resample
> sox FAIL formats: can't open input file `out.wav': No such file or directory
> 
> Of course there is no out.wav since that's what I want to create!

I would not bother with trying to change sample rates, that's very
unlikely to be the issue. Plus, a lot of sound cards only support 44.1
kHz and 48 kHz, so pulse would just have to resample it again on playback.

One thing you could try is making use of the buffering attributes in
pa_simple_new. Specifically, setting prebuf to a suitable value. There's
some helpful info in the buffer_attr docs page here:

https://www.freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html

Another thing to check is if there are a couple of silent samples at the
beginning of the problematic wav files. If the first sample is non-zero,
that could potentially cause pops on playback.

--Sean



Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-27 Thread mindfsck
I seem to be to silly for it:
# sox in.wav -r 22050 out.wav resample
sox FAIL formats: can't open input file `out.wav': No such file or directory

Of course there is no out.wav since that's what I want to create!

On Fri, Aug 27, 2021 at 4:28 PM guest271314  wrote:

> What happens when you resample to 22050?
>
> On Fri, Aug 27, 2021 at 7:18 AM mindfsck  wrote:
>
>> Why is the sample rate set to 48000?
>>>
>>
>> No idea! The sourcing of the file is outside of my hands..
>>
>> On Fri, Aug 27, 2021 at 4:14 PM guest271314 
>> wrote:
>>
>>> Why is the sample rate set to 48000?
>>>
>>> On Fri, Aug 27, 2021 at 6:40 AM mindfsck  wrote:
>>>
 Thanks Sean. I unloaded the suspend module but the plop is still there.
 I don't really think it is HW related since the file plays just fine
 with paplay and aplay.

 On Fri, Aug 27, 2021 at 5:49 AM Sean Greenslade <
 s...@seangreenslade.com> wrote:

> On Thu, Aug 26, 2021 at 09:43:23PM +0200, mindfsck wrote:
> > Hi there,
> >
> > I was using this example to simply play a WAV file without having
> much clue
> > of audio:
> >
> https://www.freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
> > I changed the sources to match (IMHO) my settings, i.e. channels=1
> and
> > rate=48000.
> >
> > I have two wavefiles, the first plays as it should (compared with
> command
> > line paplay or aplay) and the second one has an audible PLOP (but
> only
> > around 90% of the time) at the very beginning of playback:
> >
> > (1 - OK)
> > General
> > Complete name: out_clean.wav
> > Format   : Wave
> > File size: 81.3 KiB
> > Duration : 866 ms
> > Overall bit rate mode: Constant
> > Overall bit rate : 769 kb/s
> > Audio
> > Format   : PCM
> > Format settings  : Little / Signed
> > Codec ID : 1
> > Duration : 866 ms
> > Bit rate mode: Constant
> > Bit rate : 768 kb/s
> > Channel(s)   : 1 channel
> > Sampling rate: 48.0 kHz
> > Bit depth: 16 bits
> > Stream size  : 81.2 KiB (100%)
> >
> > (2 - NOK)
> > General
> > Complete name: out_short_clean.wav
> > Format   : Wave
> > File size: 22.8 KiB
> > Duration : 242 ms
> > Overall bit rate mode: Constant
> > Overall bit rate : 772 kb/s
> > Audio
> > Format   : PCM
> > Format settings  : Little / Signed
> > Codec ID : 1
> > Duration : 242 ms
> > Bit rate mode: Constant
> > Bit rate : 768 kb/s
> > Channel(s)   : 1 channel
> > Sampling rate: 48.0 kHz
> > Bit depth: 16 bits
> > Stream size  : 22.8 KiB (100%)
> >
> > I tried using different BUFSIZE and my systemload is also not an
> issue...
> > Any ideas?
>
> I've experienced something like this with a few built-in audio cards on
> various laptops. It's never bothered me enough to track it down, but I
> suspect it's due to the suspending and resuming of cards. Can you try
> disabling the autosuspend module and see if it still happens? Use this
> command to temporarily disable it until the next time pulse reloads:
>
> $ pactl unload-module module-suspend-on-idle
>
> --Sean
>
>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-27 Thread guest271314
What happens when you resample to 22050?

On Fri, Aug 27, 2021 at 7:18 AM mindfsck  wrote:

> Why is the sample rate set to 48000?
>>
>
> No idea! The sourcing of the file is outside of my hands..
>
> On Fri, Aug 27, 2021 at 4:14 PM guest271314  wrote:
>
>> Why is the sample rate set to 48000?
>>
>> On Fri, Aug 27, 2021 at 6:40 AM mindfsck  wrote:
>>
>>> Thanks Sean. I unloaded the suspend module but the plop is still there.
>>> I don't really think it is HW related since the file plays just fine
>>> with paplay and aplay.
>>>
>>> On Fri, Aug 27, 2021 at 5:49 AM Sean Greenslade 
>>> wrote:
>>>
 On Thu, Aug 26, 2021 at 09:43:23PM +0200, mindfsck wrote:
 > Hi there,
 >
 > I was using this example to simply play a WAV file without having
 much clue
 > of audio:
 >
 https://www.freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
 > I changed the sources to match (IMHO) my settings, i.e. channels=1 and
 > rate=48000.
 >
 > I have two wavefiles, the first plays as it should (compared with
 command
 > line paplay or aplay) and the second one has an audible PLOP (but only
 > around 90% of the time) at the very beginning of playback:
 >
 > (1 - OK)
 > General
 > Complete name: out_clean.wav
 > Format   : Wave
 > File size: 81.3 KiB
 > Duration : 866 ms
 > Overall bit rate mode: Constant
 > Overall bit rate : 769 kb/s
 > Audio
 > Format   : PCM
 > Format settings  : Little / Signed
 > Codec ID : 1
 > Duration : 866 ms
 > Bit rate mode: Constant
 > Bit rate : 768 kb/s
 > Channel(s)   : 1 channel
 > Sampling rate: 48.0 kHz
 > Bit depth: 16 bits
 > Stream size  : 81.2 KiB (100%)
 >
 > (2 - NOK)
 > General
 > Complete name: out_short_clean.wav
 > Format   : Wave
 > File size: 22.8 KiB
 > Duration : 242 ms
 > Overall bit rate mode: Constant
 > Overall bit rate : 772 kb/s
 > Audio
 > Format   : PCM
 > Format settings  : Little / Signed
 > Codec ID : 1
 > Duration : 242 ms
 > Bit rate mode: Constant
 > Bit rate : 768 kb/s
 > Channel(s)   : 1 channel
 > Sampling rate: 48.0 kHz
 > Bit depth: 16 bits
 > Stream size  : 22.8 KiB (100%)
 >
 > I tried using different BUFSIZE and my systemload is also not an
 issue...
 > Any ideas?

 I've experienced something like this with a few built-in audio cards on
 various laptops. It's never bothered me enough to track it down, but I
 suspect it's due to the suspending and resuming of cards. Can you try
 disabling the autosuspend module and see if it still happens? Use this
 command to temporarily disable it until the next time pulse reloads:

 $ pactl unload-module module-suspend-on-idle

 --Sean




Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-27 Thread mindfsck
>
> Why is the sample rate set to 48000?
>

No idea! The sourcing of the file is outside of my hands..

On Fri, Aug 27, 2021 at 4:14 PM guest271314  wrote:

> Why is the sample rate set to 48000?
>
> On Fri, Aug 27, 2021 at 6:40 AM mindfsck  wrote:
>
>> Thanks Sean. I unloaded the suspend module but the plop is still there.
>> I don't really think it is HW related since the file plays just fine with
>> paplay and aplay.
>>
>> On Fri, Aug 27, 2021 at 5:49 AM Sean Greenslade 
>> wrote:
>>
>>> On Thu, Aug 26, 2021 at 09:43:23PM +0200, mindfsck wrote:
>>> > Hi there,
>>> >
>>> > I was using this example to simply play a WAV file without having much
>>> clue
>>> > of audio:
>>> >
>>> https://www.freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
>>> > I changed the sources to match (IMHO) my settings, i.e. channels=1 and
>>> > rate=48000.
>>> >
>>> > I have two wavefiles, the first plays as it should (compared with
>>> command
>>> > line paplay or aplay) and the second one has an audible PLOP (but only
>>> > around 90% of the time) at the very beginning of playback:
>>> >
>>> > (1 - OK)
>>> > General
>>> > Complete name: out_clean.wav
>>> > Format   : Wave
>>> > File size: 81.3 KiB
>>> > Duration : 866 ms
>>> > Overall bit rate mode: Constant
>>> > Overall bit rate : 769 kb/s
>>> > Audio
>>> > Format   : PCM
>>> > Format settings  : Little / Signed
>>> > Codec ID : 1
>>> > Duration : 866 ms
>>> > Bit rate mode: Constant
>>> > Bit rate : 768 kb/s
>>> > Channel(s)   : 1 channel
>>> > Sampling rate: 48.0 kHz
>>> > Bit depth: 16 bits
>>> > Stream size  : 81.2 KiB (100%)
>>> >
>>> > (2 - NOK)
>>> > General
>>> > Complete name: out_short_clean.wav
>>> > Format   : Wave
>>> > File size: 22.8 KiB
>>> > Duration : 242 ms
>>> > Overall bit rate mode: Constant
>>> > Overall bit rate : 772 kb/s
>>> > Audio
>>> > Format   : PCM
>>> > Format settings  : Little / Signed
>>> > Codec ID : 1
>>> > Duration : 242 ms
>>> > Bit rate mode: Constant
>>> > Bit rate : 768 kb/s
>>> > Channel(s)   : 1 channel
>>> > Sampling rate: 48.0 kHz
>>> > Bit depth: 16 bits
>>> > Stream size  : 22.8 KiB (100%)
>>> >
>>> > I tried using different BUFSIZE and my systemload is also not an
>>> issue...
>>> > Any ideas?
>>>
>>> I've experienced something like this with a few built-in audio cards on
>>> various laptops. It's never bothered me enough to track it down, but I
>>> suspect it's due to the suspending and resuming of cards. Can you try
>>> disabling the autosuspend module and see if it still happens? Use this
>>> command to temporarily disable it until the next time pulse reloads:
>>>
>>> $ pactl unload-module module-suspend-on-idle
>>>
>>> --Sean
>>>
>>>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-27 Thread guest271314
Why is the sample rate set to 48000?

On Fri, Aug 27, 2021 at 6:40 AM mindfsck  wrote:

> Thanks Sean. I unloaded the suspend module but the plop is still there.
> I don't really think it is HW related since the file plays just fine with
> paplay and aplay.
>
> On Fri, Aug 27, 2021 at 5:49 AM Sean Greenslade 
> wrote:
>
>> On Thu, Aug 26, 2021 at 09:43:23PM +0200, mindfsck wrote:
>> > Hi there,
>> >
>> > I was using this example to simply play a WAV file without having much
>> clue
>> > of audio:
>> >
>> https://www.freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
>> > I changed the sources to match (IMHO) my settings, i.e. channels=1 and
>> > rate=48000.
>> >
>> > I have two wavefiles, the first plays as it should (compared with
>> command
>> > line paplay or aplay) and the second one has an audible PLOP (but only
>> > around 90% of the time) at the very beginning of playback:
>> >
>> > (1 - OK)
>> > General
>> > Complete name: out_clean.wav
>> > Format   : Wave
>> > File size: 81.3 KiB
>> > Duration : 866 ms
>> > Overall bit rate mode: Constant
>> > Overall bit rate : 769 kb/s
>> > Audio
>> > Format   : PCM
>> > Format settings  : Little / Signed
>> > Codec ID : 1
>> > Duration : 866 ms
>> > Bit rate mode: Constant
>> > Bit rate : 768 kb/s
>> > Channel(s)   : 1 channel
>> > Sampling rate: 48.0 kHz
>> > Bit depth: 16 bits
>> > Stream size  : 81.2 KiB (100%)
>> >
>> > (2 - NOK)
>> > General
>> > Complete name: out_short_clean.wav
>> > Format   : Wave
>> > File size: 22.8 KiB
>> > Duration : 242 ms
>> > Overall bit rate mode: Constant
>> > Overall bit rate : 772 kb/s
>> > Audio
>> > Format   : PCM
>> > Format settings  : Little / Signed
>> > Codec ID : 1
>> > Duration : 242 ms
>> > Bit rate mode: Constant
>> > Bit rate : 768 kb/s
>> > Channel(s)   : 1 channel
>> > Sampling rate: 48.0 kHz
>> > Bit depth: 16 bits
>> > Stream size  : 22.8 KiB (100%)
>> >
>> > I tried using different BUFSIZE and my systemload is also not an
>> issue...
>> > Any ideas?
>>
>> I've experienced something like this with a few built-in audio cards on
>> various laptops. It's never bothered me enough to track it down, but I
>> suspect it's due to the suspending and resuming of cards. Can you try
>> disabling the autosuspend module and see if it still happens? Use this
>> command to temporarily disable it until the next time pulse reloads:
>>
>> $ pactl unload-module module-suspend-on-idle
>>
>> --Sean
>>
>>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-27 Thread mindfsck
Thanks Sean. I unloaded the suspend module but the plop is still there.
I don't really think it is HW related since the file plays just fine with
paplay and aplay.

On Fri, Aug 27, 2021 at 5:49 AM Sean Greenslade 
wrote:

> On Thu, Aug 26, 2021 at 09:43:23PM +0200, mindfsck wrote:
> > Hi there,
> >
> > I was using this example to simply play a WAV file without having much
> clue
> > of audio:
> >
> https://www.freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
> > I changed the sources to match (IMHO) my settings, i.e. channels=1 and
> > rate=48000.
> >
> > I have two wavefiles, the first plays as it should (compared with command
> > line paplay or aplay) and the second one has an audible PLOP (but only
> > around 90% of the time) at the very beginning of playback:
> >
> > (1 - OK)
> > General
> > Complete name: out_clean.wav
> > Format   : Wave
> > File size: 81.3 KiB
> > Duration : 866 ms
> > Overall bit rate mode: Constant
> > Overall bit rate : 769 kb/s
> > Audio
> > Format   : PCM
> > Format settings  : Little / Signed
> > Codec ID : 1
> > Duration : 866 ms
> > Bit rate mode: Constant
> > Bit rate : 768 kb/s
> > Channel(s)   : 1 channel
> > Sampling rate: 48.0 kHz
> > Bit depth: 16 bits
> > Stream size  : 81.2 KiB (100%)
> >
> > (2 - NOK)
> > General
> > Complete name: out_short_clean.wav
> > Format   : Wave
> > File size: 22.8 KiB
> > Duration : 242 ms
> > Overall bit rate mode: Constant
> > Overall bit rate : 772 kb/s
> > Audio
> > Format   : PCM
> > Format settings  : Little / Signed
> > Codec ID : 1
> > Duration : 242 ms
> > Bit rate mode: Constant
> > Bit rate : 768 kb/s
> > Channel(s)   : 1 channel
> > Sampling rate: 48.0 kHz
> > Bit depth: 16 bits
> > Stream size  : 22.8 KiB (100%)
> >
> > I tried using different BUFSIZE and my systemload is also not an issue...
> > Any ideas?
>
> I've experienced something like this with a few built-in audio cards on
> various laptops. It's never bothered me enough to track it down, but I
> suspect it's due to the suspending and resuming of cards. Can you try
> disabling the autosuspend module and see if it still happens? Use this
> command to temporarily disable it until the next time pulse reloads:
>
> $ pactl unload-module module-suspend-on-idle
>
> --Sean
>
>


Re: [pulseaudio-discuss] Audible plop at beginning when using pcat-simple

2021-08-26 Thread Sean Greenslade
On Thu, Aug 26, 2021 at 09:43:23PM +0200, mindfsck wrote:
> Hi there,
> 
> I was using this example to simply play a WAV file without having much clue
> of audio:
> https://www.freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
> I changed the sources to match (IMHO) my settings, i.e. channels=1 and
> rate=48000.
> 
> I have two wavefiles, the first plays as it should (compared with command
> line paplay or aplay) and the second one has an audible PLOP (but only
> around 90% of the time) at the very beginning of playback:
> 
> (1 - OK)
> General
> Complete name: out_clean.wav
> Format   : Wave
> File size: 81.3 KiB
> Duration : 866 ms
> Overall bit rate mode: Constant
> Overall bit rate : 769 kb/s
> Audio
> Format   : PCM
> Format settings  : Little / Signed
> Codec ID : 1
> Duration : 866 ms
> Bit rate mode: Constant
> Bit rate : 768 kb/s
> Channel(s)   : 1 channel
> Sampling rate: 48.0 kHz
> Bit depth: 16 bits
> Stream size  : 81.2 KiB (100%)
> 
> (2 - NOK)
> General
> Complete name: out_short_clean.wav
> Format   : Wave
> File size: 22.8 KiB
> Duration : 242 ms
> Overall bit rate mode: Constant
> Overall bit rate : 772 kb/s
> Audio
> Format   : PCM
> Format settings  : Little / Signed
> Codec ID : 1
> Duration : 242 ms
> Bit rate mode: Constant
> Bit rate : 768 kb/s
> Channel(s)   : 1 channel
> Sampling rate: 48.0 kHz
> Bit depth: 16 bits
> Stream size  : 22.8 KiB (100%)
> 
> I tried using different BUFSIZE and my systemload is also not an issue...
> Any ideas?

I've experienced something like this with a few built-in audio cards on
various laptops. It's never bothered me enough to track it down, but I
suspect it's due to the suspending and resuming of cards. Can you try
disabling the autosuspend module and see if it still happens? Use this
command to temporarily disable it until the next time pulse reloads:

$ pactl unload-module module-suspend-on-idle

--Sean