LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-28-2024, 11:12 PM   #1
Ravichandra
LQ Newbie
 
Registered: Jan 2024
Posts: 1

Rep: Reputation: 0
ALSA - PCM Underrun Issue


We're encountering a PCM underrun issue in Interleaved Mode while playing a single-channel audio through Alsa-lib. The error message "(snd_pcm_recover) underrun occurred" is being displayed when writing data to the speaker.

Here's what we've attempted so far:
  1. Successfully played the same audio using aplay.
  2. Generated complete buffers from text-to-speech engine and played them without issues using alsa-lib.

The problem arises when we simultaneously generate audio buffers from a Text-to-Speech Conversion engine and feed the data to the speaker through alsa-lib. PCM underrun occurs intermittently in this scenario.

We are using a sampling rate of 22kHz. Are there any specific ALSA configurations or settings that can be adjusted to prevent PCM underrun in this context?
 
Old 02-07-2024, 04:31 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,595

Rep: Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616Reputation: 2616
Hello, Ravichandra & welcome to LQ.

You're off the map here for standard uses of alsa. Your problem happens when you have
Code:
Text-to-speech ---->----> alsa-lib
I can't imagine the speed of text to speech being constant, so there must be instances where you run out of speech and the buffer has to feed. I imagine that's creating the buffer under-run.

If it keeps going, fine. I imagine it pukes, and exits. Solutions
  • Use bigger buffers, or fill them before starting to hear them.
  • Patch or hack to allow silence. This would give you unwanted pauses, which are probably better than unwanted exits.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Volume Controls "PCM 1" Instead of "PCM" in alsamixer on Linux Mint GNOME wehnsdaefflae Linux Mint 0 10-22-2023 07:45 PM
Freezing video/ERROR pipe A+B underrun+CPU pipe FIFO underrun Linux Noobie Linux - Kernel 1 03-28-2016 02:51 PM
[SOLVED] How to mix S/PDIF input and PCM Out (to hear PCM and S/PDIF simultaneously)? *Dark Dragon* Linux - General 11 07-20-2012 07:53 AM
(Sound) what is PCM? what's the difference between PCM volume and master volume? snr8fl3 Linux - General 2 01-27-2009 06:12 AM
ALSA: buffer underrun error ashlesha Linux - Software 0 04-22-2007 09:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration