Comments (14)
Looks like snd_config_is_array was added recently in 1.2.3 : https://alsa-project.org/wiki/Changes_v1.2.2_v1.2.3
You can either check your repos for a more up-to-date version, or apply the patch below to remove the check.
diff --git a/impulse_pcm.c b/impulse_pcm.c
index 26d85ef..5839288 100644
--- a/impulse_pcm.c
+++ b/impulse_pcm.c
@@ -301,10 +301,10 @@ SND_PCM_PLUGIN_DEFINE_FUNC(impulse) {
}
if(strcmp("impulse", id) == 0) {
- if(!snd_config_is_array(n)) {
- SNDERR("impulse must be of type array");
- return -EINVAL;
- }
+ /* if(!snd_config_is_array(n)) { */
+ /* SNDERR("impulse must be of type array"); */
+ /* return -EINVAL; */
+ /* } */
impulses = n;
continue;
from alsaimpulse.
There's probably a setting in whichever software you used to generate the impulse. Or you can also trim the silence manually:
sed -e 's/\(\x00\x00\x00\x00\)*$//' bose_5.pcm > trimmed.pcm
from alsaimpulse.
The current Makefile assumes you are compiling on amd64, it will likely require tweaking for other architectures. You are probably fine removing -m32 and the lib32 lines in the makefile.
The snd_config_is_array
is part of alsa-lib (libasound) and defined in /usr/include/alsa/conf.h
, usually included through /usr/include/alsa/asoundlib.h
. Maybe you need to install a separate package for library headers? (libasound2-dev)
from alsaimpulse.
Okay, I removed the -m32 flag for now.
I do have libasound2-dev
installed.
grep snd_config_is_array /usr/include/alsa/conf.h
produces no hits (the file does exist).
grep -iR snd_config_is_array /usr/include/alsa/*
also produces no hits.
EDIT: I checked version.h
and it looks like I have version 1.1.8
from alsaimpulse.
Getting closer. I do not have the /usr/lib/alsa-lib
directory, so make install
fails.
Is libasound_module_pcm_impulse.so
supposed to be loaded as a plugin?
from alsaimpulse.
It can be done automatically if it's installed in the right path (check your distribution). Or you can also add this at the top of your .asoundrc
:
pcm_type.impulse {
lib "/path/to/libasound_module_pcm_impulse.so"
}
from alsaimpulse.
I'm getting warmer.
I found out by accident that the .so file needs to exist under /usr/lib/arm-linux-gnueabihf/alsa-lib/
After putting it there and testing aplay
I got this error: ALSA lib dlmisc.c:287:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_impulse.so ((null): /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_impulse.so: undefined symbol: src_strerror)
(which must come from here)
I'm guessing my pcm file isn't correct. I exported from Room EQ Wizard with these settings:
That produced a wav file.
I also tried converting it with ffmpeg per the readme, but I get the same error.
from alsaimpulse.
That linking error is unusual. Are you sure you have libsamplerate installed correctly? You can debug with ldd /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_impulse.so
.
from alsaimpulse.
I just got back to this and I made some progress. I started over, using a clean docker image. This time I found the debian packages and installed them instead of trying to compile/install from source. apt install libsamplerate-dev libfftw3-dev
I commented out the call to snd_config_is_array
, compiled, manually installed and setup my .asoundrc
file.
Now I can run aplay /usr/share/sounds/alsa/Front_Center.wav
and and there are no errors - however I also do not get any sound. If I remove pcm.!default entry
, I get the unfiltered sound (proves sound card works). If I specify the wrong file name for the filter, I get an audio open error (proves the impulse plugin is being called)
At this point I'm not sure if this is an issue with the format of the filter file, the plugin or my alsa config.
Any ideas?
Here is my .asoundrc:
pcm.impulse {
type impulse
slave {
pcm "plughw:0"
}
impulse.0 {
path "/aairplay2/bose_5.wav"
rate 44100
#gain -20.0 # preamp gain in dB, optional (default 0.0 dB)
}
impulse.1 {
path "/airplay2/bose_5.wav"
rate 44100
#gain -20.0
}
}
pcm.!default {
type plug
slave { pcm impulse }
}
Here are my impulse filters.
https://www.dropbox.com/sh/iuq5fzvehmfs27g/AAA5xQn4HLFeh3oWkjMd4Twba?dl=0
The .wav is direct from REW and the .PCM is from converted from the wav using ffmpeg (not sure if this is necessary)
from alsaimpulse.
Your filter works for me. But you need to use the .pcm
file in your ALSA configuration.
from alsaimpulse.
Using the PCM file and aplay /usr/share/sounds/alsa/Front_Center.wav
output: Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
But no sound. So then I tried streaming a song and I can hear blips of sound, but its really choppy and mostly silent.
from alsaimpulse.
I don't know much about single-core performance of the RPi 4's CPU, but if the output is choppy it might not be capable of real-time playback with your settings. Two things you can do:
- Use a filter with fewer taps (64K taps will still work fine). Your filter uses much less than that, but has nearly 3 seconds of digital silence at the end. You can safely remove that to save a ton of resources.
- Use bigger periods when playing back audio. For example try
aplay -F 250000 music.wav
ormpv --ao=alsa --alsa-buffer-time=500000 --alsa-periods=2 music.wav
from alsaimpulse.
FWIW, the rpi4 is powerful enough to use realtime convolution filters with shairport sync. Shairport Sync is using FFTConvolver.
I have to figure out how to edit PCM files in order to trim the silence out. I must admit that I don't know much about how these impulse filters work technically - it's just sort of black magic at this point :)
from alsaimpulse.
That trimmed pcm does seem to work better. Audio will output smoothly, however only for a single channel. If I enable both channels I don't get any audio at all. Not sure why - it could be the overhead I suppose, but the container doesn't seem like its CPU bound.
from alsaimpulse.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alsaimpulse.