• 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
AVAudioPlayerNode - Mix between schedule buffers and segments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AVAudioPlayerNode - Mix between schedule buffers and segments


  • Subject: AVAudioPlayerNode - Mix between schedule buffers and segments
  • From: Vincent CARLIER <email@hidden>
  • Date: Fri, 31 Mar 2017 09:04:57 +0200

Hello all,

I'm writing an application where I should play parts of audio files. Each audio file contains audio data for a separate track.
These parts are sections with a begin time and a end time, and I'm trying to play those parts in the order I choose.

So for example, imagine I have 4 sections :

A - B - C - D

and I activate B and D, I want to play, B, then D, then B again, then D, etc..

To make smooth 'jumps" in playback I think it's important to fade in/out start/end sections buffers.

So, I have a basic AVAudioEngine setup, with AVAudioPlayerNode, and a mixer.
For each audio section, I cache some information :

- a buffer for the first samples in the section (which I fade in manually)
- a tuple for the AVAudioFramePosition, and AVAudioFrameCount of a middle segment
- a buffer for the end samples in the audio section (which I fade out manually)

now, when I schedule a section for playing, I say the AVAudioPlayerNode :

- schedule the start buffer (scheduleBuffer(_:completionHandler:) no option)
- schedule the middle segment (scheduleSegment(_:startingFrame:frameCount:at:completionHandler:))
- finally schedule the end buffer (scheduleBuffer(_:completionHandler:) no option)

all at "time" nil.

The problem here is I can hear clic, and crappy sounds at audio sections boundaries and I can't see where I'm doing wrong.
My first idea was the fades I do manually (basically multiplying sample values by a volume factor), but same result without doing that.
I thought I didn't schedule in time, but scheduling sections in advance, A - B - C for example beforehand has the same result.
I then tried different frame position computations, with audio format settings, same result.

So I'm out of ideas here, and perhaps I didn't get the schedule mechanism right.

Can anyone confirm I can mix scheduling buffers and segments in AVAudioPlayerNode ? or should I schedule only buffers or segments ?
I can confirm that scheduling only segments works, playback is perfectly fine.

 _______________________________________________
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: RemoteIO timestamp alignment (input vs. output)
  • Next by Date: kMIDIPropertyTransmitsMTC always 0
  • Previous by thread: RemoteIO timestamp alignment (input vs. output)
  • Next by thread: kMIDIPropertyTransmitsMTC always 0
  • Index(es):
    • Date
    • Thread