• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Adding silence in audio file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding silence in audio file


  • Subject: Adding silence in audio file
  • From: sheen mac <email@hidden>
  • Date: Thu, 7 Sep 2006 04:09:22 -0700 (PDT)

Hai all,

I am doing an audio recorder using the code of
recordaudiotofileapp(source code from Apple)  ,I want
to add silence at some part so that i can fill it
later.

How can i add silent value to the audio buffer list.
i tried this
(*(float*)afr->fAudioBuffer->mBuffers[0].mData) =NULL;
but no effect.

anyone suggest me the better way of adding silence to
an audio file.

Here is the code


OSStatus DCAudioFileRecorder::AudioInputProc(void*
inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
UInt32 inNumberFrames, AudioBufferList* ioData)
{
	DCAudioFileRecorder *afr =
(DCAudioFileRecorder*)inRefCon;
	OSStatus	err = noErr;

	static int p = 0;
	// Render into audio buffer

// Here i want to add silence

	if(p>10 && p<500)
	{
		(*(float*)afr->fAudioBuffer->mBuffers[0].mData)
=NULL;

	}

	err = AudioUnitRender(afr->fAudioUnit, ioActionFlags,
inTimeStamp, inBusNumber, inNumberFrames,
afr->fAudioBuffer);

	if(err)
		fprintf(stderr, "AudioUnitRender() failed with error
%i\n", err);

	// Write to file, ExtAudioFile auto-magicly handles
conversion/encoding
	// NOTE: Async writes may not be flushed to disk
until a the file
	// reference is disposed using ExtAudioFileDispose
	//(*(float*)afr->fAudioBuffer->mBuffers[0].mData) =
-0.0f;
	//(*(float*)afr->fAudioBuffer->mBuffers[1].mData) =
0.0f;
//	if(p>0 && p<50)
//	{
//		(*(int*)afr->fAudioBuffer->mBuffers[0].mData) =0;
//
//	}
	err = ExtAudioFileWriteAsync(afr->fOutputAudioFile,
inNumberFrames,afr->fAudioBuffer);

.
.
.
}

thanks in advance

Sheen

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • [Moderator] EOT (Re: Adding silence in audio file)
      • From: cocoa-dev-admins <email@hidden>
  • Prev by Date: Re: New app for memory management?
  • Next by Date: Re: CoreData issue
  • Previous by thread: Re: CoreData transient attribute memory leak?
  • Next by thread: [Moderator] EOT (Re: Adding silence in audio file)
  • Index(es):
    • Date
    • Thread