Forum Rule: Always post complete source code & details to reproduce any issue!
-
USB Audio with iPhone 12 as source (T4.0)
One of my test users is experiencing audio issues when using an iPhone 12 as a source to a teensy 4.0. The issue does not happen with Windows, Linux, or Android as a source in my testing, only the iPhone. It manifests as very short 'breaks' in the audio periodically during playback. Does anyone happen to have knowledge of issues with Apple's USB stack or transfer when used as a USB audio source to the Teensy? Any thoughts on how I might go about troubleshooting this or where I might look for clues on the Teensy end? Something there isn't quite right...
Thanks for any help or direction!
-
I managed to get ahold of an iPhone, and that - after some time has passed - the iPhone begins causing buffer overruns. Although overruns are seen in the Android and Windows cases, they appear as single overruns spaced out so there is time for them to be handled. in the case of the iPhone, they arrive in bunches. When this happens it appears as though the overrun recovery is taking too long to return and is causing a short break in the audio. Anything that increases latency through usb_audio_receive_callback() in usb_audio.cpp makes the problem worse. This is true at both 12Mbit and 480Mbit USB rates. Reducing the packet burst rate has no effect.
-
How is the iPhone connected to the Teensy? USB hubs may cause issues. Try connecting directly or with different ports.
-
Never seen that hubs can cause issues with Teensy USB audio. Ok, if there are several devices connected, of course, because they need the bandwidth. But not with a Teensy alone...
Do you have a link? Where is this information from?
-
This issue is not hub related. The Teensy connects to the source device directly for Android and Windows cases, and through the 'Apple Camera Adapter' for iPhone cases. The Camera Adapter is necessary as the iPhone lacks a native USB port.
-

Originally Posted by
Frank B
Never seen that hubs can cause issues with Teensy USB audio. Ok, if there are several devices connected, of course, because they need the bandwidth. But not with a Teensy alone...
Do you have a link? Where is this information from?
I had an issue in this link. https://forum.pjrc.com/threads/69032...s-records-once
Paul’s article on a USB hub bug. https://www.pjrc.com/usb-hub-bug-hun...ssons-learned/
-

Originally Posted by
highly
This issue is not hub related. The Teensy connects to the source device directly for Android and Windows cases, and through the 'Apple Camera Adapter' for iPhone cases. The Camera Adapter is necessary as the iPhone lacks a native USB port.
If it doesn’t work connected to the adapter, try using a USB hub on the adapter or try other adapters.
-

Originally Posted by
btspp;296599
Paul’s article on a USB hub bug. [URL
https://www.pjrc.com/usb-hub-bug-hunting-lessons-learned/[/URL]
That's not an article about a buggy hub. It's about a bug in the Teensy HOST code that is fixed now...
-
Speaking of fixed, the issue appears to be corrected by enabling the feedback accumulator code in usb_audio.cpp
Code:
if (f) {
int diff = AUDIO_BLOCK_SAMPLES/2 - (int)c;
feedback_accumulator += diff * 1;
--> int32_t feedback = (feedback_accumulator >> 8) + diff * 100;
--> usb_audio_sync_feedback = feedback;
//printf(diff >= 0 ? "." : "^");
}
This has no impact on playback from Windows or Android, and corrects the intermittent glitches on the iPhone.
This thread appears to describe a long-fixed bug with similar symptoms.
Last edited by highly; 01-01-2022 at 02:26 PM.
Reason: formatting
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules