[CA0106 - CA0106, playback] Playback problem - Surround dies, no valid output

Bug #1315212 reported by Joshua Panter on 2014-05-02
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ALSA driver
Unknown
Medium
alsa-driver (Ubuntu)
Undecided
Unassigned

Bug Description

This is tested against a Creative Labs Sounblaster live! (sb0410) card and a SoundBlaster Audigy se (sb0570). Both of them behave strangely, output coming through some, but not all speakers, etc. This was working in 13.10 under the sb0410. the ca0106 driver is the same for both cards.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: alsa-base 1.0.25+dfsg-0ubuntu4
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
Uname: Linux 3.13.0-24-generic i686
ApportVersion: 2.14.1-0ubuntu3
Architecture: i386
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: joshp 30385 F.... pulseaudio
 /dev/snd/controlC0: joshp 30385 F.... pulseaudio
CurrentDesktop: Unity
Date: Thu May 1 21:37:12 2014
InstallationDate: Installed on 2014-04-28 (3 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release i386 (20140417)
PackageArchitecture: all
SourcePackage: alsa-driver
Symptom: audio
Symptom_AlsaPlaybackTest: ALSA playback test through plughw:CA0106 failed
Symptom_Card: Built-in Audio - Intel ICH6
Symptom_Type: None of the above
Title: [CA0106 - CA0106, playback] Playback problem
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 03/03/2006
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A08
dmi.board.name: 0G8310
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 3
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvrA08:bd03/03/2006:svnDellInc.:pnOptiPlexGX280:pvr:rvnDellInc.:rn0G8310:rvr:cvnDellInc.:ct3:cvr:
dmi.product.name: OptiPlex GX280
dmi.sys.vendor: Dell Inc.

Joshua Panter (josh.p) wrote :
Raymond (superquad-vortex2) wrote :

you have to post the pulseaudio verbose log

https://wiki.ubuntu.com/PulseAudio/Log

did you find any error messages in the pukseaudio log when you play multi channel ?

alsa-sink] (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1289811

Changed in alsa-driver (Ubuntu):
status: New → Incomplete
Vladimir (thunder27) wrote :

I have problem with this soundcard too...front left speeker is ok, but front right speaker has no sound. I have Ubuntu Gnome 14.04 amd64 version.

Vladimir (thunder27) wrote :

I have tried this:

"speaker-test -c 2 -t wav -Dhw:CARD=CA0106,DEV=0"

speaker-test 1.0.27.2

Playback device is hw:CARD=CA0106,DEV=0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 16384
Period size range from 16 to 8192
Using max buffer size 16384
Periods = 4
was set period_size = 4096
was set buffer_size = 16384
 0 - Front Left
 1 - Front Right
^CTransfer failed: Bad address

and "speaker-test -c 2 -t wav -Dhw:CARD=CK804,DEV=0"

and this is an arror message:

speaker-test 1.0.27.2

Playback device is hw:CARD=CK804,DEV=0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
Playback open error: -19,No such device

Raymond (superquad-vortex2) wrote :

0.308| 0.000) I: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
( 0.308| 0.000) I: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
( 0.308| 0.000) I: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
( 0.308| 0.000) I: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem

you need to fix the bug of "Cannot lock ctl elem" first

seem related to those locks in iec958

do you sound card support both digital out and digital input (spdif) ?

Joshua Panter (josh.p) wrote :

Here is the pulseverbose.log. I started pules and ran speaker-test -C 6

vlad: That is exactly what happens for me, too.

Joshua Panter (josh.p) wrote :

I just tried this:

~$ speaker-test -c 6 -t wav -Dhw:CARD=CA0106,DEV=0

speaker-test 1.0.27.2

Playback device is hw:CARD=CA0106,DEV=0
Stream parameters are 48000Hz, S16_LE, 6 channels
WAV file(s)
Channels count (6) not available for playbacks: Invalid argument
Setting of hwparams failed: Invalid argument

Joshua Panter (josh.p) wrote :

here is the puleaudioverbose.log that was the output durring the command:

~$ speaker-test -c 6 -t wav -Dhw:CARD=CA0106,DEV=0

speaker-test 1.0.27.2

Playback device is hw:CARD=CA0106,DEV=0
Stream parameters are 48000Hz, S16_LE, 6 channels
WAV file(s)
Channels count (6) not available for playbacks: Invalid argument
Setting of hwparams failed: Invalid argument

Launchpad Janitor (janitor) wrote :

[Expired for alsa-driver (Ubuntu) because there has been no activity for 60 days.]

Changed in alsa-driver (Ubuntu):
status: Incomplete → Expired

Created attachment 111331
pulseaudio log

The game uses MonoGame as the engine, it outputs audio via ALSA. Often, but not every time, when I start the game the sound is played at double speed. What's worse all other apps also start playing audio too fast, including paplay, Chrome etc. Even those which are started after I exit the game. This can be fixed by restarting PA or after killing all clients connections with paman (if there are none after I exit the game, sound seems to be working correctly). I believe no client should affect other clients like this, no matter how it's broken. A friend of mine completed Transistor without such issues using PA. I also found that something like this was long ago fixed in Wine but this game is native. At least more native than pure Win32 apps+Wine and it doesn't use Wine. It uses Mono though and FMOD as the sound engine.

My soundcard is CA0106 Soundblaster (SB0410 SBLive! 24-bit), CPU is Intel Core i7-2600, 32Gb RAM, NVIDIA GeForce 770 GTX driver v340.65, Debian Jessie GNU/Linux amd64, Awesome WM 3.4.15, kernel v3.16.

I also have another sound chip, ALC889 Analog. It's disabled in pavucontrol.

You can also see some ALSA underruns, I couldn't fix it no matter what priorities and realtime priorities I set. They happen on both snd-hda-intel and snd-ca0106.

The issue seems to go away after I set the default sample spec to s32le (default is s16le). I also noticed that with s16le both Chrome and Transistor use "resample method: (null)" (according to pacmd list-sink-inputs), and with s32le it becomes "resample method: copy" for both. And no, Chrome isn't the culprit as it happens even when it's not running, I've tried. The speedup happens right after starting the game, I've run a song in Chrome and launched Transistor. First time it was ok in both Chrome and the game but on the second run the song immediately sped up to double speed. I have no idea how the sample spec (not the sample rate!) affects the speed but it's what it is.

SBLive! seems not to support 44100 Hz as it switches to 48k by default and even if I set 44100 explicitly in the daemon.conf. Though here paman and pacmd disagree with each other, pacmd says "sample spec: s16le 2ch 48000Hz" and paman says "Default Sample Type: s16le 2ch 44100Hz". Mumble notification sounds doesn't
crackle as they do on ALC889 @ 44100Hz so I believe pacmd is correct here.

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/pci/ca0106/ca0106_main.c

static struct snd_pcm_hardware snd_ca0106_playback_hw = {
 .info = SNDRV_PCM_INFO_MMAP |
    SNDRV_PCM_INFO_INTERLEAVED |
    SNDRV_PCM_INFO_BLOCK_TRANSFER |
    SNDRV_PCM_INFO_MMAP_VALID |
    SNDRV_PCM_INFO_SYNC_START,
 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,
 .rates = (SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
     SNDRV_PCM_RATE_192000),
 .rate_min = 48000,
 .rate_max = 192000,
 .channels_min = 2, //1,
 .channels_max = 2, //6,
 .buffer_bytes_max = ((65536 - 64) * 8),
 .period_bytes_min = 64,
 .period_bytes_max = (65536 - 64),
 .periods_min = 2,
 .periods_max = 8,
 .fifo_size = 0,
};

