AEBlockChannel audio output amplitude shrink problem


First of all, thank you for the great sound engine.

I am using TAAE for a few months for generating square wave in my iPhone app.
I am developing an app and a circuit harvesting power from the audio signal through the earphone jack.
It is a kind of project just like project hijack

Anyway, recently I've got iPhone 6s and 6s plus for test and found a problem with them.

The problems are that the audio output amplitude shrinks periodically and the maximum amplitude is smaller with iPhone 6s than with other iPhone models.
Before testing with iPhone 6s and 6s plus, I didn't notice this problem because the shrinking is small but It is quite big with iPhone 6s.
If the amplitude shrinks the voltage produced by the audio signal drops too.
I've checked the wave shrinking and power drop with my oscilloscopes.

My code is this.

double outputPosition = 0.0;
const double TWO_PI = M_PI * 2.0;
const double outputRate = 14700.0/44100.0 * TWO_PI; = [AEBlockChannel channelWithBlock:^(const AudioTimeStamp *time,
                                                UInt32 frames,
                                                AudioBufferList *audio) {
SInt16 * leftChannel = ((SInt16*)audio->mBuffers[0].mData);
SInt16 * rightChannel = ((SInt16*)audio->mBuffers[1].mData);

  for ( int i=0; i<frames; i++ ) {

      if (outputPosition >= 0.0) {
          leftChannel[i] = INT16_MAX;
          rightChannel[i] = INT16_MAX;
      } else {
          leftChannel[i] = INT16_MIN;
          rightChannel[i] = INT16_MIN;

      outputPosition += outputRate;

      if (outputPosition >= M_PI) {
          outputPosition -= TWO_PI;

[ setVolume:1.0];
[ setPan:0.0];

Quite simple. As you can see, I'm using both channel.

I've read TAAE and the iPhone 6S announcement and upgraded to TAAE 1.5.5
I think it is not related automaticLatencyManagement setting or 48kHz Sample Rate of iPhone 6s.
Sin wave has the same problem, too.

I have no idea why these problem happens.
I think this problem may be the iPhone problem and not the TAAE problem. But I want to make it clear.

I hope you have any clue for this problem or anything to advise.

Thank you.

Sign In or Register to comment.