MinimServer Forum
Convolution and Upsampling - Printable Version

+- MinimServer Forum (https://forum.minimserver.com)
+-- Forum: MinimServer (/forumdisplay.php?fid=1)
+--- Forum: MinimStreamer (/forumdisplay.php?fid=11)
+--- Thread: Convolution and Upsampling (/showthread.php?tid=5327)

Pages: 1 2


Convolution and Upsampling - mm2 - 10-07-2019 17:50

Hi all,

I use upsamling by soxr with great results.
syntax:
convOut=-af aresample=resampler=soxr:precision=32

Now I want to use convolution,
syntax:
convOut=-i /share/ConvolutionFiles/Cor1S*.wav -lavfi afir=gtype=gn

What is the correct syntax for „convOut“ if I want to use convolution and upsampling ?
All my previous attempts have unfortunately resulted in an error Huh

thanks
Max


RE: Convolution and Upsampling - simoncn - 11-07-2019 09:30

You need to create an FFmpeg filtergraph using the following syntax:

convOut=-i /share/ConvolutionFiles/Cor1S*.wav -lavfi afir=gtype=gn[2];[2]aresample=resampler=soxr:precision=32

This sends the output of the afir filter to an internal FFmpeg stream [2], which is then used as the input to the aresample filter.


RE: Convolution and Upsampling - mm2 - 12-07-2019 14:07

FFmpeg filtergraph was new to me. It works perfectly ;-)

Is there a possibility to do upsampling first ?
like: convOut=-af aresample=resampler=soxr:precision=32[2];[2]/share/ConvolutionFiles/Cor1S*.wav -lavfi afir=gtype=gn

Thanks a lot


RE: Convolution and Upsampling - simoncn - 12-07-2019 16:55

This is possible but there are limitations in what can be achieved.

What are the sample rates and bit depths of your original files? Are you using soxr to upsample them all to the same sample rate (what sample rate)? Are you also using soxr to increase the bit depth (what bit depth)?

This information will enable me to suggest the optimal approach for your situation.


RE: Convolution and Upsampling - mm2 - 13-07-2019 13:22

most files are 44k 16bit, some files are 48k and 96k.
soxr is for upsamling and all files are upsampled by maximum even multiple to 352K or 384k and 24bit
e.g. flac(16;44):wav24;352


RE: Convolution and Upsampling - Snoopy08 - 14-07-2019 05:56

(13-07-2019 13:22)mm2 Wrote:  most files are 44k 16bit, some files are 48k and 96k.
soxr is for upsamling and all files are upsampled by maximum even multiple to 352K or 384k and 24bit
e.g. flac(16;44):wav24;352

Curious to find out what was the difference between Soxr and ffmpeg upsampling


RE: Convolution and Upsampling - mm2 - 14-07-2019 16:28

(14-07-2019 05:56)Snoopy08 Wrote:  Curious to find out what was the difference between Soxr and ffmpeg upsampling

try soxr with "precision" parameter


RE: Convolution and Upsampling - simoncn - 16-07-2019 13:13

There is no solution at present that allows you to upsample to different sample rates before applying the convolution filter..

For the 44;16 files, you could use

convOut=-i /share/ConvolutionFiles/Cor1S352.wav -lavfi [0]aresample=resampler=soxr:precision=32:osr=352800[2];[2][1]afir=gtype=gn

The change from Cor1S*.wav to Cor1S352.wav is needed because without this, MinimStreamer will select Cor1S44.wav to match the sample rate of the input audio file. The addition of osr=352800 is needed because without this, soxr would leave the sample rate of 44100 Hz unchanged, the convolution would be performed at 44100 Hz and FFmpeg would upsample the output from the convolution filter from 44100 Hz to 352800 Hz.

This setting could be used to test whether applying the filters in this order improves sound quality but could not be a permanent setting because it isn't suitable for 48 kHz and 96 kHz audio files.


RE: Convolution and Upsampling - mm2 - 16-07-2019 17:31

(16-07-2019 13:13)simoncn Wrote:  There is no solution at present that allows you to upsample to different sample rates before applying the convolution filter..

For the 44;16 files, you could use

convOut=-i /share/ConvolutionFiles/Cor1S352.wav -lavfi [0]aresample=resampler=soxr:precision=32:osr=352800[2];[2][1]afir=gtype=gn

The change from Cor1S*.wav to Cor1S352.wav is needed because without this, MinimStreamer will select Cor1S44.wav to match the sample rate of the input audio file. The addition of osr=352800 is needed because without this, soxr would leave the sample rate of 44100 Hz unchanged, the convolution would be performed at 44100 Hz and FFmpeg would upsample the output from the convolution filter from 44100 Hz to 352800 Hz.

This setting could be used to test whether applying the filters in this order improves sound quality but could not be a permanent setting because it isn't suitable for 48 kHz and 96 kHz audio files.

thank you for your proposal.
I'm curious, is convolution at 44k or 352k recognizable.


RE: Convolution and Upsampling - simoncn - 16-07-2019 20:07

You can answer this question by comparing the following settings:

convOut=-i /share/ConvolutionFiles/Cor1S352.wav -lavfi [0]aresample=resampler=soxr:precision=32:osr=352800[2];[2][1]afir=gtype=gn

convOut=-i /share/ConvolutionFiles/Cor1S*.wav -lavfi afir=gtype=gn[2];[2]aresample=resampler=soxr:precision=32

The first does convolution at 352k and the second does convolution at 44k. I look forward to seeing your conclusions.