Work in Progress - adsp.biquad.filters

  Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
ironic_monkey Offline
Posting Freak
Posts: 1,387
Joined: Nov 2013
Reputation: 65
Post: #31
abrombo, it's mostly monkey see, monkey do.

start out with looking at the source of one of them, e.g. https://github.com/kodi-adsp/adsp.basic
there used to be an empty template but it seems the repository is just that atm - empty.
if you are not used to add-ons in general, there are some general stuff you have to get the grasp of, feel free to ask specific questions.

the interfaces are mostly doxy'd;
https://github.com/xbmc/xbmc/blob/master...adsp_dll.h
https://github.com/xbmc/xbmc/blob/master...sp_types.h
https://github.com/xbmc/xbmc/blob/master...ODI_adsp.h
find quote
AchimTuran Offline
Team-Kodi Member
Posts: 541
Joined: Jan 2014
Reputation: 13
Location: Germany
Post: #32
(2015-08-11 11:24)ironic_monkey Wrote:  abrombo, it's mostly monkey see, monkey do.

start out with looking at the source of one of them, e.g. https://github.com/kodi-adsp/adsp.basic
there used to be an empty template but it seems the repository is just that atm - empty.
if you are not used to add-ons in general, there are some general stuff you have to get the grasp of, feel free to ask specific questions.

the interfaces are mostly doxy'd;
https://github.com/xbmc/xbmc/blob/master...adsp_dll.h
https://github.com/xbmc/xbmc/blob/master...sp_types.h
https://github.com/xbmc/xbmc/blob/master...ODI_adsp.h

@abrombo
The template isn't finished, but you can see how it works on my latest project: https://github.com/AchimTuran/adsp.xconv.../template. If it gets more stable it will be available under https://github.com/kodi-adsp/adsp.template.


(2015-08-11 01:14)abrombo Wrote:  Is there documentation for writing addons for dsp. I am interested in a plugin that would allow me to route the kodi audio stream to an external application such as ecasound (no graphical interface required other than needed to define the external application). Then ecasound would post process the audio stream using ladspa filters and send it to the sound card.
1) What is your exact use case?
2) Just running some ladspa filters?

I think its possible, but it breaks a little bit the design of ActiveAE and AudioDSP. Your plugin will not send audio data back into AE's sink. Furthermore you would only listen to the sound that comes from your external application (in your case eacsound) and it would only run on linux.

If you have the time. Why not integrating an ladspa host inside a AudioDSP addon?
Sorry the ladspa site is down, but I know in the sdk is a example for a host. I only found a tutorial for the plugin side: http://archive.oreilly.com/pub/a/linux/2...adspa.html

And yeah feel free to ask question about the ADSP-Add-ons.

Latest news about AudioDSP and my libraries are available on Twitter.

Developers can follow me on Github.
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #33
1) What is your exact use case?
A. 5.1 in and out. Low pass filter for subwoofer. High pass filters for all other speakers with cut off frequency dependent on each speaker.
B. 5.1 in and 7.1 out. Low pass filter for subwoofer. High pass filters for front and rear speakers. Main speakers are biamped (use front R and L
and side R and L channels) so all four of these channels need band pass filters. Would also like to do room/speaker equalization on all 5.1 input
channels. For reference (only stereo) see http://rtaylor.sites.tru.ca/2013/06/25/d...are-howto/

In am continuing to explore coding a virtual sound card that could use ladspa or brutfir filters. This would be so easy if kodi had a command line switch to route the audio output.

Yes it would work only in Linux. I am not paranoid enough to run windows (some virus or malware sneeks onto the system).

I am considering the following experiment (I do have some copies of win 7 on dual boot systems). Install on windows vmware player and then create a virtual ubuntu machine to run kodi and see if the virtual machine can provide the needed video and audio resources to run kodi well. My htpc is a asus motherboard with 16 Gb memory, 4 core amd phenom cpu, EVGA GeForce GT 740 video card, asus xonar d2 sound card, ceton infinitv 6 tuner so there should be enough compute power even on a virtual machine.