seem support both s16_le and s32_le but require SNDRV_PCM_INFO_SYNC_START

post the pulseaudio verbose log

and

aplay -D hw:CARD=CA0106 --dump-hw-params any.wav

> aplay -D hw:CARD=CA0106 --dump-hw-params /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
HW Params of device "hw:CARD=CA0106":
--------------------
ACCESS: MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT: S16_LE S32_LE
SUBFORMAT: STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [32 64]
CHANNELS: 2
RATE: [48000 192000]
PERIOD_TIME: (41 170667)
PERIOD_SIZE: [8 8192]
PERIOD_BYTES: [64 65472]
PERIODS: [2 8]
BUFFER_TIME: (83 341334)
BUFFER_SIZE: [16 16384]
BUFFER_BYTES: [64 65536]
TICK_TIME: ALL
--------------------
aplay: set_params:1239: Channels count non available

The pulseaudio log is attached to the first message. This is the debug level, AFAIK, it's the most verbose one.

how about

aplay -D surround40:CARD=CA0106 --dump-hw-params any.wav

aplay -D surround51:CARD=CA0106 --dump-hw-params any.wav

pulseaudio does not support SND_PCM_ACCESS_MMAP_COMPLEX and fallback to use SND_PCM_ACCESS_RW_INTERLEAVED

this force pulseaudio to use irq polling instead of timer scheduling
for those surround devices

http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa-util.c?id=045c1d602dcba57868845ba3270510593c39480f

+ if (!_use_mmap)
+ _use_tsched = FALSE;
+

your log did not contain the probing of your ca0106 and those errors

alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)

and

pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem

http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-November/022670.html

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1315212

static snd_pcm_uframes_t
snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream)
{
 struct snd_ca0106 *emu = snd_pcm_substream_chip(substream);
 struct snd_pcm_runtime *runtime = substream->runtime;
 struct snd_ca0106_pcm *epcm = runtime->private_data;
 unsigned int ptr, prev_ptr;
 int channel = epcm->channel_id;
 int timeout = 10;

 if (!epcm->running)
  return 0;

 prev_ptr = -1;
 do {
  ptr = snd_ca0106_ptr_read(emu, PLAYBACK_LIST_PTR, channel);
  ptr = (ptr >> 3) * runtime->period_size;
  ptr += bytes_to_frames(runtime,
   snd_ca0106_ptr_read(emu, PLAYBACK_POINTER, channel));
  if (ptr >= runtime->buffer_size)
   ptr -= runtime->buffer_size;
  if (prev_ptr == ptr)
   return ptr;
  prev_ptr = ptr;
 } while (--timeout);
 dev_warn(emu->card->dev, "ca0106: unstable DMA pointer!\n");
 return 0;
}

pointer callback return value from hardware register,

do the sound card report realtime accurate update poistion ?

http://cgit.freedesktop.org/pulseaudio/pulseaudio/plain/src/tests/alsa-time-test.c

try different fill rate

do the sound card report hw_ptr better than period size ?

Created attachment 111535
PA startup log

Here's the startup log.

> aplay -D surround40:CARD=CA0106 --dump-hw-params /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
HW Params of device "surround40:CARD=CA0106":
--------------------
ACCESS: MMAP_COMPLEX RW_INTERLEAVED RW_NONINTERLEAVED
FORMAT: S16_LE S32_LE
SUBFORMAT: STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [64 128]
CHANNELS: 4
RATE: [48000 192000]
PERIOD_TIME: (41 170667)
PERIOD_SIZE: [8 8192]
PERIOD_BYTES: [64 131072]
PERIODS: [2 8]
BUFFER_TIME: (83 341334)
BUFFER_SIZE: [16 16384]
BUFFER_BYTES: [128 262144]
TICK_TIME: ALL
--------------------
aplay: set_params:1239: Channels count non available

> aplay -D surround51:CARD=CA0106 --dump-hw-params /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
HW Params of device "surround51:CARD=CA0106":
--------------------
ACCESS: MMAP_COMPLEX RW_INTERLEAVED RW_NONINTERLEAVED
FORMAT: S16_LE S32_LE
SUBFORMAT: STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [96 192]
CHANNELS: 6
RATE: [48000 192000]
PERIOD_TIME: (41 170667)
PERIOD_SIZE: [8 8192]
PERIOD_BYTES: [96 196608]
PERIODS: [2 8]
BUFFER_TIME: (83 341334)
BUFFER_SIZE: [16 16384]
BUFFER_BYTES: [192 393216]
TICK_TIME: ALL
--------------------
aplay: set_params:1239: Channels count non available

Created attachment 111536
ALSA time test

The output of alsa-time-test.c

It ends with:
a.out: alsa-time-test.c:244: main: Assertion `(unsigned) avail <= buffer_size' failed.
zsh: abort ./a.out > timetest.log

I think it's ok.

(In reply to rkfg from comment #7)
> Created attachment 111536 [details]
> ALSA time test
>
> The output of alsa-time-test.c
>
> It ends with:
> a.out: alsa-time-test.c:244: main: Assertion `(unsigned) avail <=
> buffer_size' failed.
> zsh: abort ./a.out > timetest.log
>
> I think it's ok.

how did you run the program ?

the program is hardcoded to use 44100Hz , it should run continously without any error if fillrate is equal to period size

if sound card can report hw_ptr with better grannularity, the program can still run continously when fillrate is smaller than period size (e.g. dma brust size )

(In reply to rkfg from comment #6)
> Created attachment 111535 [details]
> PA startup log
>
> Here's the startup log.

Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: Successfully attached to mixer 'hw:0'
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)control.c: Invalid CTL iec958:0
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: Unable to attach to mixer iec958:0: No such file or directory
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: Successfully attached to mixer 'hw:0'
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)setup.c: Cannot lock ctl elem
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: snd_pcm_hw_params failed: Device or resource busy

git.alsa-project.org/?p=alsa-lib.git;a=blob_plain;f=src/conf/cards/CA0106.conf;hb=HEAD

seem related to lock in iec958 playback when pulseaudio try to open iec958 for playback and capture

need to use asym plugin if your ca0106 support both iec958 playback and capture

 }
 type hooks
 slave.pcm {
  type hw
  card $CARD
 }
 hooks.0 {
  type ctl_elems
  hook_args [
   {
    name "IEC958 Front Playback Volume"
    index 0
    lock true
    preserve true
    value [ 207 207 ] # Puts 0x30303030 in the Volume register. 0xff - 0x30 = 0xcf = 207
   }
   {
    name "IEC958 Playback Switch"
    lock true
    preserve true
    value 1
   }
   {
    interface PCM
    name "IEC958 Playback Default"
    index 1
    lock true
    preserve true
    optional true
    value [ $AES0 $AES1 $AES2 $AES3 ]
   }
   {
    # for compatibility with older drivers
    name "IEC958 Playback Default"
    index 1
    lock true
    preserve true
    optional true
    value [ $AES0 $AES1 $AES2 $AES3 ]
   }
  ]
 }
}

alternative is to force pulseaudio not to open iec958 for capture

by removing all paths-input of iec958 from

 http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets/default.conf

