diyAudio DSP plugin
#1
Hello,

With XBMC becoming a de-facto HTPC standard, I guess there will be many users, potentially frustrated in case they cannot select the audio DSP of their choice.

Think about Winamp.
Inside Winamp you have a built-in audio DSP features like equalization. There are many users, wanting for more.
In case you want more you need to access the "DSP studio" this way : Options - Preferences - Plugins - Effect/DSP.
"DSP Studio" is the list of audio plugins to be loaded, with their parameters, to be applied to the audio that's playing.
From the Winamp website, you can download dozens of audio DSP plugins.
Some are exceptional, deserving their own website like Hans van Zutphen Stereo Tools 3.0 http://www.hansvanzutphen.com/stereo_tool/

Think about the diyAudio community.
The diyAudio community is in search of an audio player that can be trusted, "bit-accurate" when feeding audio DACs, and relying on a 32 bit audio precision when applying DSP inbetween.

Think about Android tablets vs. x86 HTPCs
Progressively, the diyAudio communauty got persuaded that audio streaming from a USB key, from a local harddisk, of from a NAS, is the way to go. Products and services like The Beatles Stereo USB files (24 bit FLAC) and www.hdtracks.com acted like triggers. In general, diyAudio people don't trust x86 HTPCs because of the way Windows (XP, Seven, 8) is dealing with audio, most of the time they suspect resampling, and most of the time they assume that Windows can't deliver a "bit accurate" quality. Regarding x86 hardware, the diyAudio community is fearing electromagnetic pollution caused by motherboards consuming tens of watts. On top of this, comes the audio clock jitter issue when the audio is coming from an USB audio attachment, unless relying on the quite recent asynchronous USB audio protocol.

Think about audiophile DSP.

We know how devastating room effects can be, for a given loudspeaker. More and more the diyAudio community is looking in the direction of room correction, basing on devices called "convolvers" that are FIR filters. The idea is to clean up the impulse response, for attaining a flat wide frequency bandwidth, and a linear phase. Coding a 32 bit resolution FIR filter only takes a few minutes. It is a repetitive multiply-accumulate within a do-while loop, done on a row of audio samples. Most of the time you will be more than happy, if your stereo FIR can deal with 4096 audio samples at a time. This is not a fatal workload for GHz-class processors nowadays.

We know how lobing can be devastating. Lobing is a problem mostly caused by multiway speakers, exhibiting radically different frequency responses (and impulse responses), depending on the angle you are listening to them. In a non-concentric 2-way speaker, lobing comes from the midbass driver negatively or positively interfering with the tweeter, when they operate in the frequency overlap zone. When you are listening slightly off-axis, the midbass-ear and tweeter-ear distances are not the same. If the path difference is equal to 1/2 sound wavelength, there will be a giant "dip" in the perceived frequency response, at the frequency corresponding to such wavelength. Basically, knowing that 80% of the sound energy is made of reflected sound, even if you are sitting "on axis", what you will hear is a sound that's 80% corrupt. Amazing, isn't ?

In order to annihilate most of those annoyances at the source, the diyAudio communauty agrees that multiway speakers should be treated for what they are, in digital domain. Thus, in case you are listening in stereo, using 3-way speakers, your diyAudio system should generate 6 audio signals in digital domain, each tailor-made for the driver it will feed. This implies using 6 power amplifiers, and inbetween, a 6-channel volume potentiometer.
A nice bonus, is that speakers crossovers operating in digital domain, can deliver a better performance than any analog crossover.
There are three reasons explaining this.

The first reason is that digital enables the implementation of perfect delays, while in analog, delays only can be approximated by many phase shifters (allpass filters) put in series. Thus, only in digital, you can easily implement Transient Perfect crossovers schemes like the Lipshitz-Vanderkooy Delay Compensated, presented at the AES in 1983. You can implement it using a Butterworth lowpass kernel (what L-V showed at the AES), or using a high-order Bessel lowpass kernel (approximating a Berchin Gaussian Lowpass - AES 1999). The high order Bessel lowpass kernel provides as bonus, no preshoot or ringing in time domain, and no relative phase shift between the speaker drivers in the transition frequency band.

The second reason is that in digital, you can apply the inverse DFT (or FFT) for specifying a target amplitude and phase response, compare it to the actual amplitude and phase response of your driver, then using the DFT (or FFT) you can compute the required filter impulse response response, and - happy surprise - you can view such impulse response as the list of FIR filter coefficients that you need. Truly amazing.

