stsaz / fmedia

fast audio player/recorder/converter
BSD 2-Clause "Simplified" License
216 stars 21 forks source link

Filtering/Convolution possible while streaming? #95

Closed patzf closed 11 months ago

patzf commented 1 year ago

Is there some mechanism to "inject" some processing between recording a stream and outputting a (processed) stream? In other words, is it possible to use the tool as an audio I/O framework that allows some "on-the-fly" DSP processing of a recorded signal?

stsaz commented 1 year ago

Yes, of course, but it requires you to write your own filter for fmedia.

The best example is how dynamic audio normalizer filter works. If you look at the diagram here: https://github.com/stsaz/fmedia/blob/master/doc/arch/arch.md it's marked as DynANorm. I took the original DAN library and wrote an adapter for fmedia so it can be included into the processing chain, and it also converts the input signal to float64 sample format on the fly. The code is here: https://github.com/stsaz/fmedia/blob/master/src/afilter/dynanorm.c

However, if you're going to implement your own filter, I suggest you first try phiola (https://github.com/stsaz/phiola/) instead, it's the upcoming major update of fmedia. The SDK interface there is better and easier to use.