examples
examples copied to clipboard
Updated AudioInputManager and ViewController to read audio data appro…
…priate to the iOS documentation
Now cant import anything it's showing "PortAudio library not found" error while importing
Now cant import anything it's showing "PortAudio library not found" error while importing
Hi @Sanjay2802, is this occurring on the following branch from which I have raised PR? branch - thumbarnirmal:master
Noo , i suppose
@thumbarnirmal Could you clarify what's the issue with the current code?
@Sanjay2802 The PortAudio library not found error occurs in Python's tflite-support package v0.4.0 on Linux. You can fix it by either:
- Run
sudo apt-get install libportaudio2 - Use the nightly build of tflite-support (
pip install tflite-support-nightly). The error is already fixed in master branch and will be release in the next version of tflite-support.
Hi @khanhlvg
The inputNode.installTap callback in AudioInputManager.swift file returns audio data in range of [100, 400] milliseconds. This is specified in the iOS documentation which can be checked in xcode. It is not specified in apple developer docs website.
When the audio data returned by installTap callback is converted and saved in pcmBuffer, the pcmBuffer will have only 400 ms of unique data. The same audio data is repeated to fill the pcmBuffer for 1 second. This can be checked by trying to match pcmBuffer array from index[0:399] and index[400:799].
Above explanation is based on the assumption that inputNode.installTap has buffersize which is greater than or equal to 400 ms. If, for example, buffer size is equivalent to 200 ms, same issue would occur, but data would repeat in pcmBuffer from index 200, 400 and so on.
When the audio data returned by installTap callback is converted and saved in pcmBuffer, the pcmBuffer will have only 400 ms of unique data. The same audio data is repeated to fill the pcmBuffer for 1 second. This can be checked by trying to match pcmBuffer array from index[0:399] and index[400:799].
For sake of brevity, I have mentioned time in milliseconds as indexing value in array. Actual array index would be calculated by multiplying the pcmBuffer's sampling rate with the time value in seconds.