The third reason is that in digital, instead of cleaning up the impulse response of your driver using a quite long FIR filter, you can pre-process the signal using a few IIR BiQuad filters (they consume almost no processing power), for shortening the impulse response. This is to be remembered, when dealing with midbass drivers exhibiting a strong resonance at 5 kHz or so, like some Kevlar, Fiberglass, Carbone or Aluminium membrane can exhibit. This way, the IIR BiQuad filters rub out most of the resonance, and consequently, the impulse response of the drivers becomes a lot shorter. This way, you only need a dozen IIR BiQuad filters plus four 128-tap FIR filters when dealing with a crossover operating at 2 kHz.

The net result of all this, is that you can "focus" your multiway speaker in digital domain, achieving a wide polar diagram, achieving a quasi-perfect amplitude and quasi-perfect phase response for a particular listening point. The whole stuff represents almost no CPU load, when running on 32 bit multicore GHz-class machines. Now, if the user wants to apply a room correction in stereo, this means two 4096-tap FIR filters, and that's all. Such "room decorrelator" can represent a 10% load on a GHz-class machine.

What I am suggesting here, is to leave all options open for the diyAudio communauty. How to do this in XBMC ?

In XBMC AudioEngine, this time we need to tell that the audio must always come as stereo audio, which means that in case of a multichannel source, we want the XBMC AudioEngine to downmix the audio in stereo 24 bit (fixed point) at 48 kHz. Possibly 24 bit (fixed point) at 96 KHz if this is feasible.
In XBMC AudioEngine, we need to output the stereo downmix to a virtual Jack (2-channel) called "audio DSP-in".
In XBMC AudioEngine, we need to grab the audio coming from a virtual Jack (6 channel) called "audio DSP-out".
In XBMC AudioEngine, we need to tell where to route the "audio DSP-out". This time, we'll ask AudioEngine to send that 6-channel audio over HDMI using the HDMI multichannel LPCM modality. This way our 6 audio channels will go over HDMI, and reach a 6-channel amp that we will wire in a special mode, with three channels going to the left multiway speaker, and three channels going to the right multiway speaker.
In XBMC AudioEngine, we need to tell if XBMC can manage the listening volume using the HDMI CEC.

Clearly, within XBMC, we need a structure (and a well documented API) for dealing with the "Jack-in" and "Jack-out" concepts.
There can be various situations.
1) No audio DSP : in such case, XBMC drops the concept of Jack-in and Jack-out. It behaves just as usual, and multichannel, of course.
2) Naming the DSP module to be executed : it will thus receive the 2-channel audio DSP-in, and output 8-channel audio DSP-out
3) For the sake of simplicity, don't allow chaining DSP modules.
4) An exciting possibility would be to execute a VST plugin (2 channel input, 8 channel output) as compiled by Flowstone. Could you have a look at this?

Avoid doing more at the beginning.
I definitively know this is only the beginning.
For instance, when the source is multichannel audio, we would like to have the choice between two behaviors :
1) Do what's described above (stereo active multiway speakers with digital crossover).
2) Delivering a genuine 5.1 or 7.1 (depending on the source) sound, with some DSP being applied on each loudspeaker.
My best recommendation, is that you design the DSP API right now, for supporting both modalities later on.

JRiver Media Center already has built-in DSP features.
JRiver Madia Center already has bolts and nuts for an external DSP module, including splitting channel into more channels.
Unfortunately, JRiver Media is designed for the x86 hardware, being Windows, Mac, or Linux.

See here http://www.diyaudio.com/forums/digital-l...ost3712144

Best regards,
Steph
Reply
#2
Sry this complete text sounds like written by a sect leader - sorry but the way you talk scares me to death. Who the fuck is the diyAudio Community and why have i the feeling to obey their opinions?
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#3
yes, reads quite strange. But to shorten the discussion, AFAIK DSP support is planned and our AE devs care about bit perfection where possible.
Reply
#4
(2013-11-22, 16:57)Memphiz Wrote: Sect - Leader - Scares me to death - Who the fuck is the diyAudio Community - Obey their opinions.
Thanks for the warm and personalized welcome, to you and possibly all other XMBC developers supporting (or not ?) the above assertions. What a refreshing & surprising experience !

You asked a few questions, I will now try to answer them the best I can.

Clearly, no joke, diyAudio is a kind of sect.
Indeed, once you enter it, you feel a great difficulty quitting it. Why ?
Because there is a tremendous subjective quality difference between a commercial audio system that you can buy in a shop, and the do-it-yourself Audio system you are going to build, and enjoy. Put a CD, listen to any music that's recorded with honest mikes and amps, and you'll immediately taste a huge difference.
In the diyAudio community, you'll find people able to talk a full day and write hundreds of pages about an amp schematic, about a speaker crossover, etc.
In the diyAudio community you'll find people having good engineering jobs at HP, at Philips, etc.. then experimenting with audio at home. Their names became famous : Linkwitz, Riley, Lipshitz, Vanderkooy, Putzeys, etc ...
Famous, because of the audio technique advancements they enabled, and because it started as a hobby for them.
Another prominent diyAudio name that you certainly know is Bernd Timmermans, editor of Hobby-HiFi in Germany.