[Mapping iec958-stereo]
device-strings = iec958:%f
channel-map = left,right
paths-input = iec958-stereo-input
paths-output = iec958-stereo-output
priority = 5

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: CA0106 [CA0106], device 0: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 1: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 2: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 3: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 0: CA0106 [CA0106], device 0: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 1: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 2: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 3: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Changed in alsa-driver (Ubuntu):
status: Expired → Incomplete
Changed in alsa-driver:
importance: Unknown → Medium
status: Unknown → Confirmed

(In reply to Raymond from comment #8)
>
> how did you run the program ?
>
> the program is hardcoded to use 44100Hz , it should run continously without
> any error if fillrate is equal to period size
>
> if sound card can report hw_ptr with better grannularity, the program can
> still run continously when fillrate is smaller than period size (e.g. dma
> brust size )

I did:
gcc alsa-time-test.c -lasound
./a.out

That's all. What exactly should I do now and what information do you need?

http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html

pcm.name {
        type asym # Asym PCM
        playback STR # Playback slave name
        # or
        playback { # Playback slave definition
                pcm STR # Slave PCM name
                # or
                pcm { } # Slave PCM definition
        }
        capture STR # Capture slave name
        # or
        capture { # Capture slave definition
                pcm STR # Slave PCM name
                # or
                pcm { } # Slave PCM definition
        }
}

pcm.NAME {
        type hooks # PCM with hooks
        slave STR # Slave name
        # or
        slave { # Slave definition
                pcm STR # Slave PCM name
                # or
                pcm { } # Slave PCM definition
        }
        hooks {
                ID STR # Hook name (see pcm_hook)
                # or
                ID { } # Hook definition (see pcm_hook)
        }
}

you need to put the current ca0106 iec958 slave pcm and hook into playback slave and create capture slave of asym plugin

(In reply to Raymond from comment #14)
> you need to put the current ca0106 iec958 slave pcm and hook into playback
> slave and create capture slave of asym plugin

Sorry, I don't understand. I'm not that familiar with low-level ALSA configs, I only did some basic operations with ~/.asoundrc
What file exactly should I change and what should I write into it?

/usr/share/alsa/cards/CA0106.conf

Good, the file is there and it has those lines you mentioned in #10. Now how should I modify them? Could you provide a diff to apply? I don't really get what "to put the current ca0106 iec958 slave pcm and hook into playback slave and create capture slave of asym plugin" means. If the alternative method is effectively equal to ALSA hacks, I can go that way, it seems to be much easier.

>alternative is to force pulseaudio not to open iec958 for capture
>by removing all paths-input of iec958 from

Should I comment out the entire [Mapping iec958-stereo] section or just "paths-input = iec958-stereo-input"?

CA0106.pcm.iec958.0 {
 @args [ CARD AES0 AES1 AES2 AES3 ]
 @args.CARD {
  type string
 }
 @args.AES0 {
  type integer
 }
 @args.AES1 {
  type integer
 }
 @args.AES2 {
  type integer
 }
 @args.AES3 {
  type integer
 }
+ type asym
+ playback.pcm {
 type hooks
 slave.pcm {
  type hw
  card $CARD
 }
 hooks.0 {
  type ctl_elems
  hook_args [
   {
    name "IEC958 Front Playback Volume"
    index 0
    lock true
    preserve true
    value [ 207 207 ] # Puts 0x30303030 in the Volume register. 0xff - 0x30 = 0xcf = 207
   }
   {
    name "IEC958 Playback Switch"
    lock true
    preserve true
    value 1
   }
   {
    interface PCM
    name "IEC958 Playback Default"
    index 1
    lock true
    preserve true
    optional true
    value [ $AES0 $AES1 $AES2 $AES3 ]
   }
   {
    # for compatibility with older drivers
    name "IEC958 Playback Default"
    index 1
    lock true
    preserve true
    optional true
    value [ $AES0 $AES1 $AES2 $AES3 ]
   }
  ]
 }
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ }
}

for alsa-time-test.c

dev = argc > 1 ? argv[1] : "front:0";
    cap = argc > 2 ? atoi(argv[2]) : 0;
    fillrate = argc > 3 ? atoi(argv[3]) : 1;

there are three parameter which allow you to change

device
capture or playback
fillrate

most sound cards cannot use default fill rate 1

for hda-intel, the hw_ptr increase by 16/32 frames for each dma transfer, fill rate can be lower than the period size

Created attachment 111585
ALSA test log

I've applied those changes for the ALSA config. I ran the test as ./a.out front:0 0 4 > alsa-test.log and here's the output. I stopped it with Ctrl-C. When I set the fillrate less than 4, it stops with the assertion failure like before. Setting the fillrate to 1 with playback test mode (./a.out front:0 1 1 > alsa1-test.log) doesn't fail.

That aside, I don't understand how IEC capture is related to the playback issue though. The game doesn't use microphone.

those locks in hook plugin prevent you running

aplay -D iec958:CARD=CA0106 stereo48000.wav

and

arecord -D iec958:CARD=CA0106 test.wav

at same time

those message "Cannot lock ctl elem" should disaapear when you can playback and capture iec958 at same time ?

post pulseaudio verbose log

http://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/081501.html

you can try Alexander's pcm_avail.c to find out whether your ca0106 can report DMA_RESIDUE_GRANULARITY_BURST ?

do the error

alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed (-77)

appear when you fix the error "cannot lock ctl elem" as pulseaudio start the probing of those surround40, 51 and71 ?

http://mailman.alsa-project.org/pipermail/alsa-devel/2008-October/011913.html

: module-alsa-sink.c: Using 4 fragments of size 8816 bytes, buffer time is 99.95ms
D: module-alsa-sink.c: hwbuf_unused_frames=0
D: module-alsa-sink.c: setting avail_min=1
I: module-alsa-sink.c: Volume ranges from 0 to 31.
I: module-alsa-sink.c: Volume ranges from -46.50 dB to 0.00 dB.
I: alsa-util.c: ALSA device lacks separate volumes control for channel 'rear-left'
I: module-alsa-sink.c: Using hardware volume control. Hardware dB scale supported.
D: alsa-util.c: snd_pcm_dump():
D: alsa-util.c: Multi PCM
D: alsa-util.c: Channel bindings:
D: alsa-util.c: 0: slave 0, channel 0
D: alsa-util.c: 1: slave 0, channel 1
D: alsa-util.c: 2: slave 1, channel 0
D: alsa-util.c: 3: slave 1, channel 1
D: alsa-util.c: Its setup is:
D: alsa-util.c: stream : PLAYBACK
D: alsa-util.c: access : RW_INTERLEAVED
D: alsa-util.c: format : S16_LE
D: alsa-util.c: subformat : STD
D: alsa-util.c: channels : 4
D: alsa-util.c: rate : 44100
D: alsa-util.c: exact rate : 44100 (44100/1)
D: alsa-util.c: msbits : 16
D: alsa-util.c: buffer_size : 4408
D: alsa-util.c: period_size : 1102
D: alsa-util.c: period_time : 24988
D: alsa-util.c: tstamp_mode : NONE
D: alsa-util.c: period_step : 1
D: alsa-util.c: avail_min : 1102
D: alsa-util.c: period_event : 0
D: alsa-util.c: start_threshold : -1
D: alsa-util.c: stop_threshold : -1
D: alsa-util.c: silence_threshold: 0
D: alsa-util.c: silence_size : 0
D: alsa-util.c: boundary : 1155530752
D: alsa-util.c: Slave #0: Hooks PCM
D: alsa-util.c: Its setup is:
D: alsa-util.c: stream : PLAYBACK
D: alsa-util.c: access : MMAP_INTERLEAVED
D: alsa-util.c: format : S16_LE
D: alsa-util.c: subformat : STD
D: alsa-util.c: channels : 2
D: alsa-util.c: rate : 44100
D: alsa-util.c: exact rate : 44100 (44100/1)
D: alsa-util.c: msbits : 16
D: alsa-util.c: buffer_size : 4408
D: alsa-util.c: period_size : 1102
D: alsa-util.c: period_time : 24988
D: alsa-util.c: tstamp_mode : NONE
D: alsa-util.c: period_step : 1
D: alsa-util.c: avail_min : 1102
D: alsa-util.c: period_event : 0
D: alsa-util.c: start_thr
D: module-alsa-sink.c: Thread starting up
D: rtpoll.c: Acquired POSIX realtime signal SIGRTMIN+29
D: module-alsa-sink.c: Read hardware volume: 0: 87% 1: 87% 2: 87% 3: 87%
I: module-alsa-sink.c: Starting playback.
I: (alsa-lib)pcm_hw.c: SNDRV_PCM_IOCTL_START failed

the playback stream has been started and pcm state is running but pulseaudio still call snd_pcm_start()

seem default sample 16 bits has no effect on format , pulseaudio prefer 32 bits

Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] card.c: Created 2 "alsa_card.pci-0000_06_00.0"
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: cannot disable ALSA period wakeups
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: ALSA period wakeups were not disabled
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-sink.c: Successfully opened device front:0.
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-sink.c: Selected mapping 'Analog Stereo' (analog-stereo).
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-sink.c: Successfully enabled mmap() mode.
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-sink.c: Successfully enabled timer-based scheduling mode.
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] (alsa-lib)control.c: Invalid CTL front:0
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: Unable to attach to mixer front:0: No such file or directory
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] alsa-util.c: Successfully attached to mixer 'hw:0'
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] module-device-restore.c: Restoring port for sink sink:alsa_output.pci-0000_06_00.0.analog-stereo.
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] module-device-restore.c: Restoring volume for sink alsa_output.pci-0000_06_00.0.analog-stereo: front-left: 65536 / 100%, front-right: 65536 / 100%
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] sink.c: Default and alternate sample rates are the same.
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] sink.c: Created sink 0 "alsa_output.pci-0000_06_00.0.analog-stereo" with sample spec s32le 2ch 48000Hz and channel map front-left,front-right
Dec 30 22:56:29 homecomp pulseaudio[1103]: [pulseaudio] sink.c: alsa.resolution_bits = "32"

