DSP (APU control) development - audio filters/effects source library coded
#1
i also posted this to the xbmp forums...

i've uploaded my source files using the end user upload page - xbmc_dsp.zip. i didn't get a chance to clean up or document the code yet, so if anyone wants to continue the work they should probably email me so i can explain what's going on. hopefully i have some time to continue to work on it along with the help of others.

i never got it completely working because i got stuck trying to figure out how to do the gui end of things. i also wasn't entirely sure what direction to go with it.

here's a quick rundown of what's in there. i know the style/class names don't match the rest of the code, but it's hard to break old habits. Smile

filter_bank.fx - dsp builder source file of 5 stereo biquad filters
filter_bank.bin - dsp image file ( generated by dsp builder )
filter_bank.h - header file of dsp coefficients ( generated by dsp builder )
dsp.h/cpp - implements dsp::manager_t
guiwindowdsp.cpp - the start of my attempt to implement a dsp control panel

dsp builder ( included in the xdk ) allows you to graphically create a dsp processing chain. the result of the dsp builder compile is a dsp executable image ( *.bin ) and a header file which exposes the dsp coefficients. to download a dsp image you use the lpdirectsound8->downloadeffectsimage
method. one downloaded you can use the seteffectdata method to set a filter parameter. since the parameters exposed are the raw biquad parameters, some amound of parameter coefficent crunching is required to actually use the filters - the filter_t class along with lp_filter_t ( low pass filter ), hp_filter_t ( high pass filter ), and parametric_filter_t ( parametric filter ) help with this process.

generating the coefficients is a little tricky, especially since the documentation is apparently incorrect. i experimentally determined that the mapping of the biquad coefficients was incorrect. this may have been fixed in a later xdk, but i had to implement the following remapping -

dwfiltera1 = coef.b0
dwfiltera2 = coef.b1
dwfilterb0 = coef.b2
dwfilterb1 = coef.a1
dwfilterb2 = coef.a0

if you want to give it a go, good luck! let me know what kind of result you find.
Reply
#2
Thumbs Up 
great and very cool! developers who want to play around and try to implement fankey's code can fould it here: xbmc dsp v1.0
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
just to spur interest, i thought i'd ask you guys, what will this mean if this was integrated and worked, for the user and for the developer?
Reply
#4
(thebeast @ feb. 11 2004,00:55 Wrote:just to spur interest, i thought i'd ask you guys, what will this mean if this was integrated and worked, for the user and for the developer?
it would allow for audio processing to be done ( eqs, effects, gains, etc. ) without any main cpu processing hit. the dsp should be powerful enough to to quite alot of processing. it looks like you could fit 32 bands of parametric eq, for example. most receivers have this sort of thing built in, but it would allow for you to eq ( and possibly time align ) speakers without a fancy receiver.
Reply
#5
will take a look at it if no one else has...
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#6
Thumbs Up 
(butcher @ feb. 12 2004,13:52 Wrote:will take a look at it if no one else has...
good stuff! yeah, if i understod fankey correcly he currently doesn't have much time to work on it but can still help out
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#7
Thumbs Up 
(fankey @ feb. 12 2004,05:27 Wrote:
(thebeast @ feb. 11 2004,00:55 Wrote:just to spur interest, i thought i'd ask you guys, what will this mean if this was integrated and worked, for the user and for the developer?
it would allow for audio processing to be done ( eqs, effects, gains, etc. ) without any main cpu processing hit. the dsp should be powerful enough to to quite alot of processing. it looks like you could fit 32 bands of parametric eq, for example. most receivers have this sort of thing built in, but it would allow for you to eq ( and possibly time align ) speakers without a fancy receiver.
interesting. so this would mean the increase in "main cpu" time would leave room for the main cpu to do something else? what should this freed cpu time be spent on, or should i wait for an answer, only when (if) this is integrated? ;)

- could it mean, xbmc could have more memory free also?

- could it mean, xbmc will have more cpu to do video filtering?

- what could it be used for?? :)
Reply
#8
at the moment we don't have any audio processing, so this would allow xmbc to do what it currently does, but with additional audio processing on top "for free".
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#9
Exclamation 
i'm all for it. i would like nothing more, if only my xbox was quieter. butcher, have you by any chance modded your xbox with a quieter fan? :-)

i'm very much into using my xbox to listen to music, if you haven't guessed this already. how will audio processing support need to be extended in xbmc? (possibly relating to xbmp experience?) in small steps?
Reply
#10
stock fan for me, i just turn up the speakers. Smile
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#11
bumping this with a note that moved fankey's dsp based audio filters/effects library from sf's patches to sf's feature resuests
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#12
Digging up an older thread here but I came across some more example code

This code shows the ability of the hardware to modifiy volume and delay of specific channels.
From what the coder explained more information on using these functions should be available in the XDK

Code:
this is how I created the Audio filters (done through the Xbox hardware)
lpPrimaryBuffer represents the wav audio buffer (2 channel stereo at varying frequencies) that is contantly being generated/updated by ZSNES.
if (DS_OK == m_pDSound->CreateSoundBuffer(&dsbd, &lpPrimaryBuffer, NULL))
{

if(musicType == 0) { //Default. Send the stero signal at max level to all the available speakers
DSMIXBINVOLUMEPAIR dsmbvp[8] = {
{DSMIXBIN_FRONT_LEFT, DSBVOLUME_MAX}, // left channel
{DSMIXBIN_FRONT_RIGHT, DSBVOLUME_MAX}, // right channel
{DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX}, // left channel
{DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX}, // right channel
{DSMIXBIN_BACK_LEFT, DSBVOLUME_MAX}, // left channel
{DSMIXBIN_BACK_RIGHT, DSBVOLUME_MAX}, // right channel
{DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX}, // left channel
{DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX}}; // right channel
DSMI***** dsmb;
dsmb.dwMixBinCount = 8;
dsmb.lpMixBinVolumePairs = dsmbvp;
lpPrimaryBuffer->SetMi*****(&dsmb);
}
if(musicType == 1) { Ambience: Take the stereo signal and play it full volumne in the front speakers. Double it at half volumne for the back speakers
DSMIXBINVOLUMEPAIR dsmbvp[4] = {
{DSMIXBIN_FRONT_LEFT, DSBVOLUME_MAX},
{DSMIXBIN_FRONT_RIGHT, DSBVOLUME_MAX},
{DSMIXBIN_BACK_LEFT, -600},
{DSMIXBIN_BACK_RIGHT, -600}};
DSMI***** dsmb;
dsmb.dwMixBinCount = 4;
dsmb.lpMixBinVolumePairs = dsmbvp;
lpPrimaryBuffer->SetMi*****(&dsmb);
}
if(musicType == 2) {//Cathedral: Simulated 3D sound on a non 3D buffer. Basiclly just a reverb filter.
DSMIXBINVOLUMEPAIR dsmbvp[4] = {
DSMIXBINVOLUMEPAIRS_DEFAULT_STEREO,
{DSMIXBIN_I3DL2, DSBVOLUME_MAX},
{DSMIXBIN_I3DL2, DSBVOLUME_MAX}}; // sent twice to get L+R
DSMI***** dsmb;
dsmb.dwMixBinCount = 4;
dsmb.lpMixBinVolumePairs = dsmbvp;
lpPrimaryBuffer->SetMi*****(&dsmb);
}

Exerytime the user changes the Audio filter, I release this buffer and call the above code again.

Hopefully this will help out anyone interested in tinkering
Reply

Logout Mark Read Team Forum Stats Members Help
DSP (APU control) development - audio filters/effects source library coded0