Clearly, I'm not a Leader of anything.
I'm steph_tsf on diyAudio, steph_tsf on Synthmaker, and steph_tsf on Flowstone.
I'm the author of a few contributions helping diyAudio people dealing with audio DSP (digital signal processing) filters and crossovers, dealing with LTspiceIV for modelling speaker enclosures at low frequencies, and dealing with special active loudspeaker systems like the "Philips MFB", "Servo-Sound Cybernetic Hi-Fi" and "3A Andante".

It's plain normal that you get "scared to the dead" like you wrote.
If you are a GUI programmer, it's plain normal that you know absolutely nothing about audio DSP.
If you are a DSP programmer, it's plain normal that you realize that my suggestions are the emerged tip of a huge iceberg. Actually, once we introduce the idea of "Jack-in" and "Jack-out", and once we introduce the idea of generating six or eight audio channels, from two audio channels, you realize how big the world is, and how short your life is, for trying everything that's feasible. You'll be dead, leaving some unfinished work.

No doubt you were joking or possibly stressed when you asked "who the fuck is the diyAudio Community".
I'm telling you this because juxtaposing words like "fuck" and "community" may have weird effects like you quickly receiving an infringement notice from the moderators of this present forum. It costs nothing asking "what do you mean by the diyAudio community", without adding the word "fucking". Or perhaps, when you get your hands shaked by somebody, you tell him "hello fucking", and when you buy bread in a shop you say "hello can I please buy some fucking bread". We live in a world, where everything is possible. Now it's you turn to tell me, why you appear to write, like you appear to speak, maybe.

"Obey their opinion".
This doesn't make any sense. My communication to the XBMC community tries to summarize in a few lines, thousands of opinions about how to architecture diyAudio systems in the context of XBMC becoming a de-facto standard when running on Android.
The only strong suggestion I made, is that it would be fantastic that XBMC provides bolts and nuts for inserting a DSP addon or a DSP plugin, remembering that such DSP module would take the 24 bit 48 kHz stereo downmix, and transform it into a 8 x channel 24 bit 48 kHz stream, that the user could send to the HDMI multichannel PCM, or to any multichannel USB audio attachment. My prose may have been unclear about this, and I'm apologizing for this.

No doubt you realize the interest of providing "open" bolts and nuts for DSP audio within XBMC.
At least XBMC will equal JRiver Media Player.

I don't know if you target monetization for XBMC being equipped with the required audio DSP bolts and nuts.
I don't know if you intend the DSP modules to become available on the Google Play Store (free modules, or modules to be purchased).
Actually this is not my business, and consequently, I would not dare making any suggestion about this.

From a technical point of view, knowing that XBMC is a multiplatform project (x86, ARM) comes the difficulty of proposing the same features on all platforms.
About 8 years ago, KOON3976, a diyAudio contributor, pointed out PortedAudio.
You can see his valuable contribution on post #29 here : http://www.diyaudio.com/forums/digital-l...one-3.html

PortedAudio is an open source, MIT-license portable cross-platform Audio API. For example, wave editor 'Audacity' is using PortAudio.

PortAudio works with...
Windows ASIO, MME, DirectSound
Mac Core Audio
Linux (Alsa/Jack/OSS)
maybe 99.999% of audio platform

Programming is really simple.
(1) Intialize, Create, Open, Start Stream
(2) write stream Loop, memcpy from main buffer to stream buffer
(3) Stop, Close, terminate.
That's all. unbelievable.


You can find PortAudio here : http://www.portaudio.com/
Reply
#5
Quote:My communication to the XBMC community tries to summarize in a few lines
make it way way less. don't make endless post but get to the point in a couple of lines.
i think most of us open the post, see a wall of text and quickly close it again because, really it's way too much.

to the point. you want to get something done, start developing and create a pull-request on github. we have enough to do with to few devs.
if your really want this is should come from your side and not ours.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#6
Now that the presentations are made, we can go to the point indeed.
Could be I try PortAudio, possibly assisted by KOON3976 if he has a slot for that.
Currently, where in the system, can we read the stereo downmix, and where can we write the eight audio channels ? Is there an XBMC API for this yet ? Do we need to create such API ? How much time can it take on your side ?
Reply
#7
Hi,

i would love to see DSP Features in XBMC but i had my problems reading your posts, it a long text.

i think you should talk to FernetMenta and Fritsch, they are working on activeAE (the new sound engine of XBMC)
Maybe it helps to read this Thread for the first informations about activeAE Link
HTPC (AMD X4 620, Geforce GT 520, Tevii 470, Antec Fusion Case with Imon LCD) with Openelec Gotham Nightlies
Raspberry Pi with Openelec Nightlies for Testing

