Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convolution and Upsampling
10-07-2019, 17:50
Post: #1
Convolution and Upsampling
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
Find all posts by this user
Quote this message in a reply
11-07-2019, 09:30
Post: #2
RE: Convolution and Upsampling
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.
Find all posts by this user
Quote this message in a reply
12-07-2019, 14:07
Post: #3
RE: Convolution and Upsampling
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
Find all posts by this user
Quote this message in a reply
12-07-2019, 16:55
Post: #4
RE: Convolution and Upsampling
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.
Find all posts by this user
Quote this message in a reply
13-07-2019, 13:22
Post: #5
RE: Convolution and Upsampling
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
Find all posts by this user
Quote this message in a reply
14-07-2019, 05:56
Post: #6
RE: Convolution and Upsampling
(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
Find all posts by this user
Quote this message in a reply
14-07-2019, 16:28
Post: #7
RE: Convolution and Upsampling
(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
Find all posts by this user
Quote this message in a reply
16-07-2019, 13:13
Post: #8
RE: Convolution and Upsampling
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.
Find all posts by this user
Quote this message in a reply
16-07-2019, 17:31
Post: #9
RE: Convolution and Upsampling
(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.
Find all posts by this user
Quote this message in a reply
16-07-2019, 20:07 (This post was last modified: 16-07-2019 20:08 by simoncn.)
Post: #10
RE: Convolution and Upsampling
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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)