0
0

Hi there,

Before I start I’d just like to say from my initial attempts at using FMOD i’m very impressed, this seems to be a fantastic library…

I’m a final year computing student at Imperial College, London [url:77teutv2]http://www.doc.ic.ac.uk[/url:77teutv2], and I’m pretty sure I’m going to use FMOD as part of my final year project, which is on Harmonic Mixing and Beat Detection Algorithms.
Having done some experimenting, I’ve have a query that I hope you can help with.

A simple algorithm for detecting beats in music (and thus calculating the tempo) takes an average of the sound energy over around a second of sound, then compares the energy of an ‘instant’ (1024 samples) to this average. The theory is when the instant is above the average, it’s a beat in the music.

I”ve been trying to implement this algorithm as a DSP unit, but I’m a little confused as to what exactly is in the buffer that the unit works on. My program doesn’t seem to correspond to what I would expect, and I think this might be because I’m not entirely sure what the samples are.

Assuming my input/soundcard is 16bit/44.1k stereo, if my DSP unit gets 1024 samples, are these samples half for each stereo channel? or is each sample a value for both channels.

I’ve had a look at your documentation but it’s still no clearer.

Basically, having done this: (shamelessly taken from one of your examples!)
[code:77teutv2]for (count=0; count < length; count++)
{
int val;

``````            if (mixertype == FSOUND_MIXER_QUALITY_FPU)
{
val = (int)src.fptr[count];
}
else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6)
{
val = (int)src.wptr[count];
}
else
{
val = (int)src.dptr[count];
}
val = (val &gt; 32767 ? 32767 : val &lt; -32768 ? -32768 : val);
instant[count] = val;[/code:77teutv2]
``````

I’m not entirely sure what the values in instant[] represent, and I think this might be why my code isn’t behaving as I’d expect.

Thanks,

Simon

• You must to post comments
0
0

[quote:2jg88s52]I”ve been trying to implement this algorithm as a DSP unit, but I’m a little confused as to what exactly is in the buffer that the unit works on. My program doesn’t seem to correspond to what I would expect, and I think this might be because I’m not entirely sure what the samples are. [/quote:2jg88s52]

Given that the audio is stereo data @ 16-bit depth, the buffer is an array of 16 bit integers. Therefore every [i:2jg88s52]two[/i:2jg88s52] values gives you [i:2jg88s52]one[/i:2jg88s52] sample.

I think my explanation is right, but of course it will need verification from the FMOD guys themselves. Good luck with your project, I’m from Warwick University and I just finished mine! It was a wave-editor and sequencer. I used FMOD as well, great API.

• You must to post comments
Showing 1 result