Reply
#8
I don't think that PortAudio is an option, I don't see support for Android, iOS or future platforms may support. We are just moving away from frameworks like SDL which have caused huge problems in the past. Note that XBMC does not only play audio, we have to synchronize video to audio as well.

What kind on an API do you expect? XBMC has it's plugin/addon concept. Currently we don't have an extension point to audio but this would be feasible. An addon could provide some UI for DSP configuration and functions for the audio engine which would be called at the right stage.
Reply
#9
(2013-11-22, 20:20)rat666 Wrote: i think you should talk to FernetMenta and Fritsch, they are working on activeAE (the new sound engine of XBMC)
Wow, things are moving fast in Gotham City ! Many thanks for that info !
Reply
#10
Implement the features you like into a Sink (check the AESink), we can give you the audio how ever your sink wants it. The only thing you need to do is managing the delay and implementing our interface in a sane way.

Next text wall over 5 lines I refuse to read.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#11
(2013-11-22, 20:22)FernetMenta Wrote: Currently we don't have an extension point to audio but this would be feasible. An addon could provide some UI for DSP configuration and functions for the audio engine which would be called at the right stage.
Looks perfect indeed. Currently I'm watching the youTube video XBMC DevCon 2013 - Day 2, Part 5 - Active AE presentation. Is there a powerpoint available or a specification available that I can study? What framework or audio library should I use for writing the diyAudio DSP module, for achieving a proper multiplatform (x86, ARM) multiOS (Windows, Mac, Android) compatibility?
Reply
#12
ActiveAE uses ffmpeg for resampling and remapping. The internal audio buffers follow ffmpeg channel mapping. If you provided a function like swr_convert, http://www.ffmpeg.org/doxygen/2.0/swresa...8c56396f6a , this could be hooked easily into AE.

I guess that there are some to many configuration parameters needed for DSP, right?. Addons can provide dialogs for that purpose. For an example of extension points you can look into this example: https://github.com/xbmc/xbmc/blob/master...MC_codec.h , https://github.com/xbmc/xbmc/blob/master...XBMC_gui.h
If we had an extension point for audio, AE could look for registered addons and call the provided functions. XBMC needs to query channel number, channel layout/mapping, delay (audio packets that are queued into DSP), then it could call a function which does actual processing.
Reply
#13
This is where computer science and audio science do merge, and I feel this difficult. Last time I tried something like this, it was with BASS and BASSASIO, callbacks, wrappers, marshalling, and I could not get it working. I'm so naive and computer illiterate that I think that a 200 line program should suffice for 1) being recognized as an activeAE sink for querying two audio channels 24 bits 96 kHz, 2) opening a window displaying a very simple UI for for loading the parameters as text files, 3) setting up an audio DSP callback sequence implementing IIR filters and FIR filters, 4) being recognized as an activeAE source with 8 audio channels 24 bits 96 kHz to be re-injected into XBMC, 5) where the user can specify the HDMI multichannel LPCM as physical output device. Bear in mind that the diyAudio community won't "believe" in this in case what I'm describing above requires more than 250 lines of code. Bear in mind that a 1-channel 512-tap FIR filter coded as do-loop requires less than 10 lines of code. So, the question remains : can XBMC become a "home" for diyAudio in the digital age? I would say yes. Somebody needs to light the path. I hope we will succeed.
Reply
#14
Bear in mind that it was a major effort implementing AE in its first iteration and it took us months for the rewrite.The main motivator for the ActiveAE endeavor was bug fixing.
How long have you been engaged with audio science? How much work are you willing to invest into this idea? It wont be done in one or two weeks.

Quote:Bear in mind that the diyAudio community won't "believe" in this in case what I'm describing above requires more than 250 lines of code

In what time frames do you think? If an idea is worth it, it can be an endeavor over months/years. If complexity is only in the range of 250 LOC, we can do this next week Smile
Reply
#15
(2013-11-23, 01:56)FernetMenta Wrote: In what time frames do you think? If an idea is worth it, it can be an endeavor over months/years. If complexity is only in the range of 250 LOC, we can do this next week.
To get a proper idea of the code that's required when using the BASS and BASSASIO librairies, please read the contribution of CopperTop on diyAudio http://www.diyaudio.com/forums/pc-based/...sp-pc.html dated May 2012. Over there, I'm only appearing on post #12 dated July 2012. Worth noting are posts #38 and #39 where CopperTop is attaching a .zip containing code that's running on his computer, but not running on my computer. Recently CopperTop tried migrating to Windows Seven, and this caused major issues.
Reply

Logout Mark Read Team Forum Stats Members Help
diyAudio DSP plugin0