0
0

Hello!

This is the first time I use this mod, so please be good xd

I’m using FMOD for a live pitch detection program. I need to detect the notes played by a guitar in about 3 or 5 minutes. Here’s my code:

CREATION OF THE SOUND:
[code:urkyfsv1]
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));

// Informacion del sonido
exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO); 
exinfo.numchannels      = 1; 
exinfo.format           = format; 
exinfo.defaultfrequency = outputRate;
exinfo.length           = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 5; 

result = system->createSound(0, FMOD_2D | FMOD_SOFTWARE | FMOD_LOOP_NORMAL | FMOD_OPENUSER , &exinfo, &sound);
[/code:urkyfsv1]

RECORDING AND PLAYACK:
[code:urkyfsv1]
result = system->recordStart(sound,true);
if(check_error())
return false;

Sleep(refreshTime*100);

result = system->playSound(channelid, sound, false, &channel);
if(check_error())
return false;

result = channel->setVolume(0);
if(check_error())
return false;
[/code:urkyfsv1]

And then it enters the main loop where executes the pitch detection algorithm…

It works fine at the beginin of the recording (first 20 seconds), then it starst to delay more and more. I know that there’s some delay in the realtime playbacks, it doesn’t matter to me, but I want to maintain the delay time.

I tried to load the entire non-looping sound into memory:

[code:urkyfsv1]
exinfo.length = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 180; // 180 seconds
[/code:urkyfsv1]

… but it only records the first 30 seconds.

Is there any way to solve this problem?
How could I use a sound buffer of more than 30 seconds and play it without problems?

Thanks and sorry for my bad english! I’m from Spain xd

Note: The pitch algorithm is very slow.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.