alsa

Implement realtime signal processing in Python - how to capture audio continuously?

旧街凉风 提交于 2019-12-23 07:48:21
问题 I'm planning to implement a "DSP-like" signal processor in Python. It should capture small fragments of audio via ALSA, process them, then play them back via ALSA. To get things started, I wrote the following (very simple) code. import alsaaudio inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NORMAL) inp.setchannels(1) inp.setrate(96000) inp.setformat(alsaaudio.PCM_FORMAT_U32_LE) inp.setperiodsize(1920) outp = alsaaudio.PCM(alsaaudio.PCM_PLAYBACK, alsaaudio.PCM_NORMAL) outp

send midi messages from C++

假如想象 提交于 2019-12-23 03:37:18
问题 I'm using a raspberry pi, so it is sort of Debian (Raspbian) I have a synthesizer running (Zynaddsubfx) and I want to send him midi messages from code and have it playing the music for me. I will use ALSA for that. I managed to create a "emitting port" in my program by doing: snd_seq_create_simple_port(seq_handle, "My own sequencer", SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ, SND_SEQ_PORT_TYPE_APPLICATION) now I can see ZynSubAddFX in aconnect -ol and my own sequencer in aconnect -il .

Python RPi ALSA - Use of multiple channels

不羁岁月 提交于 2019-12-23 02:25:13
问题 I have this piece of a code and I want to work independently with each of the four mic array I use (Ps3 Eye Cam). For example I want to calculate cross-correlation between the mic 1 and the mic 4 excluding 2 and 3. How can I use channels I want? import audioop import alsaaudio inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE,alsaaudio.PCM_NONBLOCK) inp.setchannels(1) inp.setrate(8000) inp.setformat(alsaaudio.PCM_FORMAT_S16_LE) inp.setperiodsize(1000) Thanks 来源: https://stackoverflow.com/questions

Is it possible to arecord output from dummy card?

会有一股神秘感。 提交于 2019-12-22 14:15:32
问题 I'm trying to mix audio files via dummy card by using dmix and dsnoop: aplay s1.wav & aplay s2.wav & arecord -f dat -t wav -d 3 result.wav But is it possible? I have only dummy card by: modprobe snd-dummy My ~/.asoundrc file is: defaults.pcm.card 1 #dummy card pcm.duplex { type asym playback.pcm "dmix" capture.pcm "dsnoop" } pcm.!default { type plug slave.pcm "duplex" } Running on: CentOS6.5(x86_64) 回答1: The snd-dummy driver throws away playback data, and records silence. For a loopback

USB audio For Android Platform

核能气质少年 提交于 2019-12-22 12:43:25
问题 I am using Android 4.2.2 on Qualcomm APQ8064 Chip set. I want to enable audio output to the USB headset. I tried using aplay command but no luck. The driver for usb-audio is already there in the code. Everything is integrated but i don't get any output on the usb-headset. Any flags that need to be set?? Any lead will be of great help. @Micheal:Following are the logs for the same, I just noticed that below logs from AudioUsbALSA can also be seen when the USB headset is not connected. 3502:I

USB audio For Android Platform

落花浮王杯 提交于 2019-12-22 12:43:16
问题 I am using Android 4.2.2 on Qualcomm APQ8064 Chip set. I want to enable audio output to the USB headset. I tried using aplay command but no luck. The driver for usb-audio is already there in the code. Everything is integrated but i don't get any output on the usb-headset. Any flags that need to be set?? Any lead will be of great help. @Micheal:Following are the logs for the same, I just noticed that below logs from AudioUsbALSA can also be seen when the USB headset is not connected. 3502:I

Makefile conditional include

一曲冷凌霜 提交于 2019-12-22 02:20:30
问题 I'm trying to write an application that needs either ALSA or OSS headers. Basically, I want to pass a define to the compiler if /etc/oss.conf does not exist, since that probably means the soundcard.h header doesn't exist (feel free to correct me on that one, I'm still new to working with OSS). Per the OSS documentation, you would use the include directive like so: include /etc/oss.conf CFLAGS := -I$(OSSLIBDIR)/include/sys One problem. OSS support is optional, so I'd want to check if the

PyAudio prints ALSA warnings and does not work

六眼飞鱼酱① 提交于 2019-12-21 23:16:19
问题 hey guys i'm trying to run a basic python speech to text code. This is the code. import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as source: audio = r.listen(source) try: print("You said " + r.recognize(audio)) except LookupError: print("Could not understand audio") The code works fine till it reaches the print stage and then throws this error. Is there anything that i have done wrong? ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm

Recording from ALSA - understanding memory mapping

自闭症网瘾萝莉.ら 提交于 2019-12-21 04:32:22
问题 Im attempting to use ALSA to take the input from a USB audio device and write it out to disk as a series of signed short values. What I'm ending up with are blocks of what appear to be valid data interspersed with large blocks of zeros. I'm guessing that I have my buffers setup incorrectly and am not using the memory mapping properly. What I'm trying: sample rate: 8K (this is forced by the device) buffer size: 2048 period size: 512 one channel The device appears to be opened properly and

Writing an ALSA Driver

痞子三分冷 提交于 2019-12-20 00:23:02
前言 本文档介绍了如何编写 ALSA(高级Linux声音体系结构) 驱动程序。该文档主要关注PCI声卡。对于其他设备类型,API也可能不同。但是,至少ALSA内核API是一致的,因此编写它们仍然会有所帮助。 本文档面向已经具备足够的C语言技能并且具有基本的Linux内核编程知识的人员。本文档没有解释Linux内核编码的一般主题,也没有介绍底层驱动程序的实现细节。它仅描述了在ALSA上编写PCI声音驱动程序的标准方法。 如果您已经熟悉了较旧的ALSA ver.0.5.x API,则可以检查ALSA 0.5.x树中的驱动程序,例如 sound/pci/es1938.c 或 sound/pci/maestro3.c ,它们也具有几乎相同的代码库,因此可以比较它们之间的差异。 该文档仍是草案版本。任何反馈和更正,请! 文件树结构 一般 来源: CSDN 作者: 慢慢的燃烧 链接: https://blog.csdn.net/u010164190/article/details/103620976