in reply to Audio input and processing - recommendations

Thanks for all the recommendations

I will go the FFmpeg way, running it on bare ALSA for now. (And if not, it is just changing some parameters for the FFmpeg input file)

The latency of such solution does not bother me too much at this stage, but i want to address another issue :

I want the processing of the audio stream to be continuous, uninterrupted

Lets's say i can do some processing within the file read loop, but after the time interval (30 sec) i have to re run FFmpeg again. I might miss part of the audio completely, or cut it in the middle of a note which will then lead to an error in the data processing algorithm

Also, if i try to do a burst of intensive processing at some point within the interval, i might hang the file read loop and miss some data then too

I have seen an FFmpeg module on CPAN, https://metacpan.org/pod/FFmpeg Wonder if this could be of any use or better in any way vs. reading FFmpeg output through a pipe ?

For now i'm just experimenting with FFmpeg and getting output from it
  • Comment on Re: Audio input and processing - recommendations

Replies are listed 'Best First'.
Re^2: Audio input and processing - recommendations
by hippo (Archbishop) on Nov 27, 2023 at 11:22 UTC
    I have seen an FFmpeg module on CPAN, https://metacpan.org/pod/FFmpeg

    Unfortunately, FFmpeg has no passing tests and a couple of open tickets from many years ago reporting the fact. That isn't to say you couldn't get it to work but it might take some effort and even then the module appears to be rather unsupported.


    🦛

Re^2: Audio input and processing - recommendations
by NERDVANA (Priest) on Nov 28, 2023 at 07:09 UTC

    I guess I'll mention VideoLAN::LibVLC, though I only implemented callbacks to process video frames. The design is all set to be able to handle the audio frames, but that code isn't written yet. It would help with the real-time aspect though, if you wanted details like the timestamp of the audio frame at the time it was decoded/captured. If you go that route I'm happy to offer advice on the code, but I don't really have time to develop it myself.

    Also, I haven't tested it on new versions of libvlc since 2019, so there might be even more work to do, depending on which version of libvlc you want to use.

    I'd also recommend getting familiar with Inline::C if you aren't already.