For someone not familiar with linux the virtual machine could be distributed as a single file with everything installed. Updates can be applied just as with a real machine. I just did this for a geometric algebra conference in Barcelona where the participants in a laboratory course might not all be running linux (they needed to use some python code I had written plus other packages more easily dealt with on a Linux system).
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #34
Thank you for the advice. I think that I will use your addons (when part of the ppa) for overall room equalization. I will use the alsa loopback virtual soundcard + jack + ecasound to implement the electronic crossover + high/low pass filters for the surround sound system. With this method I can use multiple sound cards if more electronic crossover channels are required or I go to an 7.1 channel system with electronic crossovers. Thank for making a great product even better.
find quote
AchimTuran Offline
Team-Kodi Member
Posts: 541
Joined: Jan 2014
Reputation: 13
Location: Germany
Post: #35
(2015-08-11 01:14)abrombo Wrote:  Is there documentation for writing addons for dsp. ...
Do you know how to write C/C++ applications?

(2015-08-11 17:37)abrombo Wrote:  1) What is your exact use case?
A. 5.1 in and out. Low pass filter for subwoofer. High pass filters for all other speakers with cut off frequency dependent on each speaker.
B. 5.1 in and 7.1 out. Low pass filter for subwoofer. High pass filters for front and rear speakers. Main speakers are biamped (use front R and L
and side R and L channels) so all four of these channels need band pass filters. Would also like to do room/speaker equalization on all 5.1 input
channels. For reference (only stereo) see http://rtaylor.sites.tru.ca/2013/06/25/d...are-howto/
Some of your ideas will be possible with adsp.xconvolver, when it is finished. I don't know when this will happen, but I also try to achieve a similar setup. This add-on will be able to load several FIR-Filters and configure them with a filter manager.

(2015-08-11 17:37)abrombo Wrote:  In am continuing to explore coding a virtual sound card that could use ladspa or brutfir filters. This would be so easy if kodi had a command line switch to route the audio output.
Maybe for your use case it would be better to implement a jack sink into Kodi's Audio Engine (ActiveAE). The NULLSink is a good starting point.

(2015-08-11 17:37)abrombo Wrote:  ... some virus or malware sneeks onto the system ...
Hey Windows is not that bad, I use it daily at work and even for add-on development. Wink


(2015-08-13 17:59)abrombo Wrote:  Thank you for the advice. I think that I will use your addons (when part of the ppa) for overall room equalization. I will use the alsa loopback virtual soundcard + jack + ecasound to implement the electronic crossover + high/low pass filters for the surround sound system. With this method I can use multiple sound cards if more electronic crossover channels are required or I go to an 7.1 channel system with electronic crossovers. Thank for making a great product even better.
That’s also my plan and hopefully one day I can use them to equalize my living room. If they all work you don't need ecasound or other external programs. They will natively work with Kodi's Audio Engine. Blush

Latest news about AudioDSP and my libraries are available on Twitter.

Developers can follow me on Github.
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #36
I last programmed in C++ back in the 1980's. I am now basically a python programmer (instant gratification) working in (for fun in retirement) symbolic geometric algebra.

I eagerly await the developments you have outlined.

It looks like implementing a jack sink into Kodi's Audio Engine requires C++ programming which is too far in my past. The ecasound forum had a reference on how to connect to loopback sound card using jack which I will pursue for now.

Would you please inform me when dsp addons start appearing in the nightly ppa.

Again thank you for the great work.
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #37
I think I have an alternate solution. I forgot that I had an hdmi audio scaper (hardware) with hdmi in and hdmi+spdif(toslink) out so I can get the kodi audio output over the spdif which is fed into the spdif input of my soundcard. Then I can use ecasound to process the audio between the input and output of the sound card since both are assessable to ecasound. I will have to let kodi do all the audio decoding (do not use pass through as I do with my preamp now).
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #38
Success at the first level. With the hdmi audio scraper I was able to capture (record) 5.1 channel output of Kodi via the spdif input of my xonar d2 sound card. The command to due this was simple -

ecasound -i alsa -o test.wav

since the spdif input was set as the default alsa input. One question I have is where is the best place in the audio processing path to implement the volume control? It seems to me that if the analog output of the sound card has a hardware master volume control (alsa device) that is where it should be implemented.
find quote
AchimTuran Offline
Team-Kodi Member
Posts: 541
Joined: Jan 2014
Reputation: 13
Location: Germany
Post: #39
(2015-08-14 22:32)abrombo Wrote:  Success at the first level. With the hdmi audio scraper I was able to capture (record) 5.1 channel output of Kodi via the spdif input of my xonar d2 sound card. The command to due this was simple -

