JUCE Audio Application doesn't work properly with bluetooth headphone

I have created a simple audio player application for Android that plays MP3 files stored on the phone. It calculates the BPM of the currently playing song and applies basic effects like reverb and EQ. However, I am experiencing an interesting issue. The BPM calculation works fine when playing audio through the phone’s speaker or wired headphones, but when I choose to play the sound through Bluetooth (such as Bluetooth headphones or speakers), the BPM calculation doesn’t work and shows a tempo of 0.

I’m wondering if the Bluetooth connection is changing the sampling rate or block size, or if this strange error is caused by something else. Do you have any ideas?

What could the Bluetooth connection have to do with the BPM calculation? This function doesn’t seem to work when audio is streaming through Bluetooth.

Whenever your AudioProcessor detects the change of an audio device, you effectively have to reset your algorithm to the new buffer sizes, and sample rates, of the new device. You cannot assume that each device is going to be equivalent, even on mobile - so, detect the device change event and update your processing to accommodate the new metrics.

2 Likes

Thank you, it worked