in reply to Audio input and processing - recommendations
After reading Corion's answer I thought that it might be faster to let the command line do the FFT and pass that data to perl. I modified Corion's command-line to pipe into sox which can do basic FFT. I have also modified the ffmpeg options to output in sox format -f sox from reading my soundcard #0 -i hw:0 with alsa, thusly:
ffmpeg -hide_banner -loglevel error -nostats -f alsa -i hw:0 -t 30 -ac + 1 -ar 44100 -f sox - | sox -t sox - -n stat -freq
Also, see this: https://www.linuxquestions.org/questions/linux-software-2/why-does-sox-stat-freq-give-me-different-data-multiple-times-927589/ for example.
Alternatively, you can use Corion's code to read raw audio bytes and plug them into PDL::FFTW3 to get FFT with a state-of-the-art C library (FFTW3).
Following the latter route, you obviously have more control on what processing to do, albeit slower (hmm benchmarks?).
The other route is to replace sox with custom C code (based on FFTW3 library) to do the FFT and any other processing you want closer to the hardware.
Finally, there are lots of other command-line-based software in Linux to build a processing pipeline for your needs.
Last but not least: PureData (PD) https://puredata.info/
bw, bliako
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Audio input and processing - recommendations
by haj (Vicar) on Nov 22, 2023 at 12:36 UTC | |
by etj (Priest) on Jan 13, 2025 at 16:53 UTC |