0

MP3 over Metro? Bluetooth as well? Best practices?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MP3 over Metro? Bluetooth as well? Best practices?

by Ada485 on Tue Feb 05, 2019 11:11 am

We saw the guide about playing and decoding the now patent free MP3 files. Here is the current state of native MP3 decoding it seems like:
https://learn.adafruit.com/native-mp3-d ... o/overview
To do: A lot! This code isn't optimized, doesn't use DMA, requires two DACs at this time (doesn't support I2S)... but it is working proof-of-concept!
It also requires a M4 in order to have enough processing capability to make that actually work in terms of hardware requirements.

There's the Teensy library as well but that still doesn't seem to support MP3 decoding as a mature codebase yet. Though it seems like it is able to work with the M4 as it has been ported over. See viewtopic.php?f=63&t=146644.

Teency Audio Code Library:
https://github.com/FrankBoesing/Arduino ... -Codec-lib
https://forum.pjrc.com/threads/27059-MP ... th-example

So maybe we move to offloading the MP3 playing to a dedicated chip and have the Arduino just tell the chip what to play? Something like this:
http://www.electronics-lab.com/project/ ... ayer-mini/

The main issue is that we also want to play over Bluetooth. And it appears that it is just easier to buy a $10 3.5mm to Bluetooth adapter that plugs directly into a 3.5mm port that we connect directly to the M4 Arduino because that is easier than adding a Bluetooth module that has to be integrated to the Arduino in some way anyway and most Arduino M4 platforms lack this (I don't know of any that are M4 based AND have Bluetooth) and use that sort of workaround to play MP3 output that is also offloaded over Bluetooth as there appears to be no easy or quick way to actually do that natively on the Arduino platform. So basically we would offload MP3 decoding, offload Bluetooth and use dedicated hardware for both of those things and only call up or interact with tracks through SPI or I2C or something like that? That all seems a bit odd considering how easy playing an MP3 over Bluetooth is to do on any even 10 year old CPU platform, most all of which have built in Bluetooth now (including many Arduinos) and if not, a $2 USB to Bluetooth adapter will add it but this is what we are able to gather about the current state of playing Bluetooth audio and ideally MP3 audio over Arduino.

Here is some work done on the "Arduino MP3 module" side of things, before Bluetooth.
http://www.vwlowen.co.uk/arduino/mp3-pl ... player.htm

Anybody have any thoughts or suggestions about this or are we missing something about the state of playing MP3s over Bluetooth over Arduino in 2019?

Ada485
 
Posts: 95
Joined: Wed Oct 10, 2018 1:04 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by adafruit_support_mike on Thu Feb 07, 2019 4:16 am

If you want to offload MP3 decoding to another chip, the VS1053 is designed for just that:

https://www.adafruit.com/product/1381
https://www.adafruit.com/product/3436

Ada485 wrote:it appears that it is just easier to buy a $10 3.5mm to Bluetooth adapter that plugs directly into a 3.5mm port

Very much so, yes.

Only Bluetooth Classic is fast enough to transmit audio data, and all BT-C devices are required to have a Vendor ID number, which you have to buy from the Bluetooth Working Group. BT-C isn't hacker-friendly in any way, so the only workable solution for hobbyists is to pull a board from an off-the-shelf device.

adafruit_support_mike
 
Posts: 55848
Joined: Thu Feb 11, 2010 2:51 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by Ada485 on Thu Feb 07, 2019 10:31 am

That's pretty much the conclusion we reached. Seems fairly odd especially given the MP3 patents have now expired and Bluetooth is starting to show up in a huge amount of places. But you are right, much of it is low energy, which does not have the bandwidth to support streaming of audio. Probably easier to offload this to another chip but still seems strange that we cannot easily play MP3 files over an Arduino while streaming it over Bluetooth at this point in time given how long MP3 players have been out there. At least the M4 processor is fairly new and work is at least progressing there with regards to on board MP3 work? But between the patent cumbersomeness, the Bluetooth requiring vendor IDs and the raw horsepower not really being there until fairly recently for the Arduino platform, it seems like the BB and RPi and others have a bit of a leg up here it seems like?

I guess going to offload MP3 decoding as well as Bluetooth playing. Frees up the Grand Central to do other things but not quite the original design intent!

Ada485
 
Posts: 95
Joined: Wed Oct 10, 2018 1:04 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by adafruit_support_mike on Fri Feb 08, 2019 5:54 am

Even Bluetooth Classic doesn't have the bandwidth to transmit audio data in real time. The data transmitted via Bluetooth is the MP3, and the BLE peripheral in the speaker does the MP3 decompression.

adafruit_support_mike
 
Posts: 55848
Joined: Thu Feb 11, 2010 2:51 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by Ada485 on Fri Feb 08, 2019 1:10 pm

Are you sure? Bluetooth 3.0 High Speed has a throughput as high as 24 Mbps though. Even a WAV file at 44.1 KHz, 16 bit, 2 Ch. (stereo) audio needs just 0.1764 MBps (megabytes per second) or 1.4112 Mbps (megabits per second).

Now BLE is only good for something like 2.6 KB/s. Far too slow. But my understanding was that Bluetooth Classic (under Bluetooth 3.0 High Speed) certainly has enough bandwidth to stream even raw WAV files to be played directly without needing to simply send MP3 audio to be decoded.

Edit: The high data rate traffic of Bluetooth 3.0 HS is carried over a colocated 802.11 link. Not really over Bluetooth. So that's not really a fair comparison.

However, Wikipedia reports that the bit rate of Bluetooth EDR at least is 3 Mbit/s, although the maximum data transfer rate (allowing for inter-packet time and acknowledgements) is 2.1 Mbit/s. Which would be enough to send an uncompressed WAV file directly.

Also, Bluetooth 5 provides, for BLE, options that can double the speed (2 Mbit/s burst) at the expense of range.

Looking back, Bluetooth 1.2 can only support up to 721 kbit/s, which is below the bandwidth needed to sending raw WAV files. Though it could send MP3 files, which are typically around 128 to 320 kbit/s or so.

Ada485
 
Posts: 95
Joined: Wed Oct 10, 2018 1:04 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by adafruit_support_mike on Sat Feb 09, 2019 4:04 am

Ada485 wrote:Edit: The high data rate traffic of Bluetooth 3.0 HS is carried over a colocated 802.11 link. Not really over Bluetooth. So that's not really a fair comparison.

Yep, the Bluetooth Working Group apparently has a high population of marketing types.. they love to use confusingly-similar names for fundamentally different technology layers.

To be as fair as reality permits, 'Bluetooth High-Speed' is a Wifi connection whose config settings are negotiated via BT-C, so at least the BT hardware plays some useful (if temporary) role.

Standard BT-C is generally assumed to have an effective bitrate of 1Mbps, and it's not like the Working Group would be averse to having device makers handcuffed to patent-encumbered MP3 CODECs at both ends of the connection. It's an organization of big players writing rules for the continued benefit of big players.

Absorbing and renaming the Wibree protocol as 'Bluetooth Low Energy' can be seen as a way to bring a disruptive competitor under their control, though they may have to disrupt themselves anyway. There's too much market for inter-device communication to ignore, and too much demand within that market for a real, lightweight data transfer protocol.

adafruit_support_mike
 
Posts: 55848
Joined: Thu Feb 11, 2010 2:51 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by Ada485 on Sat Feb 09, 2019 1:22 pm

MP3 codecs are no longer patent encumbered as of about April 2017. The Fraunhofer Institute declined to renew the intellectual property it owns on the MPEG Audio Layer III technology and also terminated it's licensing program.

Ada485
 
Posts: 95
Joined: Wed Oct 10, 2018 1:04 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by adafruit_support_mike on Mon Feb 11, 2019 5:01 am

That's true, and we have a project that decodes MP3s with code running on a SAMD51 (in no small degree because we *can* post the code without getting threats from the RIAA any more):

https://learn.adafruit.com/native-mp3-d ... on-arduino

BT audio was developed when the patents were active though.

adafruit_support_mike
 
Posts: 55848
Joined: Thu Feb 11, 2010 2:51 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by Ada485 on Mon Feb 11, 2019 8:01 pm

I saw that. The code is still very much a work in progress and we can't order a Grand Central board yet either as the first beta version was 50 pieces or so and the revised version is still coming in a while once changes have been identified is what it looks like. Hopefully that changes though. For now it is easier to use an external dedicated hardware device but it would be preferable to just use the processor to, well, process MP3 audio directly.

No idea about the Bluetooth patents off the top of my head but they do sound more patent encumbered. A brief amount of research seems to suggest that:

The first patent is U.S. Patent No. 6590928, titled Frequency Hopping Piconets in an Uncoordinated Wireless Multi-User System. The patent discloses a wireless network with a master unit and a slave unit, the master unit being capable of communicating with the slave unit by means of a virtual frequency hopping channel. The invention solved a need for a cost-effective wireless local network supporting both voice and data transmissions by enabling self-organization techniques to make efficient use of limited available radio spectrum.

The patent application was filed in September 1997 and was issued by the U.S. Patent and Trademark Office in July 2003; it lists Haartsen as inventor and Ericsson as assignee.

Bluetooth SIG formed in 1998.

It's now 2019. That was filed after 1995 so it should have expired back in 2017? I am not a lawyer though but is this correct? Is Bluetooth still patent encumbered?

Ada485
 
Posts: 95
Joined: Wed Oct 10, 2018 1:04 pm

Re: MP3 over Metro? Bluetooth as well? Best practices?

by adafruit_support_mike on Sat Feb 16, 2019 5:53 am

Bluetooth itself may not be encumbered by patents, but the BT Working Group is an industry association of large players working for the benefit of large players. IP portfolios and licensing fees are a common part of that part of that system in general.

The major limit on BT-C hacking is the requirement to use a VID.

adafruit_support_mike
 
Posts: 55848
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.