Thank you for your donation!

Solved: bitrate mismatch: airplay in, BT-W2 out
I have a pair of Sennheiser HD4.50BTNC Bluetooth headphones which have served me well. They implement the aptX codec so I found a Creative Labs BT-W2 USB-Bluetooth adapter which also implements the aptX codec. This device works automagically with moODe, as I reported 18 months ago in the FAQ and Guides section. I've enjoyed lots of good listening whether directly via the moOde/MPD renderer, or via the Spotify renderer, or via the UPnP renderer, or... 

...oh, wait, there's a fly in the ointment. This combo is incompatible with the Airplay renderer (rather, with the Shairport-sync code which implements the renderer). This was a moot issue for me until I recently started using an iPad to access the Amazon Music Service and wanting to listen using headphones instead of speakers at night.

From the Shairport-sync README (and as reflected in the bitrate choices in moODe's Spotify Airplay config):

Quote:Output frame rates of 44,100, 88,200, 176,000 or 352,000 frames per second.

while looking at the USB-W2 capabilities via alsacap

Card 1, ID `W2', name `Creative Bluetooth Audio W2'
 Device 0, ID `USB Audio', name `USB Audio', 1 subdevices (1 available)
   2 channels, sampling rate 48000..48000 Hz
   Sample formats: S16_LE
   Buffer size range from 96 to 262144
   Period size range from 48 to 131072

Practically, that 44.1KHz vs 48KHz incompatibility results in good sound continuously interrupted at a sub-second interval. The motor-boating effect is utterly unlistenable, especially with headphones.

Any suggestions for slipping in a rate conversion somewhere? Since this renderer bypasses MPD, the MPD SOX resampling capability is of no direct help, of course.

The config is like below right?

Client -> Airplay -> moOde (shairport-sync) -> USB -> Creative Labs BT-W2 -> Bluetooth AptX - > Headphones

If the BT-W2 only accepts 16/48 then try setting bit depth and rate in the Airplay Config screen.
Aye, there's the rub

[Image: Zv9YEC6.png]
Indeed no 48K.

Maybe using plughw instead of hw in the shairport-sync launch string.

Edit file /var/www/inc/playerlib.php. Then in function startSps() at line #2102 scroll down a bit to the code block below and change 'hw:' to 'plughw:'

    else {
        $device = 'hw:' . $array[0]['value'];

This should result in ALSA upsampling to 48K to match what the audio device accepts.
@Tim Curtis

I've been wrapped around my streaming file tests this afternoon, but I did get as far as checking the output from 'aplay -L', which echoed what you suggested

   Creative Bluetooth Audio W2, USB Audio
   Hardware device with all software conversions

So, I just now patched playerlib.php and rebooted.

Zip, zap, zowie, and swoosh! (That's a comment I found buried in the source-code listing of Digital Equipment's DOS-11 almost 50 years ago, and it's always stuck with me!)

The Ahmad Jamal Trio is playing sweetly from iPad/Amazon app -> Airplay -> moOde -> USB -> BT -> my headphones.

Stealing and outrageously paraphrasing a line from "Ferris Beuhler's Day Off": Tim Curtis, you're my hero.

I should prolly make that change permanent. I think Airplay is only renderer that outputs to hw directly.

Forum Jump: