Audio CD read jumping

Since upgrading in place to Leap 15.6 recently I have had a raft of problems. The latest is with audio CDs, I can’t rip or play them without stutters/skips. This occurs irrespective of the CD device (I’ve tried a Pioneer Blu-Ray internal drive and a Lacie external USB DVD drive) or the software used to access/play. It occurs irrespective of the CD trying to be played (commercial, burnt audio cd etc.). Furthermore it occurs regularly!

Seems to be it must be something pretty fundamental? Here is a log from mplayer:

:~> mplayer -cdrom-device /dev/sr0 cdda://
MPlayer 1.5.r38666-Packman-7 (C) 2000-2024 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing cdda://.
Found audio CD with 11 tracks.
rawaudio file format detected.

Track 1
==========================================================================
Trying to force audio codec driver family libmad...
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:  15.9 (15.8) of 2564.9 (42:44.9) 15.1% 
Audio device got stuck!
A:  31.9 (31.8) of 2564.9 (42:44.9) 15.1% 
Audio device got stuck!
A:  34.1 (34.1) of 2564.9 (42:44.9) 14.0% 


MPlayer interrupted by signal 2 in module: play_audio
A:  34.4 (34.3) of 2564.9 (42:44.9) 14.0% 

Exiting... (Quit)

Also, I have another operating system installed (dual boot) and the CD devices work fine playing the same audio CDs.

Power saving issue?
Which hardware in use?
Post

inxi -aFz

44100*4=176400. Do you need that frequency?
Quite often 176400 Hz is not supported by hardware.

Can confirm on a standard Leap 15.6 Gnome install (playing via Totem with standard 44100 rate).
Also happens on Tumbleweed.
Looks like a buffer underrun, possibly at disk level? I will report back if I find something useful.

Looks like it is gstreamer related.

bruno@LT-B:/run/user/1000/gvfs/cdda:host=sr0> gst-play-1.0 --gapless 'Track 5.wav'
Press 'k' to see a list of keyboard shortcuts.
Now playing /run/user/1000/gvfs/cdda:host=sr0/Track 5.wav
Redistribute latency...
Redistribute latency...
0:00:52.3 / 0:04:18.5       
bruno@LT-B:/run/user/1000/gvfs/cdda:host=sr0>

shows gaps, as is Totem that uses gstreamer as backend.
ffmpeg and players that use ffmpeg as backend (e.g. deadbeef) play without problems.

bruno@LT-B:/run/user/1000/gvfs/cdda:host=sr0> ffplay 'Track 5.wav'
ffplay version 7.1 Copyright (c) 2003-2024 the FFmpeg developers
<snip>
Input #0, wav, from 'Track 5.wav': 0KB vq=    0KB sq=    0B 
  Metadata:
    encoder         : gvfs-cdda using libcdio 2.2.0 x86_64-suse-linux-gnu
  Duration: 00:04:18.53, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
  87.95 M-A:  0.000 fd=   0 aq=  416KB vq=    0KB sq=    0B 
bruno@LT-B:/run/user/1000/gvfs/cdda:host=sr0>

aplay also shows gaps:

bruno@LT-B:/run/user/1000/gvfs/cdda:host=sr0> aplay 'Track 5.wav'
Playing WAVE 'Track 5.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
underrun!!! (at least 1739012470297,550 ms long)
underrun!!! (at least 1739012473513,839 ms long)
^CAborted by signal Interrupt...
aplay: pcm_write:2178: write error: Interrupted system call
bruno@LT-B:/run/user/1000/gvfs/cdda:host=sr0>

I’ve done some more investigating and I think it might be because they are using cdparanoia as their backend and there is a buffer problem as @OrsoBruno suggests. Perversely, reducing the buffer forces it to keep reading and allow cd audio to play:

mplayer -cache 1024 -cdrom-device /dev/sr0 cdda://

See post above, but for the sake of completeness, the frequency is whatever mplayer decides, I’m not altering anything there (can you change it?), here is the inxi output:

System:
  Kernel: 6.4.0-150600.23.33-default arch: x86_64 bits: 64 compiler: gcc
    v: 7.5.0 parameters: BOOT_IMAGE=/boot/vmlinuz-6.4.0-150600.23.33-default
    root=UUID=d89a5721-8bfa-45d4-840c-836d40daeeb2 splash=silent
    resume=/dev/disk/by-uuid/11b52a47-935d-4cf7-9e6d-e807cdb1d3ee
    preempt=full mitigations=auto quiet security=apparmor
  Desktop: KDE Plasma v: 5.27.11 tk: Qt v: 5.15.12 wm: kwin_x11 vt: 2
    dm: SDDM Distro: openSUSE Leap 15.6
Machine:
  Type: Desktop System: Gigabyte product: Z270X-UD3 v: N/A
    serial: <superuser required>
  Mobo: Gigabyte model: Z270X-UD3-CF v: x.x serial: <superuser required>
    UEFI: American Megatrends v: F7 date: 07/07/2017
Battery:
  Device-1: hidpp_battery_0 model: Logitech MX Vertical Advanced Ergonomic
    Mouse serial: <filter> charge: 55% (should be ignored) rechargeable: yes
    status: discharging
CPU:
  Info: model: Intel Core i7-7700 bits: 64 type: MT MCP arch: Kaby Lake
    gen: core 7 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 9 microcode: 0xF8
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
    L3: 8 MiB desc: 1x8 MiB
  Speed (MHz): avg: 800 min/max: 800/4200 scaling: driver: intel_pstate
    governor: powersave cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800
    8: 800 bogomips: 57600
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling mitigation: Microcode
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS; IBPB: conditional; STIBP: conditional;
    RSB filling; PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort mitigation: TSX disabled
Graphics:
  Device-1: NVIDIA TU117 [GeForce GTX 1650] vendor: Micro-Star MSI
    driver: nvidia v: 550.144.03 alternate: nouveau,nvidia_drm non-free: 530.xx+
    status: current (as of 2023-05) arch: Turing code: TUxxx
    process: TSMC 12nm FF built: 2018-22 pcie: gen: 3 speed: 8 GT/s lanes: 16
    ports: active: none off: DP-2 empty: DP-1,DVI-D-1,HDMI-A-1 bus-ID: 01:00.0
    chip-ID: 10de:1f82 class-ID: 0300
  Display: x11 server: X.Org v: 1.21.1.11 with: Xwayland v: 24.1.1
    compositor: kwin_x11 driver: X: loaded: nvidia
    unloaded: fbdev,modesetting,vesa alternate: nouveau,nv
    gpu: nvidia,nvidia-nvswitch display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3840x2160 s-dpi: 139 s-size: 702x392mm (27.64x15.43")
    s-diag: 804mm (31.65")
  Monitor-1: DP-2 mapped: DP-0.8 note: disabled model: Dell U3223QE
    serial: <filter> built: 2022 res: 3840x2160 hz: 60 dpi: 140 gamma: 1.2
    size: 698x393mm (27.48x15.47") diag: 801mm (31.5") ratio: 16:9 modes:
    max: 3840x2160 min: 640x480
  API: OpenGL v: 4.6.0 NVIDIA 550.144.03 renderer: NVIDIA GeForce GTX
    1650/PCIe/SSE2 direct-render: Yes
Audio:
  Device-1: Intel 200 Series PCH HD Audio vendor: Gigabyte
    driver: snd_hda_intel v: kernel alternate: snd_soc_avs bus-ID: 00:1f.3
    chip-ID: 8086:a2f0 class-ID: 0403
  Device-2: NVIDIA vendor: Micro-Star MSI driver: snd_hda_intel v: kernel
    pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:10fa
    class-ID: 0403
  Device-3: Creative Pebble X driver: hid-generic,snd-usb-audio,usbhid
    type: USB rev: 1.1 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-9.1:4
    chip-ID: 041e:3299 class-ID: 0102 serial: <filter>
  API: ALSA v: k6.4.0-150600.23.33-default status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 1.0.5 status: off with: wireplumber status: active
    tools: pw-cat,pw-cli,wpctl
  Server-2: PulseAudio v: 17.0 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl,pavucontrol
Network:
  Device-1: Intel Ethernet I219-V vendor: Gigabyte driver: e1000e v: kernel
    port: N/A bus-ID: 00:1f.6 chip-ID: 8086:15b8 class-ID: 0200
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IF-ID-1: vboxnet0 state: down mac: <filter>
RAID:
  Supported mdraid levels: raid1
  Device-1: md0 maj-min: 9:0 type: mdraid level: mirror status: active
    size: 2.73 TiB
  Info: report: 2/2 UU blocks: 2930265524 chunk-size: N/A super-blocks: 1.0
  Components: Online:
  2: sdb1 maj-min: 8:17 size: 2.73 TiB
  3: sda1 maj-min: 8:1 size: 2.73 TiB
  Device-2: md2 maj-min: 9:2 type: mdraid level: mirror status: active
    size: 3.64 TiB
  Info: report: 2/2 UU blocks: 3907018432 chunk-size: N/A super-blocks: 1.0
  Components: Online:
  0: sdc maj-min: 8:32 size: 3.64 TiB
  1: sdd maj-min: 8:48 size: 3.64 TiB
Drives:
  Local Storage: total: raw: 13.19 TiB usable: 6.82 TiB used: 4.41 TiB (64.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 960 EVO 500GB
    size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: 2B7QCXE7 temp: 29.9 C
    scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Toshiba model: DT01ACA300
    size: 2.73 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 7200 serial: <filter> fw-rev: ABB0 scheme: GPT
  ID-3: /dev/sdb maj-min: 8:16 vendor: Toshiba model: DT01ACA300
    size: 2.73 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 7200 serial: <filter> fw-rev: ABB0 scheme: GPT
  ID-4: /dev/sdc maj-min: 8:32 vendor: Seagate model: ST4000VN008-2DR166
    size: 3.64 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 5980 serial: <filter> fw-rev: SC60
  ID-5: /dev/sdd maj-min: 8:48 vendor: Seagate model: ST4000VN008-2DR166
    size: 3.64 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 5980 serial: <filter> fw-rev: SC60
Partition:
  ID-1: / raw-size: 180.01 GiB size: 180.01 GiB (100.00%)
    used: 19.79 GiB (11.0%) fs: btrfs dev: /dev/nvme0n1p6 maj-min: 259:6
  ID-2: /boot/efi raw-size: 100 MiB size: 99.8 MiB (99.79%)
    used: 5.9 MiB (5.9%) fs: vfat dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-3: /home raw-size: 2.73 TiB size: 2.69 TiB (98.39%)
    used: 1.45 TiB (54.1%) fs: ext4 dev: /dev/md0 maj-min: 9:0
  ID-4: /opt raw-size: 3.64 TiB size: 3.58 TiB (98.40%)
    used: 2.94 TiB (82.1%) fs: ext4 dev: /dev/md2 maj-min: 9:2
  ID-5: /tmp raw-size: 180.01 GiB size: 180.01 GiB (100.00%)
    used: 19.79 GiB (11.0%) fs: btrfs dev: /dev/nvme0n1p6 maj-min: 259:6
  ID-6: /var raw-size: 24.26 GiB size: 24.2 GiB (99.74%)
    used: 1.11 GiB (4.6%) fs: xfs dev: /dev/nvme0n1p8 maj-min: 259:8
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 32 GiB used: 26.8 MiB (0.1%)
    priority: -2 dev: /dev/nvme0n1p7 maj-min: 259:7
Sensors:
  System Temperatures: cpu: 38.0 C mobo: N/A gpu: nvidia temp: 32 C
  Fan Speeds (RPM): N/A gpu: nvidia fan: 35%
Info:
  Processes: 380 Uptime: 7h 19m wakeups: 14 Memory: available: 31.3 GiB
  used: 5.67 GiB (18.1%) Init: systemd v: 254 default: graphical
  tool: systemctl Compilers: gcc: 7.5.0 alt: 13/7 Packages: pm: rpm pkgs: N/A
  note: see --rpm tools: yast,zypper pm: flatpak pkgs: 0 Shell: Bash v: 4.4.23
  running-in: konsole inxi: 3.3.27

Confirming that, ffplay and deadbeef use vastly shorter buffers as seen by pw-top:

S   ID  QUANT   RATE    WAIT    BUSY   W/Q   B/Q  ERR FORMAT           NAME 
R   74    256  44100 128,2us  47,9us  0,02  0,01   26     S32P 3 44100 alsa_output.pci-0000_00_1b.0.analog-surround-21
R  123   5512  44100  43,8us  32,3us  0,01  0,01    1    S16LE 2 44100  + alsa_playback.aplay
<snip>
R   74    256  44100 117,6us  28,2us  0,02  0,00   26     S32P 3 44100 alsa_output.pci-0000_00_1b.0.analog-surround-21
R  123   3969  44100  39,3us  50,7us  0,01  0,01    0    S16LE 2 44100  + gst-play-1.0
<snip>
R   74    256  44100 105,9us  27,2us  0,02  0,00   26     S32P 3 44100 alsa_output.pci-0000_00_1b.0.analog-surround-21
R  123    512  44100  29,7us  21,2us  0,01  0,00    0    S16LE 2 44100  + ffplay
<snip>
R   74    128  44100  67,0us  27,6us  0,02  0,01   26     S32P 3 44100 alsa_output.pci-0000_00_1b.0.analog-surround-21
R  123      0  44100  14,5us   6,0us  0,01  0,00    0    S24LE 2 44100  + DeaDBeeF Music Player

The column to watch is the third one ‘QUANT’, the buffer is 5512 frames for aplay, goes down to 512 for ffplay, while deadbeef adds zero buffer of its own and relies only on the output buffer of just 128 frames.
For the tests above the track was copied to an ssd, so no underrun even on aplay.
So the trick apparently is keeping the cd drive spinning, one way or the other.

2 Likes

Optical disk reader (CDROM) goes to sleep due to too big buffer?

Not necessarily, it might just need a new seek cycle that takes time since audio CDs are not random access.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.