Created attachment 111615
Fixed PA log

It now doesn't report "Cannot lock ctl elem".

Created attachment 111616
pcm_avail log

Here's the output of pcm_avail.c program.

(In reply to Raymond from comment #25)
> seem default sample 16 bits has no effect on format , pulseaudio prefer 32
> bits

No, it does. I have these options uncommented in my daemon.conf:

default-sample-format = s32le
default-sample-rate = 48000

I have them enabled for some time and PA startup logs were provided with them on. If that's wrong tell me and I'll provide logs without them.

(In reply to rkfg from comment #27)
> Created attachment 111616 [details]
> pcm_avail log
>
> Here's the output of pcm_avail.c program.

avail increment at 8 frames which is less than min period size 16 and period size 1024

this mean some tsched feature are supported

hwbuf_unused can be set to non zero (e.g. multiple of 8 frames instead of period size)

min_period_size: 16 frames, dir: 0
Playback hwparams: FIFO size is 0
Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
  stream : PLAYBACK
  access : RW_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 4096
  period_size : 1024
  period_time : 21333
  tstamp_mode : NONE
  period_step : 1
  avail_min : 1024
  period_event : 0
  start_threshold : 1024
  stop_threshold : 4096
  silence_threshold: 0
  silence_size : 0
  boundary : 4611686018427387904
  appl_ptr : 0
  hw_ptr : 0
Playing silence
Available: 64, loop iteration: 0
Available: 72, loop iteration: 8
Available: 80, loop iteration: 16
Available: 88, loop iteration: 24
Available: 96, loop iteration: 31

(In reply to rkfg from comment #26)
> Created attachment 111615 [details]
> Fixed PA log
>
> It now doesn't report "Cannot lock ctl elem".

it is strange that pulseaudio still don't probe surround profiles

pactl list should list those surround profiles similar to https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1299857

  device.vendor.name = "Creative Labs"
  device.product.name = "CA0106 Soundblaster"
  device.string = "0"
  device.description = "CA0106 Soundblaster"
  module-udev-detect.discovered = "1"
  device.icon_name = "audio-card-pci"
 profiles:
  output:analog-stereo: Analog Stereo Output (priority 6000)
  output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060)
  output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055)
  output:analog-surround-40: Analog Surround 4.0 Output (priority 700)
  output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (priority 760)
  output:analog-surround-40+input:iec958-stereo: Analog Surround 4.0 Output + Digital Stereo (IEC958) Input (priority 755)

can you post the output of alsa-info.sh ?

did it support 7.1 since there are only 4 jacks ?

speaker-test -c 4 -t wav -D surround40:CARD=CA0106

speaker-test -c 6 -t wav -D surround51:CARD=CA0106

speaker-test -c 8 -t wav -D surround71:CARD=CA0106

Created attachment 111649
ALSA info

Here's the output of alsa-info.sh. The speaker test works, all three commands without errors. However, I only have 2 speakers so I hear "front left" and "front right".

analog source seem supported by pulseaudio

http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/paths/analog-input.conf.common?id=67e3925795ad939f2c9acb3aa93122a18672fade

pactl list

do pulseaudio show four input ports : phone, mic, line in and aux

SImple mixer control 'Analog Source',0
  Capabilities: cenum
  Items: 'Phone' 'Mic' 'Line in' 'Aux'
  Item0: 'Mic'
Simple mixer control 'CAPTURE feedback',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 0 [0%] [-99999.99dB]
  Front Right: Playback 0 [0%] [-99999.99dB]
Simple mixer control 'Digital Source',0
  Capabilities: cenum
  Items: 'IEC958 out' 'i2s mixer out' 'IEC958 in' 'i2s in' 'AC97 in' 'SRC out'
  Item0: 'i2s in'
Simple mixer control 'Shared Mic/Line in',0
  Capabilities: cenum
  Items: 'Line in' 'Mic in'
  Item0: 'Mic in'

CA0106 use specific name, you may need to add them to

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output.conf

Simple mixer control 'Analog Center/LFE',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 207 [81%] [0.00dB]
  Front Right: Playback 207 [81%] [0.00dB]
Simple mixer control 'Analog Front',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 207 [81%] [0.00dB]
  Front Right: Playback 207 [81%] [0.00dB]
Simple mixer control 'Analog Rear',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 207 [81%] [0.00dB]
  Front Right: Playback 207 [81%] [0.00dB]
Simple mixer control 'Analog Side',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 207 [81%] [0.00dB]
  Front Right: Playback 207 [81%] [0.00dB]

Jan 01 18:52:27 homecomp pulseaudio[14807]: [pulseaudio] alsa-mixer.c: Skipping profile output:iec958-stereo+input:iec958-stereo - will not be able to open input:iec958-stereo

seem cannot opem iec958 for input

can you specify device 0

+ capture.pcm {
+ type hw
+ card $CARD
+ device 0
+

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets/default.conf

[Mapping iec958-stereo]
device-strings = iec958:%f
channel-map = left,right
paths-input = iec958-stereo-input
paths-output = iec958-stereo-output
priority = 5

as pulseaudio already define iec958-stereo-input

when there is iec958-stereo-output.conf

why there is no iec958-stereo-input.conf

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths

Created attachment 111662
Pulse log

(In reply to Raymond from comment #35)
> can you specify device 0
>
> + capture.pcm {
> + type hw
> + card $CARD
> + device 0
> +

Added this, here's the startup log.

Created attachment 111663
pactl list log

Log of pactl list.

arecord -v -d 1 -D iec958:CARD=CA0106 -f dat -t wav --dump-hw-params test.wav

device.description = "CA0106 Soundblaster (SB0410 SBLive! 24-bit) Analog Stereo"
  alsa.mixer_name = "CA0106"
  module-udev-detect.discovered = "1"
  device.icon_name = "audio-card-pci"
 Ports:
  analog-input-mic: Microphone (priority: 8700)
  analog-input-aux;input-microphone+input-microphone: Analog Input / Microphone / Microphone (priority: 8000)
  analog-input-aux;input-microphone+input-linein: Analog Input / Microphone / Line In (priority: 8000)
  analog-input-aux;input-linein+input-microphone: Analog Input / Line In / Microphone (priority: 8000)
  analog-input-aux;input-linein+input-linein: Analog Input / Line In / Line In (priority: 8000)
  analog-input-aux;input+input-microphone: Analog Input / Input / Microphone (priority: 8000)
  analog-input-aux;input+input-linein: Analog Input / Input / Line In (priority: 8000)
 Active Port: analog-input-mic
 Formats:
  pcm

seem phone is still missing

SImple mixer control 'Analog Source',0
  Capabilities: cenum
  Items: 'Phone' 'Mic' 'Line in' 'Aux'
  Item0: 'Mic'

Simple mixer control 'Line in',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 255
  Front Left: Capture 0 [0%] [-99999.99dB]
  Front Right: Capture 0 [0%] [-99999.99dB]
Simple mixer control 'Mic',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 255
  Front Left: Capture 255 [100%] [24.00dB]
  Front Right: Capture 255 [100%] [24.00dB]
Simple mixer control 'Phone',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 255
  Front Left: Capture 0 [0%] [-99999.99dB]
  Front Right: Capture 0 [0%] [-99999.99dB]
Simple mixer control 'Aux',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 255
  Front Left: Capture 0 [0%] [-99999.99dB]
  Front Right: Capture 0 [0%] [-99999.99dB]

Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
HW Params of device "iec958:CARD=CA0106":
--------------------
ACCESS: MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT: S16_LE S32_LE
SUBFORMAT: STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [32 64]
CHANNELS: 2
RATE: [48000 192000]
PERIOD_TIME: (41 170334)
PERIOD_SIZE: [8 8176]
PERIOD_BYTES: [64 32704]
PERIODS: 2
BUFFER_TIME: (83 340667)
BUFFER_SIZE: [16 16352]
BUFFER_BYTES: [64 65408]
TICK_TIME: ALL
--------------------
Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
  stream : CAPTURE
  access : RW_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 8160
  period_size : 4080
  period_time : 85000
  tstamp_mode : NONE
  period_step : 1
  avail_min : 4080
  period_event : 0
  start_threshold : 1
  stop_threshold : 8160
  silence_threshold: 0
  silence_size : 0
  boundary : 9187343239835811840
  appl_ptr : 0
  hw_ptr : 0
overrun!!! (at least 0.017 ms long)
Status:
  state : XRUN
  trigger_time: 847573.10484226
  tstamp : 847573.10498485
  delay : 0
  avail : 8160
  avail_max : 8160
^CAborted by signal Interrupt...

does analog capture also overrun ?

arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 test.wav

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/ca0106/ca0106_mixer.c

if your sb0410 only have four jacks and support 7.1

it need snd_ca0106_capture_line_in_side_out which change blue line in jack as side line out jack

if (emu->details->i2c_adc == 1) {
  ADD_CTLS(emu, snd_ca0106_volume_i2c_adc_ctls);
  if (emu->details->gpio_type == 1)
   err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_mic_line_in, emu));
  else /* gpio_type == 2 */
   err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_line_in_side_out, emu));
  if (err < 0)
   return err;
 }

