Questions tagged [libalsa]

The ALSA (Advanced Linux Sound Architecture) library

The ALSA (Advanced Linux Sound Architecture) library

http://www.alsa-project.org/main/index.php/Main_Page

68 questions
1
vote
1 answer

How to understand the seemingly default/implicit ALSA MIDI default queue?

Background In the snippet below, I send a MIDI note with a duration to a synthesizer port. For this to work, I need to allocate and start a queue, or else I get an “Invalid argument.” (error code -22) from ALSA. The operations to send the event,…
Hibou57
  • 6,870
  • 6
  • 52
  • 56
1
vote
1 answer

pcm_plug.c:67: snd_pcm_plug_close: Assertion `plug->gen.slave == plug->req_slave' failed

I'm using ALSA for the first time and am seeing the error: pcm_plug.c:67: snd_pcm_plug_close: Assertion `plug->gen.slave == plug->req_slave' failed. This occurs when I attempt to close the PCM: snd_pcm_close(pcm); What could be causing this…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
0
votes
1 answer

ALSA PCM Device configuration

I am working on Linux ALSA. In my alsa.conf configured as file: defaults.pcm.card 0 defaults.pcm.device 0 This card and deviece (0,0) refers to NVIDIA sound card HDMI out and I never used normally. In addition, when I use aplay with hw:0,0 option,…
kaernk
  • 63
  • 6
0
votes
0 answers

ALSA Errors in my Python code using Raspberry Pi

I have written this tts code and downloaded all neccersarry packages on my system. It uses openai to be able and have converstations with me and works perfectly on my windows computer. However, when I run the code on my raspberry pie it comes up…
0
votes
1 answer

ALSA lib: Getting mixer volume returns wrong value

I have a upnp streaming app, written in C, in which I use alsa-lib to get and set the ALSA Master output volume. I use the APIs snd_mixer_selem_get_playback_volume and snd_mixer_selem_set_playback_volume_all to do so. As long as I only get/set the…
A. Faure
  • 133
  • 2
  • 6
0
votes
0 answers

ALSA ignores configuration

I have an audio box that can be connected via USB to my laptop. I've written a C application that uses the ALSA API to open a communication channel with this audio box. The communication should be established at 8kHz, running with a 10ms period size…
Alexandru Rusu
  • 569
  • 1
  • 5
  • 21
0
votes
2 answers

Alsa buffer underrun

I am trying to write random noise to to a device and allow my loop to sleep when I have written enough data. My understanding is that for each call to snd_pcm_writei I am writing 162 bytes (81 frames) which at 8khz rate and 16bit format it should…
Lithium
  • 5,102
  • 2
  • 22
  • 34
0
votes
1 answer

ALSA input from MIDI keyboard

I'm writing a software synth in Linux using libasound. I want to control it with a MIDI keyboard. I have some working code using snd_seq_open() and snd_seq_event_input() but it only creates a virtual MIDI port. I have to go to the commandline and…
Adam Pierce
  • 33,531
  • 22
  • 69
  • 89
0
votes
1 answer

C++ alsa api bad recorded quality

I'm trying to record microphone with alsa api on linux, but result is strange sounds like freezed glitchy robot. Recorded pcm data sended by UDP protocol to pcm player endpoint. char* device = "default"; unsigned int rate = 44100; …
NullShan0x
  • 31
  • 1
  • 4
0
votes
0 answers

what is the meaning of "type loop" in the asoundrc file?

I am new to ALSA and its userspace configuration. I saw one pcm device in my asoundrc like below pcm.myalsadev{ type loop device 0 ipc_perm 0660 ipc_gid audio subdevice 0 rate 16000 channels 1 format S16_LE } What is…
zappy
  • 1,864
  • 3
  • 18
  • 36
0
votes
1 answer

For Alsa pcm device, period_size is set to 128, yet sometimes the poll happens late

I am facing an issue where the period size has been set to 128, still sometimes the polling starts late. For this configuration, where the period size is set to 128 and rate is 16 Khz, therefore polling should occur after each 128/16 = 8 ms, but…
0
votes
1 answer

Function outputting sound through alsa not working when called via pthread create: no sound, 100% CPU usage

I have a program that receives messages via a socket and starts or stops playing a certain sound file depending on the message. In order for the "stop" message to work, I need the sound to play from a separate thread. My solution is to play the…
turf
  • 101
  • 3
0
votes
2 answers

Why does the sound skip in ALSA?

I am trying to play this sound using the program below, but the sound is a little fast and it skips. The sound file's sample rate is 11025 Hz, stereo, the sample size is 16 bit. The issue appears to be snd_pcm_hw_params_set_buffer_size() and…
stare
  • 150
  • 8
0
votes
0 answers

How to implement mute/unmute mic recording functionality using ALSA

I am new to alsa and trying to implement audio recording from mic. I want to implement mute function and wrote below api. I am not sure if using snd_pcm_pause for mute is the correct way to implement mute. I am able to stop audio recording but when…
Utkarsh Patel
  • 99
  • 1
  • 2
  • 7
0
votes
1 answer

Go - int16 slice to byte slice

I'm writing a Go program that interfaces with libalsa. I have my PCM data stored in a []int16 slice, but to call libalsa I need that stored in a []byte slice. How do I convert a []int16 slice to []byte to accomplish this?
user96931
  • 103
  • 7