Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

PC Based Computer music servers, crossovers, and equalization

Let's build a FIR convolver for Pulseaudio Crossover Rack
Let's build a FIR convolver for Pulseaudio Crossover Rack
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 9th October 2019, 06:27 PM   #21
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by Tfive View Post
Don't really know about the licencing situation with the GPL vs the BSD licence I release all my projects under. I hate the GPL for the reason that you can never be really sure if you can use the stuff released under it or not, all the crap of programs vs. libraries etc. The real open source licence is the BSD licence IMO.

The API looks quite reasonable, will have a look at it some time
It's not rocket science. Just read the GPL2 license text:

GNU General Public License v2.0 - GNU Project - Free Software Foundation

Supposedly it's GPL v3 that is making people quite unhappy, not version 2.

Here is some info comparing BSD and GPL:
What is the difference between a BSD and a GPL license types? - Quora
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 9th October 2019 at 06:41 PM.
  Reply With Quote
Old 9th October 2019, 07:45 PM   #22
Tfive is offline Tfive  Germany
diyAudio Member
 
Tfive's Avatar
 
Join Date: Jun 2018
Location: Straubing
I know, I'm probably a bit too opinionated about the GPL. I just think it's way too long. Apart from the fact that it was meant to ensure contributions back to the project, actually a lot of companies just use stuff that's GPLed and don't give a **** about licence terms. So what's the whole point of putting it into a long licence text? Just release your stuff to the public and be done with it. Just my two cents.

Thanks for the hint about the library though. Appreciated!

Will take some time though till I can look into it because I'm mainly designing and building hardware at the moment... There's some uber cool stuff in the works

PS: Whaaaat? I can't write $h1t here?
__________________
Want more of the good stuff? -> https://t-5.eu/
  Reply With Quote
Old 9th October 2019, 07:50 PM   #23
Julf is offline Julf  Europe
diyAudio Member
 
Join Date: Oct 2011
Location: Amsterdam, The Netherlands
I am a big fan of the BSD license.
  Reply With Quote
Old 10th October 2019, 09:50 AM   #24
orjan is offline orjan  Sweden
diyAudio Member
 
Join Date: Mar 2005
Location: Stockholm
While not LADSPLA ( I think ) you can look on the convolvers from;
Fons Adrians: http://kokkinizita.linuxaudio.org/li...-1.0.3.tar.bz2
or Anders Torger: BruteFIR

Fons convolver might need libraries from the same download page.

/örjan
  Reply With Quote
Old 10th October 2019, 11:08 AM   #25
Tfive is offline Tfive  Germany
diyAudio Member
 
Tfive's Avatar
 
Join Date: Jun 2018
Location: Straubing
Thanks örjan, I already looked at both.
__________________
Want more of the good stuff? -> https://t-5.eu/
  Reply With Quote
Old 12th October 2019, 07:28 PM   #26
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
I'm finally (or so I think) figuring out what steps are used to perform FIR filtering on a data stream. I found a couple of web pages to be informative:

The illustrations at the bottom of this page were helpful:
Example of Overlap-Add Convolution

Also this page, with illustrations of overlap-add:
fft - Overlap/add time-domain audio frames: How does normalization/scaling work with overlap greater than 50%? - Signal Processing Stack Exchange

This leaves me with a couple of questions:
a. What is the usual, or preferred, window function for the input data?
b. If the window is N samples wide and I will be operating on chunnks of data M samples wide, will the output FFT be M+2N in size? I am always a bit unsure of the vector sizes involved with convolution...
c. What are sane choices for M and N?
d. In the second link it is explained that there are several different overlap widths that can be used - some may require scaling. What is the usual/preferred overlap and why?

At this point, the general procedure seems to be:
1. Window input data/stream
2. Perform FIR filtering via convolution with kernel and windowed data
3. Move result into overlap-add buffer
4. When enough data has been placed into output buffer to satisfy overlap, copy data out of overlap-add buffer and into output data/stream

Are the steps above correct? Note I am assuming that I already know the filter kernel ahead of time. This will be determined via other means.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 12th October 2019 at 07:32 PM.
  Reply With Quote
Old 12th October 2019, 09:06 PM   #27
Tfive is offline Tfive  Germany
diyAudio Member
 
Tfive's Avatar
 
Join Date: Jun 2018
Location: Straubing
You should probably start your own thread about this. Not because I don't like the discussion to happen in this thread but because you'd probably get more attention to your questions then. If you do, please tell me so I can follow... Also, if you ask on stackexchange (which is more likely to get your questions answered) or similar, please also keep us posted here, because at least I am interested to learn this stuff also.
__________________
Want more of the good stuff? -> https://t-5.eu/
  Reply With Quote
