AUNewTimePitch distorts audio from AUFilePlayer when active

Originator:invalidname
Number:rdar://13171503 Date Originated:2/7/13
Status:closed; duplicate of 12131959 (Closed) Resolved:
Product:iPhone SDK Product Version:6.1
Classification:serious bug Reproducible:always
 
07-Feb-2013 11:30 AM Chris Adamson:
Summary:
A demo of the AUNewTimePitch audio unit, when connected to an AUFilePlayer, boosts audio levels to the point where they distort the sound.

Steps to Reproduce:
In the attached zip, open the the TimeSliderDemo Xcode project. This is a sample I use to show off AUNewTimePitch at iOS developer conferences (CocoaConf, etc.). It creates an AUGraph consisting of an AUFilePlayer, AUNewTimePitch, and AURemoteIO for output. It sets AUNewTimePitch's default stream format as the output format of the file player and the input format to RemoteIO. Here's the CAShow():

AudioUnitGraph 0x1A3A000:
  Member Nodes:
	node 1: 'augn' 'afpl' 'appl', instance 0x1f580e90 O I
	node 2: 'auou' 'rioc' 'appl', instance 0x1f57d110 O I
	node 3: 'aufc' 'nutp' 'appl', instance 0x1f589230 O I
  Connections:
	node   1 bus   0 => node   3 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
	node   3 bus   0 => node   2 bus   0  [ 2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved]
  CurrentState:
	mLastUpdateError=0, eventsToProcess=F, isRunning=F

An iLife loop (presumed to be available on any modern-day Mac) is part of the target and is copied to the bundle. This loop (Bossa%20Lounger%20Long.caf) is what the file player is set to play.

An onscreen slider allows the user to set the kNewTimePitchParam_Rate parameter on AUNewTimePitch, making it play faster or slower while maintaining the pitches of the original music. A "Reset to 1.0" button allows the user to reset the rate to exactly 1.0 (normal speed) rather than fuss with the slider.

A UISwitch allows the user to disable the effect. When set to no, we set kAudioUnitProperty_BypassEffect to true on AUNewTimePitch.

Expected Results:
The user should hear the original audio, and then be able to make it play faster or slower with the slider, or eliminate the effect with the switch.

Actual Results:
While the app works as designed, the audio is significantly boosted and distorted when played on the device. An example of this is in the provided zip as "AUNewTimePitch-distortion.aif" (I also created an .m4a version). This is the result of letting the loop play through in its entirety on an iPhone 4S, with the headphone out connected to a small mixer and into my Mac's audio in. At about 00:00:36, I tap the switch and bypass AUNewTimePitch -- the distortion immediately disappears and the audio sounds pretty good.

[Note that this audio file does not capture the rate-shifting effect, since that works but is not the point of this report. The distortion is always present when the AUNewTimePitch is active, regardless of the rate parameter.]

Regression:
The audio sounds just fine in the iOS simulator. It is only distorted on the device.

Notes:


07-Feb-2013 11:30 AM Chris Adamson:
'TimeSliderDemo-Buglet.zip' was successfully uploaded

[OpenRadar readers: code and audio zip at https://dl.dropbox.com/u/12216224/buglets/TimeSliderDemo-Buglet.zip ]

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!