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

FIR-LADSPA: A LADSPA plugin for FIR filtering
FIR-LADSPA: A LADSPA plugin for FIR filtering
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 14th March 2020, 05:30 PM   #11
HenrikEnquist is offline HenrikEnquist  Sweden
diyAudio Member
 
Join Date: Apr 2016
Location: Lund
No check again! There is an extra loop that loops over the partitions (which I call segments). Check line 106 to 111 in the develop branch. Compare develop and master to see the changes I did for partitioned.

Here is a nice description of the process:
fourier transform - How does minimum-latency partitioned convolution reverb work when you receive input samples in chunks, rather than one at a time? - Signal Processing Stack Exchange
  Reply With Quote
Old 14th March 2020, 07:06 PM   #12
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by HenrikEnquist View Post
No check again! There is an extra loop that loops over the partitions (which I call segments). Check line 106 to 111 in the develop branch. Compare develop and master to see the changes I did for partitioned.

Here is a nice description of the process:
fourier transform - How does minimum-latency partitioned convolution reverb work when you receive input samples in chunks, rather than one at a time? - Signal Processing Stack Exchange
Nice. I'm very impressed. Thank you very much for sharing your code freely! If I were more familiar with Rust and everything about partitioned convolution I would try to port it to C/C++. For now I think I will just try to get the LADSPA plugin up and running and see how it does.

I have an idea on how to do only 1 forward transform (of the audio data) and use it for N filtering processes. This would save N-1 forward transforms each time.

There will still be the usual and expected latency of FFT. Once I get everything up and running I can re-evaluate my options in terms of the FFT and iFFT calculations.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 14th March 2020, 07:30 PM   #13
HenrikEnquist is offline HenrikEnquist  Sweden
diyAudio Member
 
Join Date: Apr 2016
Location: Lund
Quote:
Originally Posted by CharlieLaub View Post
For now I think I will just try to get the LADSPA plugin up and running and see how it does.
That is definitely a good idea. Once it's working you can extend it. I would recommend writing some automated tests that you can run to check that your convolver gives the right output. That's a quick and easy way to check that any change you make doesn't break anything. For inspiration you can look at the tests at the bottom of my convolver sourve file. I try to run them before every time I want to push a new version to GitHub, and then there is a GitHub Action that runs them automatically for every push.
  Reply With Quote
Old 19th March 2020, 03:26 PM   #14
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
UPDATE:

I have implemented FFTW based convolution in the code and gotten everything to compile. I hope to move on to testing soon.

As part of getting set up for FFTW I wanted to make sure that the DFT length would NOT result in the slowest FFTW calculation method being used. According to the FFTW docs:
Quote:
FFTW is best at handling sizes of the form 2^a * 3^b * 5^c * 7^d * 11^e * 13^f, where e+f is either 0 or 1, and the other exponents are arbitrary. Other sizes are computed by means of a slow, general-purpose algorithm (which nevertheless retains O(n log n) performance even for prime sizes).
I have chosen e = f = 0. In addition, I wanted to make sure that the user-supplied DFT length was a factor of only the other primes: 2, 3, 5, and 7. So I wrote a function that will check the user supplied FFT length and if it cannot be factored into these primes it searches for the next higher integer that is only comprised of these "lower prime" numbers and then uses that for the FFT length. The additional bins will just be zero padded as usual, and with O N log N complexity this should keep the convolution speed optimized for FFTW. It's a nice and useful feature IMO.

Also, I have chosen to use "system wisdom" rather than try to do a quick but sub-optimal wisdom calculation during startup. This will require the user to pre-compute FFTW wisdom using the command line wisdom building utility included with FFTW. This utility can be configured to employ SSE/2/3 or NEON instructions, and can be compiled for double or single precision. These parameters can have a strong influence on FFTW's speed, so some attention and customization by the user is warranted.

For more info on Wisdom pre-calculation, see:
FFTW-WISDOM(1) manual page
fftwf-wisdom(1): create wisdom - Linux man page
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 19th March 2020 at 03:49 PM.
  Reply With Quote
Old 21st March 2020, 03:53 PM   #15
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
UPDATE:

I've finally gotten everything working and done some preliminary testing and benchmarking. The code still needs some optimizatin and cleanup, but things are looking good. The plan to separate the plugin and the FIR convolution into different processes seems to have paid off.

Channels are processed individually, that is to say this is exclusively a monophonic LADSPA plugin. Stereo or in general N channels simply invoke N plugins, each one running independently of the other.

I have been using an Intel J1900 based machine during development and testing. As an example of performance, I ran an 64k FFT. The time to perform the convolution and return the processed data to the plugin was about 3.1 msec. CPU consumption was 1% per channel. To put this into perspective, the data must be processed by the FIR engine and returned to the plugin during one audio frame. The plugin uses a frame size of 1024 samples and is running at 48kHz, which comes out to about 21msec per frame meaning that the data is returned well in advance of the "deadline". LADSPA hosts that allow the user to adjust the frame size (ecasound for example) can extend the deadline to whatever the user desires, limited by system memory.

Hopefully I can toss the code onto a Raspberry Pi 4 and get some numbers for that platform in the next couple of days. I think it should work well there, too.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 22nd March 2020, 11:05 PM   #16
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
I have been continuing to test and refine the code. Have made the memory footprint smaller, which resulted in a speedup of about 15% for a 64k tap filter. Everything seems to be working well.

If anyone wants to give it a test before I release it please drop me a line. I would love some guinea pigs to give it a try so that I can firm up the instructions/documentation.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 23rd March 2020, 05:26 PM   #17
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
OK, well I think the plugin code has matured enough to release. I hope to do that today or tomorrow, after I write up the instructions. This has worked well for me and I hope others will give it a try. I would to hear some feedback if you do.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 25th March 2020, 06:00 PM   #18
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
PLEASE FEEL FREE TO READ THE ATTACHED OVERVIEW

It will take me a little more time to review and upload everything to my LADSPA plugin web page, so for now I am attaching the file that describes the installation and use of the plugin and FIR engine. It should provide a good overview of everything and includes an example for a 3-way stereo crossover using ecasound as the LADSPA host.

If there is something missing or you find something to correct please post here of OM me so that I can fix the issue.
Attached Files
File Type: txt INSTALLATION AND USE OF LADSPA-FIR.txt (18.4 KB, 12 views)
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 26th March 2020, 07:18 PM   #19
CharlieLaub is offline CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
FIR-LADSPA IS NOW AVAILABLE FOR DOWNLOAD

Following some last minute changes and fixes, I have finally released the files on my LADSPA page:
LADSPA-plugins

Please let me know if you encounter any trouble installing or running LADSPA-FIR.

I have not provided any FIR filters. You can easily generate test filters using rePhase.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote

Reply


FIR-LADSPA: A LADSPA plugin for FIR filteringHide 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
LADSPA plugin programming for Linux audio crossovers CharlieLaub PC Based 482 5th February 2020 09:33 PM
LADSPA plugins arjunm009 Digital Line Level 2 24th October 2018 01:52 PM
asoundrc and ladspa RAndyB PC Based 8 18th March 2018 01:03 PM
IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost control CharlieLaub PC Based 63 29th April 2016 04:05 PM
LADSPA help, please! Deafuser PC Based 10 17th February 2016 08:31 PM


New To Site? Need Help?

All times are GMT. The time now is 06:26 AM.


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