Old 13th October 2019, 03:12 PM   #28
dc655321 is offline dc655321  United States
diyAudio Member
 
Join Date: Jul 2018
The problem discussed at that link is that of analyzing the spectral content of a signal. It is related to but not directly applicable to the problem of convolving an impulse response with a streaming input signal. An example use-case might be to display spectral power as function of time (think real-time EQ display on an AVR).

However, FIR impulse responses are typically windowed prior to convolving with input data blocks.

Quote:
Originally Posted by CharlieLaub View Post
This leaves me with a couple of questions:
a. What is the usual, or preferred, window function for the input data?
b. If the window is N samples wide and I will be operating on chunnks of data M samples wide, will the output FFT be M+2N in size? I am always a bit unsure of the vector sizes involved with convolution...
c. What are sane choices for M and N?
d. In the second link it is explained that there are several different overlap widths that can be used - some may require scaling. What is the usual/preferred overlap and why?
a. For overlap-add (or overlap-save), the input signal blocks are not windowed. Or rather, they are, but the rectangular window is used (equivalent to unity multiplication), so the operation is implicit only.

b. Forget window sizes here. The rule for vector lengths in convolution is that for an input block of size B and a filter (IR) of size N, the convolution product K must be
Code:
K >= B + N - 1
.
c. The input block sizes are not typically yours to control - the blocks are provided by the audio application (eg: VLC or Spotify --> Pulseaudio (convolve here) --> ALSA (or convolve here) --> DAC

d. Again, forget windowing the input stream. This is a misunderstanding of the fundamentals.
  Reply With Quote
Old 13th October 2019, 10:39 PM   #29
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Thanks for your reply, dc655321. If I am understanding correctly:

A. I will get a block of data from whatever processing handling the audio buffering. For LADSPA the size is whatever the LADSPA host decides. The block size (B) is known to the LADSPA plugin.
B. I convolve the input data block with the kernel of length K to yield a convolution output of length B+K-1.
C. Successive convolution outputs are summed together to form the output data stream.

That's it? Seems so simple. No windowing. Wow. Hard to believe it is not more complicated! Or am I missing something?
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 14th October 2019, 02:51 AM   #30
dc655321 is offline dc655321  United States
diyAudio Member
 
Join Date: Jul 2018
Quote:
Originally Posted by CharlieLaub View Post
If I am understanding correctly:

A. I will get a block of data from whatever processing handling the audio buffering. For LADSPA the size is whatever the LADSPA host decides. The block size (B) is known to the LADSPA plugin.
Sort of?
You, the algorithm designer, must chose what size of blocks your algorithm will work with. The audio application may feed your code blocks of any size though (~4 kilo-frames, for example), so one must be prepared to handle that situation.

Quote:
Originally Posted by CharlieLaub View Post
B. I convolve the input data block with the kernel of length K to yield a convolution output of length B+K-1.
No. The output of your algorithm can only be a large as the size of the input block it was given (assuming no output buffering). The rule, y >= b + n - 1, when applied over a segment of input will contain aliased values. Thus the need to overlap and add (or save/discard).

Eg: if your algorithm works in 4 ksample blocks of input, and your FIR filter is 8 ktaps (taps, samples, same thing), clearly you cannot multiply two vectors of unequal length (convolution in frequency domain IS multiplication). So, the 4 ksamples of input are padded with 4 kilo-zeros, yielding an input+zeros length of 8 ksamples. This can then be multiplied with the FIR transform, inverse FFT'd, and B samples of convolved output extracted.

Quote:
Originally Posted by CharlieLaub View Post
C. Successive convolution outputs are summed together to form the output data stream.
No.
There is always an overlap (hey, it's in the name!) of M-1 points.
It's a stateful algorithm.

With overlap-save, there is no addition, post-convolution, required.

Quote:
Originally Posted by CharlieLaub View Post
That's it? Seems so simple. No windowing. Wow. Hard to believe it is not more complicated! Or am I missing something?
I'm afraid you're missing a few things. But, this is not something that will make sense without a solid understanding of convolution.
  Reply With Quote

Reply


Let's build a FIR convolver for Pulseaudio Crossover RackHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulseaudio Crossover Rack - multi-way crossover design & implementation with linux Tfive PC Based 541 Yesterday 07:59 PM
Build your own stereo rack! Sir Trefor Construction Tips 26 25th March 2017 02:03 PM
okay im going to build a rack in my van for work... Etocynned Subwoofers 44 15th December 2013 08:14 AM
Windows based crossover/convolver kappen PC Based 19 12th March 2012 06:55 AM


New To Site? Need Help?

All times are GMT. The time now is 01:57 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 15.00%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Copyright ©1999-2019 diyAudio
Wiki