Adding Additional Bluetooth Codec Support to Moode 7.1 - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: FAQ and Guides (https://moodeaudio.org/forum/forumdisplay.php?fid=9) +--- Thread: Adding Additional Bluetooth Codec Support to Moode 7.1 (/showthread.php?tid=3683) |
Adding Additional Bluetooth Codec Support to Moode 7.1 - scblock - 04-07-2021 Moode 7.1 includes Bluetooth support and can act both as a receiver for playback and a player to Bluetooth headphones or speakers. By default it supports the standard SBC codec, which essentially everything supports. This is fine as a minimum, but if we want we can add support for more advanced or high quality codecs, including AAC (used by Apple devices such iPhones), AptX and AptX HD (higher quality, common on android), and LDAC (claimed highest quality, with more support as time goes on). Because of license restrictions on these proprietary codecs I don’t think any can be shipped by default with a packaged build of Moode. But we can replace the included bluez-alsa package with one we compile ourselves to add them. This guide is current as of April 6, 2021, and assumes a fresh installation of Moode 7.1 and some familiarity with the command line. And yes we’re building everything from the current github commits rather than a formal release. It should work, but I don’t take any responsibility for broken upstream code. I rarely use Bluetooth, and this may not be reliable at all. Moode 7.1 already has a full build environment, so we only need a limited set of additional packages to build this. The instructions for each package assume starting from the same root directory (in this case, the default home directory, /home/pi). This can all be done through the built-in ssh access terminal found in the System settings page. Dependencies Let’s start with dependencies, including libraries for AAC, AptX, and LDAC support. The prerequesites to build bluez-alsa with these codecs supported are summarized below:
Build FDK-AAC Documentation for this library is very limited, but this should work. Code: # download the current code Build openaptx Documentation on this is slightly better, but still pretty light. The default configuration in the instructions depends on sndfile, so we’ll install the system version and headers first. Code: # install libsndfile and development headers Now we can download and compile the openaptx code. I had success using FFMPEG and less success using the ENABLE_APTX422 and APTXHD1000 switches. Code: # download the current code Build LDAC library The third codec we compile is for LDAC support. I believe this enables Moode to output LDAC (and I have confirmed that works), but not to receive it. This may be a Sony licensing issue, but I am not certain. Code: # download the current code Build BlueZ-ALSA These commands area adapted from the moode builder scripts, with flags for the additional codecs we just compiled enabled. Additional documentation can be found on the main BlueZ-ALSA page and the instructions for installing from source. This needs to be compiled only after successful installation of the other codecs. Code: # download the current code That should take care of everything. Just in case I recommend a reboot. Additional codecs should now work, with no change to basic usage from the stock installation. Test We’ll do a basic test, asking the system which codecs are available. Code: # get general information So the a2dp source (player to bluetooth headphones or speakers) and sink (receiver from phone or computer) functions have aptx-HD, aptx, AAC, and SBC support. Additionally, the source function has LDAC support. Receiver Test Let’s connect an iPhone and test output. We use the standard BlueZ audio configuration settings in Moode for bluetooth receiver function: - Bluetooth: On - Pairing Agent: On Pair the iPhone as usual, and let’s use Apple Music to play a track. We see the system is using AAC now. Code: $ bluealsa-aplay -L Let’s do the same but on an older Android tablet. Pairing and playing music we see it’s using aptX now. I see the same result playing from a Windows 10 laptop. Code: $ bluealsa-aplay -L Player Test So that was input. We’ll connect Moode output to an inexpensive set of bluetooth headphones (don’t forget to change MPD Output to Bluetooth on the BlueZ configuration page). For some reason MPD defaults to 0 volume, so you’ll need to turn that up too. So we’re connected using aptX again. Let’s try LDAC next. Code: $ bluealsa-aplay -L Let’s try LDAC next. I don’t have any headphones with LDAC support, but I can connect my Sony Walkman and use that as a receiver. And we see (and hear) LDAC working. Code: $ bluealsa-aplay -L Usage Usage is the same as with a stock installation of Moode 7.1, the choice of protocol should be automatically negotiated by the player and receiver. And I make no guarantees about stability with this setup. RE: Adding Additional Bluetooth Codec Support to Moode 7.1 - scblock - 04-07-2021 I will note that LDAC playback appears to result in a pretty high processor load on a Raspberry Pi 3+. RE: Adding Additional Bluetooth Codec Support to Moode 7.1 - Tim Curtis - 04-07-2021 If you don't take any responsibility for the content of your "Bluetooth" post then why should it be allowed in our Forum? "It should work, but I don’t take any responsibility for broken upstream code. I rarely use Bluetooth, and this may not be reliable at all." Either make a case for it or its SPAM. RE: Adding Additional Bluetooth Codec Support to Moode 7.1 - scblock - 04-07-2021 OK then. That's a pretty negative response when I'm trying to be helpful. I think some may find this useful. I can say with confidence this works today, and should continue to work. If you want this to be more "guaranteed" I could update my instructions to use specific release versions of each library, but for projects like this using the current commit seems like a valid approach. And I don't have the hardware or resources to test overall stability or reliability in all situations. I'd be happy to try helping anyone who has a problem, but I can't make promises about code I don't control. It does work, not spam. RE: Adding Additional Bluetooth Codec Support to Moode 7.1 - Tim Curtis - 04-07-2021 You stated "I rarely use Bluetooth, and this may not be reliable at all" so I'm calling this post bogus. |