It does:
> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.084 ms long)
^CAborted by signal Interrupt...

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/pci/ca0106/ca0106_main.c

GENERAL INFO:
 * Model: SB0410
 * P17 Chip: CA0106-DAT
 * AC97 Codec: None
 * ADC: WM8775EDS (4 Channel)
 * DAC: CS4382 (114 dB, 24-Bit, 192 kHz, 8-Channel D/A Converter with DSD Support)

  /* New Sound Blaster Live! 7.1 24bit. This does not have an AC97. 53SB041000001 */
  { .serial = 0x10061102,
    .name = "Live! 7.1 24bit [SB0410]",
    .gpio_type = 1,
    .i2c_adc = 1 } ,

BTW, my mic is connected to the blue jack, not the usual pink one. This is the only configuration I've found to be working, others result in noise or silence. The mic is a bit more quiet (not _almost silent_ as if it's connected to a Line-In jack, just not comfortable enough) than it was on the ALC889 internal card so I had to increase the volume via software means. There's no boost setting in the alsamixer but PulseAudio can handle that.

(In reply to rkfg from comment #43)
> It does:
> > arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 test.wav
> Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz,
> Stereo
> overrun!!! (at least 0.084 ms long)
> ^CAborted by signal Interrupt...

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/ca0106/ca0106_main.c?id=34fdeb2d07102e07ecafe79dec170bd6733f2e56

you have to report to the author if overrun occur

do it work better if you specify buffer size power of two (eg. 1024, 2048 or 4096

arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size= 2048 test.wav

Download full text (3.3 KiB)

It happens more likely with small buffers and sometimes doesn't happen with larger buffer. However, this behavior is not consistent:
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=2048 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.025 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=4096 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.023 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=8192 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.023 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=16384 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.028 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=32768 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.045 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=65536 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.039 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=131072 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.046 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=262144 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=262144 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.039 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=524288 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=524288 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.046 ms long)
^CAborted by signal Interrupt...
%[homecomp]:[/tmp/test]> arecord -f dat -D hw:CARD=CA0106 -t wav -d 5 --buffer-size=524288 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
overrun!!! (at least 0.044 ms long)
^CAborted by signal Interrupt...

Ok, what about the original issue? I don't quite get what we are doing here. It looks like we're debugging something completely unrelated, for example, I don't use the d...

Read more...

Raymond tends to be side-tracked from time to time and ask questions which are related to your original issue. Also apologies for not having read the entire thread through.

PulseAudio closes the audio stream five seconds after no applications are active, so that's probably when the issue goes back to normal too.

The resampler changed from "null" to "copy" means that we have a resampler engine active for the stream, but all it does is to convert from s16le (as being input by Chrome) to s32le.

You're probably hitting a driver issue, but I wonder how we can prove it. Also the fact that it seems to hit one application only is a bit strange, maybe it's related to the requested latency by that specific application or something.

did your sb0410 have these two chips ?

ADC: WM8775EDS (4 Channel)
  DAC: CS4382

if you look at cs4382 datasheet , it has three modes which can double or quad the speed

for wm8775 which does not have any boost for mic, you have to ask the author who add support of mic line in switch since the datasheet does not mention any usage of input pins as mic

https://bugzilla.kernel.org/enter_bug.cgi?product=Drivers

you have to file upstream bug for overrun when recording using arecord

http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=1af088e39b75a0a0897c7036487b143e983cd423;hp=57b5076c30b3453ee843912c0aeb3df8dbee3f68

it is strange the pulseaudio no longer probe surround40 , 51, and 71

your log have no traces of surround21 too

http://git.alsa-project.org/?p=alsa-lib.git;a=blob_plain;f=test/chmap.c;hb=HEAD

chmap -D surround40 query

chmap -D surround40 get

(In reply to Raymond from comment #49)
> did your sb0410 have these two chips ?
>
> ADC: WM8775EDS (4 Channel)
> DAC: CS4382
>
My card looks exactly like this: http://www.ixbt.com/multimedia/creative-live!24bit/card-big.jpg
Probably, it has all these chips.

control.29 {
  iface MIXER
  name 'Phone Capture Volume'
  value.0 0
  value.1 0
  comment {
   access 'read write'
   type INTEGER
   count 2
   range '0 - 255'
   dbmin -9999999
   dbmax 2400
   dbvalue.0 -9999999
   dbvalue.1 -9999999
  }
 }
 control.30 {
  iface MIXER
  name 'Mic Capture Volume'
  value.0 255
  value.1 255
  comment {
   access 'read write'
   type INTEGER
   count 2
   range '0 - 255'
   dbmin -9999999
   dbmax 2400
   dbvalue.0 2400
   dbvalue.1 2400
  }
 }
 control.31 {
  iface MIXER
  name 'Line in Capture Volume'
  value.0 0
  value.1 0
  comment {
   access 'read write'
   type INTEGER
   count 2
   range '0 - 255'
   dbmin -9999999
   dbmax 2400
   dbvalue.0 -9999999
   dbvalue.1 -9999999
  }
 }
 control.32 {
  iface MIXER
  name 'Aux Capture Volume'
  value.0 0
  value.1 0
  comment {
   access 'read write'
   type INTEGER
   count 2
   range '0 - 255'
   dbmin -9999999
   dbmax 2400
   dbvalue.0 -9999999
   dbvalue.1 -9999999
  }
 }

refer to table 11 wm8775 datasheet

0dB is at 0xcf and 24 dB at 0xff

 Four Stereo ADC Inputs with Analogue Gain Adjust from +24dB to –21dB in 0.5dB Steps
 Digital Gain Adjust from -21.5dB to -103dB.

table 10 of wm8775 mention that 0.5 dB per steps and min 0 is mute

As max 255 is +24 dB , 0xcf is 0 dB ,

step 1 is -103 dB

Source #1
 State: SUSPENDED
 Name: alsa_input.pci-0000_06_00.0.analog-stereo
 Description: CA0106 Soundblaster (SB0410 SBLive! 24-bit) Analog Stereo
 Driver: module-alsa-card.c
 Sample Specification: s32le 2ch 48000Hz
 Channel Map: front-left,front-right
 Owner Module: 8
 Mute: no
 Volume: front-left: 99957 / 153% / 11.00 dB, front-right: 99957 / 153% / 11.00 dB
         balance 0.00
 Base Volume: 26090 / 40% / -24.00 dB
 Monitor of Sink: n/a
 Latency: 0 usec, configured 0 usec
 Flags: HARDWARE HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY

seem

chmap -Dsurround41:CARD=CA0106 query

fail but

chmap -Dsurround41:CARD=CA0106 get

return channel map

in ca0106.conf

there is no definition of ca0106.pcm.surround41

just

 <confdir:pcm/surround21.conf>
  <confdir:pcm/surround41.conf>
 <confdir:pcm/surround50.conf>

Do surround21 , surround41 appear in

aplay -L

static unsigned int i2c_adc_init[][2] = {
 { 0x17, 0x00 }, /* Reset */
 { 0x07, 0x00 }, /* Timeout */
 { 0x0b, 0x22 }, /* Interface control */
 { 0x0c, 0x22 }, /* Master mode control */
 { 0x0d, 0x08 }, /* Powerdown control */
 { 0x0e, 0xcf }, /* Attenuation Left 0x01 = -103dB, 0xff = 24dB */
 { 0x0f, 0xcf }, /* Attenuation Right 0.5dB steps */
 { 0x10, 0x7b }, /* ALC Control 1 */
 { 0x11, 0x00 }, /* ALC Control 2 */
 { 0x12, 0x32 }, /* ALC Control 3 */
 { 0x13, 0x00 }, /* Noise gate control */
 { 0x14, 0xa6 }, /* Limiter control */
 { 0x15, ADC_MUX_LINEIN }, /* ADC Mixer control */

seem default is linein and 0dB

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/ca0106/ca0106_mixer.c?id=fff36e472b4315df77513f4339c5c199c6aad28b

static DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale2, -10350, 50, 1);

the scale only define step 1 is -103.50 dB and step size 0.5dB

Download full text (3.5 KiB)

for unknown reason which pulseaudio did not probe surround40

pulseaudio still using timer base scheduling in your last log

but it was strange tradtional mode was used in your first log

20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.name = "CA0106"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.id = "ca0106"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.subdevice = "0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.subdevice_name = "subdevice #0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.device = "0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.card = "0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.card_name = "CA0106"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.long_card_name = "Live! 7.1 24bit [SB0410] at 0xcf00 irq 19"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: alsa.driver_name = "snd_ca0106"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.bus_path = "pci-0000:06:00.0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: sysfs.path = "/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/0000:06:00.0/sound/card0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.bus = "pci"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.vendor.id = "1102"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.vendor.name = "Creative Labs"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.product.id = "0007"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.product.name = "CA0106 Soundblaster (SB0410 SBLive! 24-bit)"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.string = "front:0"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.buffering.buffer_size = "65536"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.buffering.fragment_size = "32768"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.access_mode = "mmap+timer"
Jan 02 20:25:49 homecomp pulseaudio[11971]: [pulseaudio] sink.c: device.profile.name = "analog-stereo"

Dec 25 19:33:27 homecomp pulseaudio[1911]: module-stream-restore.id = "sink-input-by-application-name:paplay"
Dec 25 19:33:27 homecomp pulseaudio[1911]: Requested tlength=2000.00 ms, minreq=20.00 ms
Dec 25 19:33:27 homecomp pulseaudio[1911]: Traditional mode enabled, modifying sink usec only for compat with minreq.
Dec 25 19:33:27 homecomp pulseaudio[1911]: Requested latency=1960.00 ms, Received latency=341.33 ms
Dec 25 19:33:27 homecomp pulseaudio[1911]: memblockq requested: maxlength=4194304, tlength=192000, base=2, prebuf=190082, minreq=1920 maxrewind=0
Dec 25 19:33:27 homecomp pulseaudio[1911]: memblockq sanitized: maxlength=4194304, tlength=192000, base=2, prebuf=190082, minreq=1920 maxrewind=0
Dec 25 19:33:27 homecomp pulseaudio[1911]: Final latency 2341.33 ms = 1960.00 ms + 2*20.00 ms + 341.33 ms
De...

Read more...

Download full text (6.0 KiB)

(In reply to Raymond from comment #57)
> Do surround21 , surround41 appear in
>
> aplay -L

null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default:CARD=CA0106
    CA0106, CA0106
    Default Audio Device
sysdefault:CARD=CA0106
    CA0106, CA0106
    Default Audio Device
front:CARD=CA0106,DEV=0
    CA0106, CA0106
    Front speakers
rear:CARD=CA0106,DEV=0
    CA0106, CA0106
    Rear speakers
center_lfe:CARD=CA0106,DEV=0
    CA0106, CA0106
    Center and Subwoofer speakers
side:CARD=CA0106,DEV=0
    CA0106, CA0106
    Side speakers
surround21:CARD=CA0106,DEV=0
    CA0106, CA0106
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=CA0106,DEV=0
    CA0106, CA0106
    4.0 Surround output to Front and Rear speakers
surround41:CARD=CA0106,DEV=0
    CA0106, CA0106
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CA0106,DEV=0
    CA0106, CA0106
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CA0106,DEV=0
    CA0106, CA0106
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CA0106,DEV=0
    CA0106, CA0106
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CA0106,DEV=0
    CA0106, CA0106
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=CA0106,DEV=0
    CA0106, CA0106
    Direct sample mixing device
dmix:CARD=CA0106,DEV=1
    CA0106, CA0106
    Direct sample mixing device
dmix:CARD=CA0106,DEV=2
    CA0106, CA0106
    Direct sample mixing device
dmix:CARD=CA0106,DEV=3
    CA0106, CA0106
    Direct sample mixing device
dsnoop:CARD=CA0106,DEV=0
    CA0106, CA0106
    Direct sample snooping device
dsnoop:CARD=CA0106,DEV=1
    CA0106, CA0106
    Direct sample snooping device
dsnoop:CARD=CA0106,DEV=2
    CA0106, CA0106
    Direct sample snooping device
dsnoop:CARD=CA0106,DEV=3
    CA0106, CA0106
    Direct sample snooping device
hw:CARD=CA0106,DEV=0
    CA0106, CA0106
    Direct hardware device without any conversions
hw:CARD=CA0106,DEV=1
    CA0106, CA0106
    Direct hardware device without any conversions
hw:CARD=CA0106,DEV=2
    CA0106, CA0106
    Direct hardware device without any conversions
hw:CARD=CA0106,DEV=3
    CA0106, CA0106
    Direct hardware device without any conversions
plughw:CARD=CA0106,DEV=0
    CA0106, CA0106
    Hardware device with all software conversions
plughw:CARD=CA0106,DEV=1
    CA0106, CA0106
    Hardware device with all software conversions
plughw:CARD=CA0106,DEV=2
    CA0106, CA0106
    Hardware device with all software conversions
plughw:CARD=CA0106,DEV=3
    CA0106, CA0106
    Hardware device with all software conversions
default:CARD=PCH
    HDA Intel PCH, ALC889 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC889 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC889 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC889 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC889 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC889 Analog
...

Read more...

Download full text (6.3 KiB)

what is the smallest buffer size which aplay without underrun ? 1024,512,256,128,64,...

aplay -D front:CARD=CA0106 -v --buffer-size=1024 stereo48000.wav

19:29:42 homecomp pulseaudio[1911]: Protocol version: remote 26, local 29
Dec 25 19:29:42 homecomp pulseaudio[1911]: Got credentials: uid=1000 gid=1000 success=1
Dec 25 19:29:42 homecomp pulseaudio[1911]: SHM possible: yes
Dec 25 19:29:42 homecomp pulseaudio[1911]: Negotiated SHM: yes
Dec 25 19:29:42 homecomp pulseaudio[1911]: Looking for .desktop file for Transistor.bin.x86_64
Dec 25 19:29:42 homecomp pulseaudio[1911]: Not setting device for stream ALSA Playback, because it lacks role.
Dec 25 19:29:42 homecomp pulseaudio[1911]: Negotiated format: pcm, format.sample_format = "\"s16le\"" format.rate = "48000" format.channels = "2" format.channel_map = "\"front-left,front-right\""
Dec 25 19:29:42 homecomp pulseaudio[1911]: Sink alsa_output.pci-0000_06_00.0.analog-stereo becomes busy, resuming.
Dec 25 19:29:42 homecomp pulseaudio[1911]: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
Dec 25 19:29:42 homecomp pulseaudio[1911]: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
Dec 25 19:29:42 homecomp pulseaudio[1911]: Created input 15 "ALSA Playback" on alsa_output.pci-0000_06_00.0.analog-stereo with sample spec s16le 2ch 48000Hz and channel map front-left,front-right
Dec 25 19:29:42 homecomp pulseaudio[1911]: media.name = "ALSA Playback"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.name = "ALSA plug-in [Transistor.bin.x86_64]"
Dec 25 19:29:42 homecomp pulseaudio[1911]: native-protocol.peer = "UNIX socket client"
Dec 25 19:29:42 homecomp pulseaudio[1911]: native-protocol.version = "26"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.id = "9536"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.user = "rkfg"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.host = "homecomp"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.binary = "Transistor.bin.x86_64"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.language = "en_GB.UTF-8"
Dec 25 19:29:42 homecomp pulseaudio[1911]: window.x11.display = ":0.0"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.machine_id = "3be8f38f291dd2003af500d051c0a849"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.session_id = "10"
Dec 25 19:29:42 homecomp pulseaudio[1911]: module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in [Transistor.bin.x86_64]"
Dec 25 19:29:42 homecomp pulseaudio[1911]: Requested tlength=85.33 ms, minreq=21.33 ms
Dec 25 19:29:42 homecomp pulseaudio[1911]: Early requests mode enabled, configuring sink latency to minreq.
Dec 25 19:29:42 homecomp pulseaudio[1911]: Requested latency=21.33 ms, Received latency=26.00 ms
Dec 25 19:29:42 homecomp pulseaudio[1911]: memblockq requested: maxlength=4194304, tlength=16384, base=4, prebuf=11396, minreq=4992 maxrewind=0
Dec 25 19:29:42 homecomp pulseaudio[1911]: memblockq sanitized: maxlength=4194304, tlength=16384, base=4, prebuf=11396, minreq=4992...

Read more...

This command doesn't work, it says "aplay: set_params:1239: Channels count non available". The -D default:CARD=CA0106 variant works and it does not overrun. I only had overruns on recording (at least, explicit). That said, I've made a huge improvement in my system, I compiled a pf-kernel and set CONFIG_PREEMPT=y, CONFIG_HZ_1000=y and CONFIG_HZ=1000. The default Debian kernel is on 250 Hz and is not preemptible. Now that my kernel supports preemption I (crossing fingers) don't have ALSA over- and underruns anymore. They were quite sudden and audible as clicks/gaps. I saw this in the log:

Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: Scheduling delay of 11.42 ms > 11.31 ms, you might want to investigate this to improve latency...
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: Underrun!
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: Increasing minimal latency to 1.00 ms
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: Latency set to 21.33ms
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: hwbuf_unused=57352
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: setting avail_min=7651
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: Latency set to 21.33ms
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: hwbuf_unused=57352
Jan 4 20:25:15 homecomp pulseaudio[26848]: [alsa-sink-ca0106] alsa-sink.c: setting avail_min=7651

With the preempt kernel this doesn't happen at all (I grepped the log) and sound is just as good as with pure ALSA.

However, arecord still drops overrun for CA0106. It doesn't do it for PCH (ALC889) though.

if you cannot find stereo 48000Hz wav file

aplay -D plughw:CARD=CA0106 -v --buffer-size=1024 any.wav

try to find minimum buffer size 1024,512, 256,128,64,... without underrun

1024 frames = 21.33 ms x 48000Hz
4096 = 85.33 ms x 48000Hz

if request tlength 85.33ms is buffer time and 21.33ms is period time

not sure why pulseaudio received latency is 26ms

alsa_output.pci-0000_06_00.0.analog-stereo with sample spec s16le 2ch 48000Hz and channel map front-left,front-right
Dec 25 19:29:42 homecomp pulseaudio[1911]: media.name = "ALSA Playback"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.name = "ALSA plug-in [Transistor.bin.x86_64]"
Dec 25 19:29:42 homecomp pulseaudio[1911]: native-protocol.peer = "UNIX socket client"
Dec 25 19:29:42 homecomp pulseaudio[1911]: native-protocol.version = "26"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.id = "9536"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.user = "rkfg"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.host = "homecomp"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.binary = "Transistor.bin.x86_64"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.language = "en_GB.UTF-8"
Dec 25 19:29:42 homecomp pulseaudio[1911]: window.x11.display = ":0.0"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.machine_id = "3be8f38f291dd2003af500d051c0a849"
Dec 25 19:29:42 homecomp pulseaudio[1911]: application.process.session_id = "10"
Dec 25 19:29:42 homecomp pulseaudio[1911]: module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in [Transistor.bin.x86_64]"
Dec 25 19:29:42 homecomp pulseaudio[1911]: Requested tlength=85.33 ms, minreq=21.33 ms
Dec 25 19:29:42 homecomp pulseaudio[1911]: Early requests mode enabled, configuring sink latency to minreq.
Dec 25 19:29:42 homecomp pulseaudio[1911]: Requested latency=21.33 ms, Received latency=26.00 ms

# aplay -D plughw:CARD=CA0106 -v --buffer-size=128 /usr/share/sounds/alsa/Side_Left.wav
Playing WAVE '/usr/share/sounds/alsa/Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Plug PCM: Route conversion PCM (sformat=S16_LE)
  Transformation table:
    0 <- 0
    1 <- 0
Its setup is:
  stream : PLAYBACK
  access : RW_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 1
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 128
  period_size : 32
  period_time : 666
  tstamp_mode : NONE
  period_step : 1
  avail_min : 32
  period_event : 0
  start_threshold : 128
  stop_threshold : 128
  silence_threshold: 0
  silence_size : 0
  boundary : 4611686018427387904
Slave: Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
  stream : PLAYBACK
  access : MMAP_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 128
  period_size : 32
  period_time : 666
  tstamp_mode : NONE
  period_step : 1
  avail_min : 32
  period_event : 0
  start_threshold : 128
  stop_threshold : 128
  silence_threshold: 0
  silence_size : 0
  boundary : 4611686018427387904
  appl_ptr : 0
  hw_ptr : 0

128 seems to be fine. It's not consistent, sometimes 64 works ok, sometimes it overruns (says so in the console and hitches). 128 has never overrun, neither visually (saying it in the console), nor audible (clicks/pops).

Tried with a stereo 48k file (converted /usr/share/sounds/KDE-Im-Cant-Connect.ogg to wav, tested with ffprobe that it's truly 48k/2chan) and 64 bytes buffer size:
# aplay -D plughw:CARD=CA0106 -v --buffer-size=64 /tmp/kde.wav
Playing WAVE '/tmp/kde.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
  stream : PLAYBACK
  access : RW_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 64
  period_size : 16
  period_time : 333
  tstamp_mode : NONE
  period_step : 1
  avail_min : 16
  period_event : 0
  start_threshold : 64
  stop_threshold : 64
  silence_threshold: 0
  silence_size : 0
  boundary : 4611686018427387904
  appl_ptr : 0
  hw_ptr : 0
underrun!!! (at least 0.010 ms long)
Status:
  state : XRUN
  trigger_time: 260136.459825170
  tstamp : 260136.459834181
  delay : 0
  avail : 64
  avail_max : 64
underrun!!! (at least 0.020 ms long)
Status:
  state : XRUN
  trigger_time: 260136.460064991
  tstamp : 260136.460084242
  delay : 0
  avail : 64
  avail_max : 64

No underruns with 128b buffer.

how about CD audio (44100Hz stereo) using plughw?

Download full text (5.4 KiB)

Interesting. I've converted that file to 44100 Hz and now it reveals a strange behavior. When I play it with buffer size of 64 it sounds like the pitch is lower than it should be (even if it doesn't overrun though it does from time to time). When the size is 128 it sounds fine.

# aplay -D plughw:CARD=CA0106 -v --buffer-size=64 /tmp/kde44100.wav
Playing WAVE '/tmp/kde44100.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
  stream : PLAYBACK
  access : RW_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 44100
  exact rate : 44100 (44100/1)
  msbits : 16
  buffer_size : 58
  period_size : 14
  period_time : 333
  tstamp_mode : NONE
  period_step : 1
  avail_min : 14
  period_event : 0
  start_threshold : 58
  stop_threshold : 58
  silence_threshold: 0
  silence_size : 0
  boundary : 4179340454199820288
Slave: Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
  stream : PLAYBACK
  access : MMAP_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 64
  period_size : 16
  period_time : 333
  tstamp_mode : NONE
  period_step : 1
  avail_min : 16
  period_event : 0
  start_threshold : 64
  stop_threshold : 64
  silence_threshold: 0
  silence_size : 0
  boundary : 4611686018427387904
  appl_ptr : 0
  hw_ptr : 0
underrun!!! (at least 0.116 ms long)
Status:
  state : XRUN
  trigger_time: 301642.243139271
  tstamp : 301642.243254519
  delay : 2
  avail : 56
  avail_max : 56

# aplay -D plughw:CARD=CA0106 -v --buffer-size=128 /tmp/kde44100.wav
Playing WAVE '/tmp/kde44100.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
  stream : PLAYBACK
  access : RW_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 44100
  exact rate : 44100 (44100/1)
  msbits : 16
  buffer_size : 117
  period_size : 29
  period_time : 666
  tstamp_mode : NONE
  period_step : 1
  avail_min : 29
  period_event : 0
  start_threshold : 117
  stop_threshold : 117
  silence_threshold: 0
  silence_size : 0
  boundary : 4215369251218784256
Slave: Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
  stream : PLAYBACK
  access : MMAP_INTERLEAVED
  format : S16_LE
  subformat : STD
  channels : 2
  rate : 48000
  exact rate : 48000 (48000/1)
  msbits : 16
  buffer_size : 128
  period_size : 32
  period_time : 666
  tstamp_mode : NONE
  period_step : 1
  avail_min : 32
  period_event : 0
  start_threshold : 128
  stop_threshold : 128
  silence_threshold: 0
  silence_size : 0
  boundary : 4611686018427387904
  appl_ptr : 0
  hw_ptr : 0

This pitch (or maybe speed?) weirdness occurs only on playing stereo fil...

Read more...

-- 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/308.

Changed in alsa-driver:
status: Confirmed → Unknown
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.