0
0

hi,

Here is my other problem, I would like to record a mono input and play it on 2 channels in real time (less than 3ms latency between input and output)

so I initialize an recording sound like this:
[quote:bboin6u7]memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));

exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels      = 1;
exinfo.format           = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = 44100;//OUTPUT_RATE;
exinfo.length           = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 600;
//exinfo.pcmreadcallback = pcmReaderCallBack;
result = system1->createSound(0, (FMOD_MODE)(FMOD_2D|FMOD_HARDWARE|FMOD_OPENUSER|FMOD_CREATESAMPLE), &exinfo, &sound3);
ERRCHECK(result);
sound3->setMode(FMOD_LOOP_NORMAL);
ERRCHECK(result);[/quote:bboin6u7]

then i try playing the recording sound like this :
[quote:bboin6u7]
bool recording;

system1->isRecording(&recording);
if (recording==false) {
return false;
}
channel1->isPlaying(&recording);
if (recording==true) {
return true;
}
sound3->setMode(FMOD_LOOP_NORMAL);
if (ERRCHECK(result)) return false;
result = system1->playSound(FMOD_CHANNEL_REUSE, sound3, false, &channel1);
if (ERRCHECK(result)) return false;
volumeAir = 1.0f;
result = channel1->setSpeakerMix(volumeAir, volumeAir, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 
ERRCHECK(result);
float levels_R[2] = { volumeAir, volumeAir };    
float levels_L[2] = { volumeAir, volumeAir };    
channel1->setSpeakerLevels(FMOD_SPEAKER_FRONT_LEFT, levels_L, 2);
channel1->setSpeakerLevels(FMOD_SPEAKER_FRONT_RIGHT, levels_R, 2);

[/quote:bboin6u7]

then i have to set the position of the channel a little before the recording position:
[quote:bboin6u7]
channel1->setPosition(recordpos-96, FMOD_TIMEUNIT_PCM);
[/quote:bboin6u7]

it work, but i have a very hi latency between input and output… i can’t get less than 200ms. So i would like to know if there is a way to ask the recorder to write as fast as possible received data (write and unlock the block of data to allow it to be played and modified)

What is the internal record buffer default size ? can we modify it ?

PS: i use alsa under linux 64Bit

  • You must to post comments
0
0

Hi,

I have a very similar question. For my app I need to record a stereo input, extract the left and right channel and pass at least 64 samples for each channel to another object which handles further calculations. This must be done in real time with the lowest possible latency between input and output. I’m using ASIO of course.

How can such low latencys be achieved? I’ve tried a very similar approach like globot. Can it be done this way? Or is there a solution?

  • You must to post comments
0
0

I found a solution…
I use an other library designed for realtime processing… the CLAM Audio library is excellent, the only problem is that it is a little difficult to get in. I tested my processing Network with their NetworkEditor, i got less than 3 ms (2.666ms) between my microphone and the processed output (using 128 frames processing and jackd)
the same thing with FMOD Ex was running with around 600ms of latency (if i wanted a no artifact output)

now i am working on porting the application, but this is the hard part :( FMOD was so much easier to use for a simple programmer like me that have only basic knowledge on sound processing.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.