0
0

When my iPhone simultaneously plays and records, the first couple seconds of recording have a buzz/distortion sound on top of the recorded sound. If playback is not happening, the recording is clean. Any leads on what might cause this or how to fix it? My only clue so far is: if I delay playback for the first 2 seconds of recording, the issue is goes away.

  • (IBAction) onRecordToBuffer
    {
    FMOD_CREATESOUNDEXINFO exinfo = {0};

    [self errCheck:FMOD::System_Create(&system)];
    [self errCheck:system->init(kMaxChannels, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, NULL )];

    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.numchannels = 1;
    exinfo.defaultfrequency = 44100;
    exinfo.format = FMOD_SOUND_FORMAT_PCM16;
    exinfo.length = exinfo.defaultfrequency * sizeof(short) * exinfo.numchannels * 10;

    [self errCheck:system->createSound(0, FMOD_2D | FMOD_SOFTWARE | FMOD_OPENUSER | FMOD_LOOP_NORMAL, &exinfo, &soundRecordSing)];
    [self errCheck:system->recordStart(0, soundRecordSing, YES)];

    [self errCheck:system->createStream(cPath, FMOD_SOFTWARE, NULL, &sound)];
    [self errCheck:system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel)];

    self.timer = [NSTimer scheduledTimerWithTimeInterval:kTimeIntervalSystemUpdate target:self selector:@selector(bufferRecordChunk:) userInfo:nil repeats:YES];
    }

  • (void) bufferRecordChunk:(NSTimer*)timer
    {
    system->update();
    }

  • You must to post comments
0
0

Do you hear this in the Recording example?

I just run it here and with headphones plugged in a I can a short noise (definitely not 2 seconds) when recording starts (this noise comes from the Apple SDK not FMOD). There is also a subtle crackle, which is coming from the hardware (before being touched by FMOD), perhaps this is what you mean?

The sound you hear is it loud static? or more subtle?

  • You must to post comments
0
0

The buzz is also present in the recording example. The noise I’m hearing occurs about 1 second into the recording, and lasts maybe 1/2 a second. It sounds a little bit like a baseball card rubbing bike spokes (kids do that in Australia, right?) It seems non-deterministic — sometimes it is quieter than other times, sometimes there is a 2nd echo of the 1st buzz about 1 second later, and occasionally it doesn’t happen at all.

Is this the noise you said comes from the Apple SDK? If so, is there anything to be done about it?

If you’re interested in my recording project modifications, I describe them below. Thanks for your help.

I added drumloop.wav to the project, added 7 lines to the end of "record:(id)sender", added a new channel and sound to ViewController (channelMusic and soundMusic) and made "play:(id)sender" stop channelMusic. My modifications to the recording project are below.

  • (IBAction)record:(id)sender
    {
    FMOD_RESULT result = FMOD_OK;

    result = system->recordStart(0, sound, loopFlag);
    ERRCHECK(result);

    char cPath[200] = {0};
    NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingFormat:@"/%@", @"drumloop.wav"];
    [path getCString:cPath maxLength:200 encoding:NSASCIIStringEncoding];
    result = system->createStream(cPath, FMOD_SOFTWARE, NULL, &soundMusic);
    ERRCHECK(result);
    result = system->playSound(FMOD_CHANNEL_FREE, soundMusic, false, &channelMusic);
    ERRCHECK(result);
    }

  • (IBAction)play:(id)sender
    {
    FMOD_RESULT result = FMOD_OK;

    if (loopFlag)
    {
    result = sound->setMode(FMOD_LOOP_NORMAL);
    ERRCHECK(result);
    }
    else
    {
    result = sound->setMode(FMOD_LOOP_OFF);
    ERRCHECK(result);
    }
    if( channelMusic )
    {
    channelMusic->stop();
    channelMusic = NULL;
    }

    result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
    ERRCHECK(result);
    }

  • You must to post comments
0
0

Thanks for the information, I can confirm I hear what you are hearing now.

I have been trying to find a work around for that sound corruption, but unfortunately I can’t figure out how to do that. The problem is not with FMOD, the problem is coming from either the OS software or the device hardware.

The bug is some of the sound being played is being fed into the mic. This is not sound coming out the speaker and into the mic, but actually internal to the OS data is bleeding through. Without knowing the inner workings of the OS software I can only guess it is to do with internal buffer sharing.

I will log a bug report with Apple and see if they have a workaround or bug fix we can use. Until then all I can recommend is not playing sound while recording. Or at least not within the first few seconds of recording since the corruption seems to go away after that.

I will post more when I hear back from Apple.

  • You must to post comments
0
0

Two months ago had a similar problem with one of our applications, using Audio Queue and Audio Session services to play audio through bottom speaker while monitoring audio input level. Sometimes in rare cases loud feedback could be heard indefinitely long after initialization before any sound could be played. When this bug has occured with our client’s iPhone 3G, its speaker got literally burned out. Our final solution was to disable audio session every time we did not intend to actually play any sound and to apply some other prevention measures/hacks.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.