• 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
Re: Coreaudio-api Digest, Vol 11, Issue 143
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coreaudio-api Digest, Vol 11, Issue 143


  • Subject: Re: Coreaudio-api Digest, Vol 11, Issue 143
  • From: Robert Carroll <email@hidden>
  • Date: Fri, 29 Aug 2014 18:53:49 -0400

If you want sample accurate timing, I think you will have to get inside the callback and track the sample time.

Once you have that, its relatively straight forward to trigger the first part of a sampled sound, or a synthesized sound.
The audioGraph sample code (extended from MixerHost) on GitHub would be a good place to start.
https://github.com/tkzic/audiograph/blob/master/Classes/MixerHostAudio.m

rob


Robert Carroll
RSM Records
Toronto
http://www.rsmrecords.com



On Aug 28, 2014, at 3:00 PM, email@hidden wrote:

Message: 3
Date: Wed, 27 Aug 2014 17:21:00 -0400
From: "Mazzaroth M." <email@hidden>
To: coreaudio-api <email@hidden>
Subject: schedule silence of n length
Message-ID:
<CALYQoYBiYXqNmyQ0D4LsgY11pD55Au+Z=email@hidden>
Content-Type: text/plain; charset="utf-8"

Hi, I have a simple AUGraph with a AUFilePlayer and DefaultOutput node. I
schedule playback of a short sample from a file. I'd like schedule a brief
gap of silence after that, then schedule the sample again. I'm basically
making a simple metronome and the length of the gap of silence should be
configurable. I'm not sure how to do this. Here is a snippet of how I
schedule the original file:

   UInt64 nPackets;
   UInt32 propsize = sizeof(nPackets);
   CheckError(AudioFileGetProperty
              (player_->inputFile, kAudioFilePropertyAudioDataPacketCount,
&propsize, &nPackets),

"AudioFileGetProperty[kAudioFilePropertyAudioDataPacketCount] failed");

   // set the start frame to the new position. position_ is always 0.
   player_->startFrame = _audioFileInfo.frames * position_;

   ScheduledAudioFileRegion rgn;
   memset (&rgn.mTimeStamp, 0, sizeof(rgn.mTimeStamp));
   rgn.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
   rgn.mTimeStamp.mSampleTime = 0;
   rgn.mCompletionProc = NULL;
   rgn.mCompletionProcUserData = NULL;
   rgn.mAudioFile = player_->inputFile;
   rgn.mLoopCount = -1;
   rgn.mStartFrame = player_->startFrame;
   rgn.mFramesToPlay = _audioFileInfo.frames - player_->startFrame;

   NSLog(@"  %ld mFramesToPlay | @ rgn.mStartFrame %qd |
player_->totalFrames: %llu | player_->startFrame: %f", (long
int)rgn.mFramesToPlay, rgn.mStartFrame, _audioFileInfo.frames,
player_->startFrame);

regards,
Michael

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: CoreAudio SDK for Xcode 4?
  • Next by Date: from xcode5 to xcode6-beta6, sounds are now distorted on iOS7
  • Previous by thread: Re: CoreAudio SDK for Xcode 4?
  • Next by thread: from xcode5 to xcode6-beta6, sounds are now distorted on iOS7
  • Index(es):
    • Date
    • Thread