jscalo / tempi-fft

Real-time audio input and FFT written entirely in Swift for iOS.
253 stars 47 forks source link

Record the audio from Device itself #13

Open rsZWang opened 4 years ago

rsZWang commented 4 years ago

I need to analyze the audio played by device itself That means I play and record simultaneously

So I set audioSession like this: try audioSession.setCategory(.playAndRecord, mode: .videoChat, options: .defaultToSpeaker)

But there is always a warning from this: assert(remainderf(sizeFloat, powf(2.0, lg2)) == 0, "size must be a power of 2") It seems that the buffer will be effect when the audioSession set

I can modify the buffer size by try audioSession.setPreferredIOBufferDuration(0.1) But the size always can not be power of 2

How can I fix this problem? Thanks