The spectral analysis of audio (which equalizers like that do) requires pretty hardcore math, so unless there is some tools for that in the new XAudio2, it would be hardly possilbe.

AFAIK the audio is divided into different (ie. bass, mid and treble... of course there could be more) bands in digital enviroments using so-called Fourier transformations. (Or discrete cosine transofrmations) but that would require a direct access to the waveform and pretty hc math... Is here anybody here with signal engineering degree :D?

Fourier transformation is needed, that's for sure. How to achieve it and make it fast at once? "Normal" Fourier Transformation algorithm uses O^2, and Fast Fourier Transformation uses n*log2(n). I can recommend getting FFTW: one of the fastest FFT algorithms - see benchmark results (and one sample to let you know which one to check) deals with non 2^N arrays of probes (but takes more time then) open source, free for noncommercial use AFAIR written in ANSI C support for optimalization of FFT-ing signal (but I don't think this would be useful in non-industrial use)AFAIR applications like Winamp uses FFTW to make spectrum analysis.

The only problem is how to access XAudio2's pointer to actually played buffer. And I don't know how many samples are taken to analysis every "frame" (maybe 1k?). Anyways, FFTW deals with 2^19 samples in about 100ms.

BROO: That FFTW looks promising... but yes, there is the problem of getting the buffer. I don't know much about Construct's plugin architecture, but even if there would be an function retrieving the buffer in XAudio2 plugin, how would it pass to separate audio analyser plugin?

FFTW has functions to which you have to pass: input buffer output buffer number of samples (and some other flags for optimalization and stuff). If you happen to retrieve pointer to XAudio2 buffer, you'll have to create your Output memory buffer. FFTW operation will populate the Output buffer with calculated Fourier Transformation.

There are some ways (AFAIR in FFTW it's called kinds) of getting output data buffer. I'll explain it on example later in this post.

Accessible frequencies depend on amount of probes you pass in Input Buffer. If you pass 8192-element Input Buffer, you'll get frequencies from -4095Hz to 4096 Hz. Then in order to get 20kHz spectrum you'd probably want to pass 40000 elements buffer. Since processing 2^N sized arrays is better, I recommend 65536 elements sized arrays to get -32767Hz to 32768Hz.

Don't worry about working with transfering data, retrieving and stuff, it'll be done within 10msec for sure. And how to know which table indexes are the positive and negative frequencies? Well it depends on KIND of getting output data.

Sample of usage:Let's say you want frequencies 1..8Hz. You have then to pass Input Buffer array of 16 float numbers. Then, you have to prepare memory for Output Buffer: it'll be array of 16 float numbers. FFTW works like this: retrieve/malloc Input/Output buffers select PLAN you want to do (as for us it'll be fftw_plan fftw_plan_r2r_1d(int n, double *in, double *out, fftw_r2r_kind kind, unsigned flags); execute PLAN free memory

If XAudio2 would have "get pointer to buffer" expression, then everything should be all right. And if you're going to make 0..20kHz in few bars like in Winamp, you'll have to sum/average parts of array.

[quote="BROO":2ih9xns1]If XAudio2 would have "get pointer to buffer" expression, then everything should be all right. And if you're going to make 0..20kHz in few bars like in Winamp, you'll have to sum/average parts of array.[/quote:2ih9xns1]

BROO: What are the minus frequencies representing :o? I don't quite get why does the function return those also.

I just began to wonder if it is possible to combine the frequencies afterwards and input them back to XAudio2 :D. I was thinking some kind of controllable equalizer...