Audio from bluetooth device is delayed by around 3 seconds
See original GitHub issueSystem:
Bug: Audio from bluetooth device is delayed by around 3 seconds. See https://github.com/rbn42/panon/issues/26.
Reproducible script:
import soundcard as sc
import numpy as np
sample_rate=44100
channel_count=2
fps=60
blocksize = sample_rate // fps
mics = sc.all_microphones(exclude_monitors=False)
streams = []
for mic in mics:
stream = mic.recorder(
sample_rate,
channel_count,
blocksize,
)
stream.__enter__()
streams.append(stream)
for i,mic in enumerate(mics):
print('Stream %d id:%s'%(i,mic.id))
print('Stream %d name:%s'%(i,mic.name))
while True:
msg=''
for i,stream in enumerate(streams):
data = stream.record(blocksize)
if np.sum(data)==0:
msg+='Stream %d:paused '%i
else:
msg+='Stream %d:playing '%i
print(msg,end='\r')
Requires NumPy. Thanks to @rbn42 for creating the script.
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (9 by maintainers)
Top Results From Across the Web
How to Fix Sound Delay in Bluetooth Headphones
Reset your Bluetooth headphones and speakers then try reconnecting them again to your computer after a few seconds. With luck, it would reset...
Read more >bluetooth headphone sound starts after 2 to 3 seconds delay
bluetooth headphone sound starts after 2 to 3 seconds delay. This problem happens whenever something tries to play a "new" sound for exemple ......
Read more >How To Fix Bluetooth Audio Delay? - TechNewsToday
Hard reset your Bluetooth Device. Most Bluetooth earphone devices reset after pressing the power button for 5-10 seconds of the case. Some ...
Read more >Fix Bluetooth sound delay in Windows 11/10
One of these solutions is sure to help fix the Bluetooth sound delay and audio lag & latency problem in Windows 11/10 effortlessly....
Read more >9 Ways to Fix a Bluetooth Audio Delay in Windows 11
1. Reconnect Your Bluetooth Hardware · 2. Rule Out Interference From Other Devices · 3. Rule Out Hardware Issues · 4. Ensure Your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the delay, mix of busyness and sleep.
The times stay about the same constantly but the headset is still delayed by 3s. Playing the audio through other channels does not delay the audio and (when using Panon) selecting only the headset also does not delay the audio.
Probably, yes. I think CFFI releases the GIL while calling C functions, so that should be ok. (Don’t use async though. Async certainly does not work.)
So far, I had assumed that the latency was incurred in the
record
step. But you are right, this doesn’t make sense. If onerecord
were to take three seconds, it would delay all otherrecord
s as well. So SoundCard is probably pulling the data off the sound card as fast as it is produced (with the occasional missed block as we discussed), but the Bluetooth device on pulse somehow has a built-in delay of three seconds before it is even passed to SoundCard.