Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Making an app to convert a music stream to look like a USB stick

This site may earn commission on affiliate links.
I have been thinking about the fidelity limitation of streaming via Bluetooth. Shouldn't it be possible to fool the car into thinking that a stream from a phone is a USB stick file? I am not an app developer, but have a software background and it seems to me that an android app developer might be able to:
  • Create a huge buffer (in the phone's memory)
  • Arrange to make that buffer look like a USB stick (music) file via the phone's USB connection
  • Write the phone's sound output stream into that buffer
To use it, you would:
  • start the app to create the 'file', then start the stream into the 'file'
  • If you then start the car playing from that 'file', it will necessarily lag behind the stream by the amount of time that it took to start up the car's player after starting the stream. That will give a little 'wiggle room' to the stream in case it stutters for a second or two
The huge buffer would be needed to avoid the complication of making temporary buffers for each song in the stream and rotating the stream and USB output to those new buffers, but of course that would also work and require less memory. But these days, high-end phones have enough memory that a huge buffer probably would be sufficient for several hours of hi-res streaming without that complexity.

I don't know whether android makes the USB port available to apps in a way that they could do this. But if that is possible, then this scheme would certainly work.
 
Unfortunately, streaming music quality is generally lower than Bluetooth music quality. Assuming that you paid for a premium plan that had very high quality music, conceptually what you’ve described is possible (I’d argue with some of the details, but that’s not important here), but extremely difficult in an Android/IOS environment.
It would probably be possible to build a small device that pretends to be a headset to the phone so it gets a high quality stream out of the phone, and looks to the car like a USB flash drive with a single music file on it. The device would stream from the phone to the file which the car would pick up and play.
Seems easier to just put music on a flash drive.
 
Raspberry Pi.

I've been toying with this idea for a while now but after looking on Github for something to use as a starter for a project I came up empty. I'm not a Linux or USB developer but also have a software background. It may be possible to emulate the USB Mass Storage Device type, but there are also hardware limitations. Only the Pi Zero and maybe the Pi 4 have USB ports that are capable of being used as "slave" devices, and I believe it is also the power port. There are programs like Audacity that have some capability to capture the stream but I don't know of a Linux build for a RPi but maybe there is. I have it on my iMac but haven't tried to use it for this purpose yet or even to see if I can capture the stream.

The other issue you will run into is copyright protection. You are not licensed to capture the stream and store it from any of the services, even if you are not actually storing it. It will think you are though.

If you can convince someone at Volumio to do this maybe they can as they know how to do this, or even a Volumio add-on. There are a few developers out there.

And streaming music quality using a service like Qobuz is VERY high. I was just playing something in 24/96 resolution at home, and it goes to 24/192 also. I was using this in my old minivan with an aux port and it sounded fabulous there too. Don't let the tin ears tell you that you can't hear the difference, you can. Over Bluetooth as I use it in my M3 some of it gets lost and it sounds pretty ordinary.
 
Last edited: