alsa

ALSA sequencer: Avoid input buffer overrun with High-Speed MIDI

扶醉桌前 提交于 2021-02-11 14:39:44
问题 I want to send large SysEx messages (which can be several Megabytes) through the ALSA sequencer: Currently I split them into several ALSA events and send each of them in a loop like that: while (1) { result = snd_seq_event_output_direct( seq, const_cast<snd_seq_event_t*>(&ev) ); if (result != -EAGAIN && result != -EWOULDBLOCK) break; snd_seq_sync_output_queue( seq ); //std::this_thread::sleep_for(sleeptime); } This loop ensures that all events get sent from the sending client/port. But as

Alsa full duplex communication

陌路散爱 提交于 2021-02-10 05:30:47
问题 I want to implement full duplex communication using alsa. I first wrote capture and playback programs and i am transferring data from captured process to playback process using UDP communication. It is working fine when i was running two processes where one is capturing and another is playing(consider this as half duplex from A to B) , the problem comes when i was trying to implement another half duplex(Half duplex from B to A) then I am getting Broken Pipe error while reading the data from

Alsa full duplex communication

醉酒当歌 提交于 2021-02-10 05:30:26
问题 I want to implement full duplex communication using alsa. I first wrote capture and playback programs and i am transferring data from captured process to playback process using UDP communication. It is working fine when i was running two processes where one is capturing and another is playing(consider this as half duplex from A to B) , the problem comes when i was trying to implement another half duplex(Half duplex from B to A) then I am getting Broken Pipe error while reading the data from

Upgrading (overriding) an entire recipe in a custom layer

眉间皱痕 提交于 2021-02-09 11:09:27
问题 I have a custom layer in project. This gets shared with colleagues. My distro (poky) it uses a older version of alsa. This gets downloaded on initial setup of the build area. I would like to 'replace' that version of alsa with a later version and do this within my custom layer, so that they don't have to edit/replace recipes in poky. What's the best way to do this? If I just download the newer recipe and include it in my layer (matching the file system names) will it automatically use the

ALSA: non-interleaved access not supported?

强颜欢笑 提交于 2021-02-07 21:57:21
问题 ALSA's snd_pcm_hw_params_set_access function fails when called with SND_PCM_ACCESS_RW_NONINTERLEAVED access type, reporting that there was an invalid argument. The same code works fine with SND_PCM_ACCESS_RW_INTERLEAVED access. I tried to change the order of calls to snd_pcm_hw_params_* functions with no effect. Next I thought that my hardware might not support non-interleaved playback, but according to this post ALSA subsystem will interleave non-interleaved data before sending it to the

Recording each channel without mixing

巧了我就是萌 提交于 2021-01-29 10:52:16
问题 I am a new in this field, maybe what I ask it's impossible to implement. What I try to do is - recording an audio with n-channels to WAV file with n-channels. I use arecord utility: arecord --format=S16_LE --channels=8 --rate=16000 --file-type=wav myfile.wav In my input I see different channels: But in output of recording I see all channels are mixed: Is it possible to record WAV file without mixing channels? Is it possible to record each channel to separate channel? 来源: https://stackoverflow

How to query ALSA channels, period and buffer on Raspberry Pi?

荒凉一梦 提交于 2021-01-28 05:39:26
问题 I'm writing an audio decoding program for ALSA, which among others detects audio capabilities. It uses the snd_pcm_hw_params_get_XXX() functions for that. This works well on my Ubuntu PC but on Raspberry Pi 3 these calls return no information. They return success but the min and max values are meaningless. For instance the period: int err; snd_pcm_t *pcm; snd_pcm_hw_params_t *hw_params; const char* device_name = "hw:0,0"; // open audio device err = snd_pcm_open(&pcm, device_name, SND_PCM

C语言,环形队列

不羁的心 提交于 2021-01-03 16:34:10
什么是环形队列? 环形缓冲区是一个非常典型的数据结构,这种数据结构符合生产者,消费者模型,可以理解它是一个水坑,生产者不断的往里面灌水,消费者就不断的从里面取出水。 那就可能会有人问,既然需要灌水,又需要取出水,为什么还需要开辟一个缓冲区内存空间呢? 直接把生产者水管的尾部接到消费者水管的头部不就好了,这样可以省空间啊。 答案是不行的, 生产者生产水的速度是不知道的,消费者消费水的速度也是不知道的,如果你强制接在一起,因为生产和消费的速度不同,就非常可能存在水管爆炸的情况,你说这样危险不危险? 在音频系统框架下,alsa就是使用环形队列的,在生产者和消费者速度不匹配的时候,就会出现xrun的问题。 环形队列的特点 1、数组构造环形缓冲区 假设我们用数组来构造一个环形缓存区,如下图 我们需要几个东西来形容这个环形缓冲区,一个的读位置,一个是写位置,一个是环形缓冲区的长度 从图片看,我们知道,这个环形缓冲区的读写位置是指向数组的首地址的,环形缓冲区的长度是 5 。 那如何判断环形缓冲区为空呢? 如果 R == W 就是读写位置相同,则这个环形缓冲区为空 那如何判断环形缓冲区满了呢? 如果 (W - R )= Len ,则这个环形缓冲区已经满了。 2、向环形缓冲区写入 3个数据 写入 3 个数据后,W 的值等于 3 了,R 还是等于 0。 3个企鹅已经排列 3、从环形缓冲区读取2个数据

Nondeterministic pyaudio/ALSA failure

北城余情 提交于 2020-12-13 03:17:48
问题 I test some vanilla python code making a sound, specifically the code from this other question. As I run that code from the command line a la python code.py , it issues this series of messages coming directly from ALSA. So far that's not unusual, as I understand it is ignoring some unavailable devices that are somehow present in the involved ALSA config files, and skipping on using jack after not finding it present: ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave ALSA lib