ecasound -i alsa -o test.wav

since the spdif input was set as the default alsa input. One question I have is where is the best place in the audio processing path to implement the volume control? It seems to me that if the analog output of the sound card has a hardware master volume control (alsa device) that is where it should be implemented.
Great. But I don't know where you can edit the master volume maybe alsamixer.

But please open a new thread for ecasound. This thread is only for adsp.biquad.filters.

EDIT:
I think a good place is the Tips, tricks, and step by step guides forum.

Latest news about AudioDSP and my libraries are available on Twitter.

Developers can follow me on Github.
(This post was last modified: 2015-08-15 09:00 by AchimTuran.)
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #40
Good idea will do.
find quote
Vasa Offline
Junior Member
Posts: 18
Joined: Nov 2015
Reputation: 0
Post: #41
@Wisler - this looks really interesting. Any progress of the biquad functionality? Also, is it possible to manually tweak the filters for more fine tuning? My use case is similar to what ambrombo describes - active cross-over and equalization of individual speakers (and drivers).

@abrombo -did you create a separate thread? I wasnt able to find one.
find quote
AchimTuran Offline
Team-Kodi Member
Posts: 541
Joined: Jan 2014
Reputation: 13
Location: Germany
Post: #42
(2015-11-20 19:06)Vasa Wrote:  @Wisler - this looks really interesting. Any progress of the biquad functionality? Also, is it possible to manually tweak the filters for more fine tuning? My use case is similar to what ambrombo describes - active cross-over and equalization of individual speakers (and drivers).
A biquad filter is a generic structure in the digital signal processing domain. It depends what equations are implemented. Currently there are only equations for the equalizer. See here: https://github.com/AchimTuran/asplib/blo...y.cpp#L450

When the addon is ported to all platforms I plan to integrate more design equations, e.g. http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

At the time of this writting I'm working on a class that can be used for our music spectrum visualizations. See my branch spectrum-vis-processor. At the end this work can be used for XConvolver to achieve a higher flexibility during FIR Filter configuration.

Latest news about AudioDSP and my libraries are available on Twitter.

Developers can follow me on Github.
find quote
Vasa Offline
Junior Member
Posts: 18
Joined: Nov 2015
Reputation: 0
Post: #43
Nice! Which platform is it currently working on? On debian/raspian based platforms, would it be possible to take advantage of other existing filter libraries such as ladspa for low power platforms such as the rpi?
find quote
abrombo Offline
Member
Posts: 71
Joined: Jan 2015
Reputation: 0
Post: #44
I have decided to do everything with alsa aloop (virtual loop back sound card) and real sound card (xonar d2) no hdmi sound scraper needed. Output of aloop is sent to ecasound with filters implemented as in http://rtaylor.sites.tru.ca/2013/06/25/d...are-howto/ and output of ecasound sent to physical sound card. The problem is that my sound card has no master volume control that is separate from the individual channel volume controls (the master volume control just gangs together the individual controls) so that if the volume is set too high with the master volume control the relative volume settings of the channels are lost. My solution is an analog volume control on each output of the sound card (quality audio taper 10 kOhm pot) the setting of which determines the relative output of each channel. If your sound card has master that is independent of individual volume controls you would not need this piece of hardware. Today I ordered (back ordered) the cbt26k speaker kit http://www.parts-express.com/audio-artis...--301-980. These speakers are bi-amplified with a fairly complex transfer function (combination of Linkwitz-Riley, shelving, and time delay filters) that I will implement with ecasound and the plugins from rtaylor.sites.tru.ca.

The only problem with using a dsp module for kodi is that it will only work for kodi output and currently in kodi I cannot play from my Amazon Prime account using the kodi addon. It used to work, but stopped working. I am currently using google-chrome for that purpose. Also, kodi does not have an addon that can play music streams input from the analog input of the computer sound card. I have a lot of records and don't want to have to digitize them with adacity to listen to them.
find quote
Vasa Offline
Junior Member
Posts: 18
Joined: Nov 2015
Reputation: 0
Post: #45
Thanks for the input. I am using a similat approach but let's create a new thread where we can discuss this without taking away focus from wisler's great work. I will create one tonight if you don't beat me to it. I'm just not sure which forum to post it in.
find quote
Post Reply