Closed hyd00 closed 8 years ago
Also having the same issue on 6S.
Hooboy... also seeing this crash. No bueno! It does not occur everytime either :/
The exception is in: EZRecorder line 448
When setting the client data format
Any updates on this issue? I am now receiving this crash and error on an iPhone 6 since updating to iOS 9.2:
Error: Failed to fill complex buffer in float converter ('insz')
It worked fine before on iOS 8.4 through 9.1
9.2 - same for me (iPhone 6)
Hey guys seems like the EZAudioFloatConverter is bugging out for buffer sizes that aren't 512 or 1024. I'll need to look into that component and see what I'm doing wrong :/
9.2 - same for me (iPhone 5S)
The source of this problem is in EZAudioFloatConverterCallback (EZAudioFloatConverter.m). This function should update ioData->mBuffers[i].mDataByteSize. For 16bit mono audio stream it will look like ioData->mBuffers[0].mDataByteSize = ioNumberDataPackets \ sizeof(short);
What is really strange is that the FFT example seems unaffected by this bug?
^Exactly! The examples provided work perfect on ALL the devices (including 6S and 6S Plus)
I haven't tested the examples. I simply rebuilt my own project. The problem seems to have gone away on real devices but I still get crashes in the simulator. ¯\_(ツ)_/¯
any update on this ?
I'm facing crash in Iphone 6s and IOS 9.2
I don't know if it is related to what you guys are discussing, but I was getting this same error line when I tried to change the sample rate from 44100 to 8000 (for a guitar tuner app).
What I did was basically use this line of code to initialize the mic instance with a different sample rate:
AudioStreamBasicDescription inputFormat = [EZAudioUtilities monoFloatFormatWithSampleRate:SAMPLE_RATE];
self.microphone = [EZMicrophone microphoneWithDelegate:self withAudioStreamBasicDescription: inputFormat];
if I used double const SAMPLE_RATE = 8000.0f;
I'd get the error but it works with double const SAMPLE_RATE = 11025.0f;
11025 is pretty enough for what I want so...
Solution - @trkfabi 's code snippet led to my solution of this crash, which occurred on launch / microphone instantiation. And only starting occurring upon upgrading to iOS 9.2 for the majority of the users of my app.
I changed the microphone instantiation code from:
self.microphone = [EZMicrophone microphoneWithDelegate:self];
to
AudioStreamBasicDescription inputFormat = [EZAudioUtilities monoFloatFormatWithSampleRate:44100.0f];
self.microphone = [EZMicrophone microphoneWithDelegate:self withAudioStreamBasicDescription: inputFormat];
Tagging people so that this can hopefully get fixed and merged as soon as possible... @syedhali @davidwadge @patriksharma @Danbana @snyuryev @koooootake @dsmelov @garsdle @hyd00
I faced this issue when app have multi instances of EZMicrophone(). (iOS9.2 and iPhone5S, 6S)
I solved this issue by using EZMicrophone.sharedMicrophone()
instead of EZMicrophone()
.
@rbarbish @kenzukan I'm no luck with your code. like @syedhali said, buffer sizes that aren't 512 or 1024, in my device 6S(9.2) buffer size 940...crash..
It's so odd that demo without any error and buffer size is 1024 with iPhone6S 9.2
@rbarbish Thank you very much! Works for me! (iPhone 6 - iOS 9.2 and 9.1)
@snyuryev do you try iPhone6S iOS9.2?, all my devices are ok except 6S(iOS9.2)
@syedhali I found the cause of the problem. The internal speaker on the iPhone 6S models only support a sample rate of 48kHz while previous iPhone models supported a collection of sample rates.
1024 * (44100/48000) = 940.8, Micphone buffer size in EZAudio is 940 or 941 that crash.
I cann't understand why the demo didn't crash. I had fix my code with 48k.
@rbarbish solution worked for me. I have an iPad mini running iOS 9.2, never had an issue. I had an iPhone 4s running iOS 7.X, never had an issue. Upgraded my iPhone 4s to iOS 9.2, started having the issue every time I started recording.
@syedhali solution fixed our problem. On the iOS 9.2 with iPhone 6s Plus we were having the "Error: Failed to fill complex buffer in float converter ('insz')" error. We fixed it by specifying the microphone sample rate at 48000. But, doing that then broke it for our iOS 9.2 iPhone 5s and caused the same error. We fixed it by adding this piece of code:
if UIDevice.currentDevice().modelName.containsString("iPhone 6s") {
let inputFormat = EZAudioUtilities.monoFloatFormatWithSampleRate(48000.0)
microphone = EZMicrophone(microphoneDelegate: self, withAudioStreamBasicDescription: inputFormat)
}else{
microphone = EZMicrophone(microphoneDelegate: self)
}
Caveat: This may break when the iPhone 7 comes out because of how we are detecting the iPhone version.
Failed to write audio data to recorded audio file ('insz') i got this error iphone 5 iOS 9.2 .
Any update on above? Its showing issue in iOS 9.2, with multiple devices
Any update on this issue? Same issue in 9.2.1 too
Hey everyone, I was able to reproduce this issue by setting the preferred sample rate to 48000 (default on iPhone 6s + iPhone 6s+) and found out the issue was that the scratch AudioBufferList structures' mDataByteSize property used in the EZMicrophone and the EZAudioFloatConverter was not being set property.
This issue is fixed as of the 1.1.4 release. I'm closing this for now, but let me know if this is still an issue after updating.
I can reproduce this on 6s when fetching audio from an EZMicrophone and transitioning the output from iphone speaker to apple tv airplay. Any thoughts on what might be the reason?
Any updates on this issue? I am now receiving this crash and error on an iPhone X since updating to iOS 13 (beta):
-[FigRemoteRoutingContextFactory copySystemAudioContextWithAllocator:options:context:] signalled err=-12029 (kFigRoutingContextError_FetchSystemContextUnentitled) (Must be properly entitled to use system output contexts) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMediaFramework/EmbeddedCoreMedia-2501.7.1.1/Sources/MediaExperience/Routing/FigRemoteRoutingContextFactory.m:62 Error: Failed to fill complex buffer in float converter ('insz')
It worked fine before iOS 13.
@ShrikantCoder same to me, do you have any solution ?
any update on the solution I have same issue on iPhone X running iOS 13 beta @ShrikantCoder
@sugite any solution ?
Solution:
#if TARGET_IPHONE_SIMULATOR
AudioStreamBasicDescription inputFormat = [EZAudioUtilities monoFloatFormatWithSampleRate:48000.0f];
self.microphone = [EZMicrophone microphoneWithDelegate:self withAudioStreamBasicDescription:inputFormat];
#else
self.microphone = [EZMicrophone microphoneWithDelegate:self];
#endif
For iOS 13 it will return the same error if you are using a sample rate other than 44100. It will crash with:
Error: Failed to fill complex buffer in float converter ('insz')
The simple fix is to set the shared audio session sample rate equal to value you specify in EZMircophone. I can go more into detail if you want.
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playAndRecord, mode: .default, options: [])
try audioSession.setPreferredSampleRate(16000)
try audioSession.setActive(true, options: [])
// convert mic input to format required for asr
var monoStreamFormat:AudioStreamBasicDescription = AudioStreamBasicDescription()
monoStreamFormat.mSampleRate = 16000
...
self.microphone = EZMicrophone(delegate: self, with: monoStreamFormat, startsImmediately: false)
Thanks for your solution i didnt test it yet on my problem but one thing i’ve been noticed is that every case problem here involves ezmicrophone but in my case iam not even using microphone my case is playing some avaudio files using ezaudioplayer what do you think? @dengini
@mahadshahib Without having a sample project it's difficult to say. I will describe what I did to fix my issue. It may help.
Set a breakpoint in EZAudioUtilities.m (Line 539). See what functions are called before it.
fprintf(stderr, "Error: %s (%s)\n", operation, errorString);
In my case I noticed it was EZAudioFloatConvert.m
- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers
packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions
// print out frame info for debugging
NSLog(@"frames:%d, mBytesPerFrame:%d, mDataByteSize:%d", frames, self.info->inputFormat.mBytesPerFrame, frames * self.info->inputFormat.mBytesPerFrame);
Connected 2 phones. 1 iOS 12 and iOS 13 and compared the values. I noticed that mBytesPerFrame was 4 on iOS 13 and 2 on iOS 12. This was the cause of my problem.
I traced the call to EZMicrophone.m setup function (Line 251).
self.info->inputFormat.mSampleRate = [[AVAudioSession sharedInstance] sampleRate];
The above pulled the value from shareInstance instead of value I passed. The phone default was 44100 instead of 16000. This caused the buffer size mismatch.
Setting the shareInstance sample rate to match the EZMicrophone value fixed my issue.
try audioSession.setPreferredSampleRate(16000)
thanks again i test this solution and it didn't work for me . I have a very sample project with my problem I made a zip file here https://github.com/mahadshahib/PandoraPlayerTest1 can you take a quick look at my project and help me in it thank you. @dengini
@dengini
try AVAudioSession.sharedInstance().setPreferredSampleRate(8000)
also this line changes sample rate on iOS 12 simulator but it has to effect on iOS 13 iphone x
does anyone have a solution for iOS 13?
@mahadshahib Last week was very busy. I just took a look at the code you posted. I was able to get it to build using AudioKit 4.9. Unfortunately the sample code you uploaded has other issues. I didn't get a crash on EZAudio.
Crash line (PandoraPlayer.swift):
commandCenter.togglePlayPauseCommand.addTarget(self, action: #selector(onPlay))
Error (crash from addTarget above):
2019-09-23 14:28:39.797487-0700 PandoraPlayerTest[2967:779908] *** Assertion failure in -[MPRemoteCommand addTarget:action:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/MediaPlayer/MobileMusicPlayer-4017.101.15/SDK/MPRemoteCommand.m:134
2019-09-23 14:28:39.798702-0700 PandoraPlayerTest[2967:779908] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported action method signature. Must return MPRemoteCommandHandlerStatus or take a completion handler as the second argument.'
*** First throw call stack:
(0x1b01a098c 0x1afec90a4 0x1b00a2d1c 0x1b04d88f4 0x1bc4f2fa0 0x1045b8b6c 0x1045b4620 0x1045b4200 0x1045b15c8 0x1045b1210 0x1045b1250 0x1b3b9c560 0x1b3ba1070 0x1b3ba1478 0x1b3bb6ba8 0x1b3baf9b8 0x1b3bb1338 0x1b3bb38a4 0x1b3bb3da0 0x1b3bb37f4 0x1b3bb3a5c 0x10459b424 0x10459b49c 0x1b41aede0 0x1b3bf2bb4 0x1b3bf2f18 0x1b3bf1f34 0x1b41e8104 0x1b41e9444 0x1b41c5e84 0x1b423d43c 0x1b423f998 0x1b423880c 0x1b011e7e0 0x1b011e738 0x1b011ded0 0x1b011901c 0x1b01188bc 0x1b9f7d328 0x1b41ada70 0x1045a52dc 0x1affa3460)
libc++abi.dylib: terminating with uncaught exception of type NSException
Did you test it on a physical device running iOS 13?
Physical device iOS 13.1 Xcode 11. App Store build not GM
@dengini Perhaps this bug is fixed in iOS 13.1 then. I ran the code in that sample PandoraPlayer project, and I am getting the same crash when the EZAudioPlayer plays (Error: Failed to fill complex buffer in float converter ('insz')).
Could you try commenting out updateCommandCenter()
at line 730 of PandoraPlayer.swift and seeing if you're able to reproduce the error on your device running iOS 13.1?
Same crash on XS running 13.0. After click button, the player form crashes on present. The same error as reported above. I can't see audio playback error. My pod info for comparison.
PODS:
- AudioKit (4.9):
- AudioKit/Core (= 4.9)
- AudioKit/UI (= 4.9)
- AudioKit/Core (4.9)
- AudioKit/UI (4.9):
- AudioKit/Core
- SPStorkController (1.7.9)
Did you comment out the updateCommandCenter()
at line 730 of PandoraPlayer.swift?
@ashishkeshan commenting out that line worked. The player loaded. Unfortunately I can't help you. You are using AudioKit instead of including EZAudio directly. AudioKit only includes the header files not the source. I can't trace the code into EZAudio files to see the values.
I would need example app which included the Xcode project for AudioKit so all source was included. Too difficult to debug without being able to see values for EZAudio buffers.
Did you get the same error when the player loaded though? (Error: Failed to fill complex buffer in float converter ('insz')). I am trying to determine if this is simply an iOS 13 bug that will get patched in iOS 13.1, or if I should spend more time investigating the issue as you mentioned.
@ashishkeshan Yes. I was able to replicate the buffer error on 13.0 & 13.1 after commenting out that function. Like said in my edited comment above. I can't really do much without source code for AudioKit included. Need to be able to see buffer values to determine cause of mismatch.
Error: Failed to fill complex buffer in float converter ('insz')
Ideally if you can create a sample project just including EZAudio with audio playback. This will simplify things quite a bit. EZAudio cocoapod is deprecated but comes with full source when include it. Makes it easy to trace through code and view values. With AudioKit it just a binary so can't really debug. Unless you remove the Podfile and include fill source and project file for AudioKit.
Hey @dengini -- I just set up a sample project here: https://github.com/ashishkeshan/TestEZAudioBug
I am trying to set the sample rate to 48000, but for some reason, the value that is used by the EZAudioPlayer internally is always 44100, which is causing the buffer sizes to be 940 or 941 frames resulting in the mismatch. However, when I plug my bluetooth headphones in, the EZAudioPlayer works perfectly, and the buffer size is 1024 frames. Therefore, I believe the quick fix is to ensure that the EZAudioPlayer internally uses the 48000 sample rate when music is played through the speakers (because the iPhone speakers support a sample rate of 48k hz).
Unfortunately, there is no way to set the sample rate for the EZAudioPlayer as there is for the EZMicrophone which was described in the solutions above.
@ashishkeshan @dengini I was able to reset sample rate to what ever I wANT with audiukit global setting using AKSetting.sample but not matter how I change sample rate it still crashes on physical device I think we have to email audio kit developers and let them know maybe they would fix it
From looking at the new sample project. The audio player is a bit different than Microphone. This I what I noticed so far. I will try look again this evening if I have more free time. FYI: around Xcode 10 it stopped auto rebuilding the pods when changes are made. If you modify EZAudio code you need to do a clean and rebuild app each time.
EZAudioFloatConverter.m
- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers
packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions
{
...
[EZAudioUtilities checkResult:AudioConverterFillComplexBuffer(self.info->converterRef,
EZAudioFloatConverterCallback,
audioBufferList,
&frames,
self.info->floatAudioBufferList,
packetDescriptions ? packetDescriptions : self.info->packetDescriptions)
operation:"Failed to fill complex buffer in float converter"];
In this function it appears to work for the first 5 calls and fails on the 6th. So far the only thing that stands out is the 5th buffer was slightly smaller at 3760, then 6th was back to 3764. I am not certain this is the cause, but something to look into.
2019-09-24 13:37:57.303360-0700 Project10[759:104811] frames:941, mBytesPerFrame:4, mDataByteSize:3764
2019-09-24 13:37:57.324460-0700 Project10[759:104811] frames:941, mBytesPerFrame:4, mDataByteSize:3764
2019-09-24 13:37:57.345794-0700 Project10[759:104811] frames:941, mBytesPerFrame:4, mDataByteSize:3764
2019-09-24 13:37:57.367112-0700 Project10[759:104811] frames:941, mBytesPerFrame:4, mDataByteSize:3764
2019-09-24 13:37:57.388501-0700 Project10[759:104811] frames:940, mBytesPerFrame:4, mDataByteSize:3760
2019-09-24 13:37:57.409782-0700 Project10[759:104811] frames:941, mBytesPerFrame:4, mDataByteSize:3764
Error: Failed to fill complex buffer in float converter ('insz')
Everything is working great on iPhone 4S, 5 / 5S, 6 and 6 Plus , but when trying to use audioplot on iPhone 6S and 6S Plus, following error is coming:
Error: Failed to fill complex buffer in float converter ('insz')
I have also implemented https://github.com/syedhali/EZAudio/issues/173 solution, but no luck
Please help!