<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=7730&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / Bluetooth Audio: How It Works]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=7730</link>
		<description><![CDATA[The most recent posts in Bluetooth Audio: How It Works.]]></description>
		<lastBuildDate>Thu, 15 Jan 2026 13:19:53 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: Bluetooth Audio: How It Works]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=61330#p61330</link>
			<description><![CDATA[<p>Wow.&#160; Thanks for documenting all this.</p>]]></description>
			<author><![CDATA[dummy@example.com (User479)]]></author>
			<pubDate>Thu, 15 Jan 2026 13:19:53 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=61330#p61330</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bluetooth Audio: How It Works]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=61279#p61279</link>
			<description><![CDATA[<p>To use Bluetooth audio effectively on Linux, you must understand how it works. This is not optional. Technical knowledge and genuine comprehension are prerequisites.<br />The detailed logging system of macOS provides a valuable insight into Bluetooth audio design.</p><p><strong>macOS Bluetooth Audio: Complete Annotated Console Log Guide</strong></p><p>A Step-by-Step Manual for Understanding How Bluetooth Audio Works on macOS</p><p><strong>Test Equipment</strong></p><ul><li><p><strong>Computer:</strong> MacBook Air (13-inch, 2018), Bluetooth 4.2</p></li><li><p><strong>Headphones:</strong> Bowers &amp; Wilkins Px7 S2e Bluetooth Wireless Headphones</p></li><li><p><strong>Operating System:</strong> macOS</p></li></ul><p><strong>How to Capture Bluetooth Audio Logs</strong></p><p><strong>Step 1: Disconnect Your Bluetooth Headphones</strong></p><p>Before you begin, make sure your Bluetooth headphones are <strong>disconnected</strong> from your Mac. You can do this by:</p><ul><li><p>Clicking the Bluetooth icon in the menu bar (top right corner of your screen)</p></li><li><p>Finding your headphones in the list</p></li><li><p>Clicking &quot;Disconnect&quot;</p></li></ul><p>Alternatively, turn off your headphones completely.</p><p><strong>Step 2: Open the Console Application</strong></p><p>The Console app is macOS&#039;s built-in log viewer. It shows you what&#039;s happening inside your system in real-time.<br /><strong>Method 1 - Using Terminal:</strong></p><ol class="decimal"><li><p>Open Terminal (Applications → Utilities → Terminal)</p></li><li><p>Type the following command and press ENTER:</p></li></ol><div class="codebox"><pre><code>   open -a Console.app</code></pre></div><p><strong>Method 2 - Using Finder:</strong></p><ol class="decimal"><li><p>Open Finder</p></li><li><p>Go to Applications → Utilities</p></li><li><p>Double-click &quot;Console&quot;</p></li></ol><p><strong>Method 3 - Using Spotlight:</strong></p><ol class="decimal"><li><p>Press Command (⌘) + Space</p></li><li><p>Type &quot;Console&quot;</p></li><li><p>Press ENTER</p></li></ol><p><strong>Step 3: Configure the Search Filter</strong></p><p>When Console opens, the window will be empty (streaming has not started yet).</p><ol class="decimal"><li><p>Locate the search bar: Look at the top-right corner of the Console window. You&#039;ll see a search field.</p></li><li><p>Type &quot;codec&quot; into the search bar and press ENTER.</p></li><li><p>Change the filter type: To the left of the word &quot;codec&quot; in the search bar, a dropdown menu will appear. Click it and select &quot;Message&quot; from the list. This tells Console to search only in the message content, not in the entire log entry.</p></li></ol><p><strong>Step 4: Start Streaming Logs</strong></p><p>In the <strong>center</strong> of the Console window toolbar, you&#039;ll see a button that says <strong>&quot;Start streaming&quot;</strong> (or it might show a play icon ▶). Click this button to begin capturing logs in real-time.<br />The Console is now watching for any system messages that contain the word &quot;codec&quot;.</p><p><strong>Step 5: Connect Your Bluetooth Headphones</strong></p><p>Now, while Console is streaming logs:</p><ol class="decimal"><li><p>Turn on your Bluetooth headphones (or click the Bluetooth menu bar icon and select your headphones to connect)</p></li><li><p>Wait a few seconds for the connection to complete</p></li></ol><p>You should see log messages appearing in the Console window immediately. These messages show the entire Bluetooth audio negotiation process happening in real-time.</p><p><strong>Step 6: Review the Captured Logs</strong></p><p>The Console will display several log entries showing how macOS and your headphones negotiate the Bluetooth audio connection. Below is an example log with detailed explanations.</p><p><strong>The Log: Line-by-Line Explanation</strong></p><p><strong>1. Device Capability Check (48 kHz Support)</strong></p><div class="codebox"><pre><code>default    21:33:05.750639+0100    bluetoothd    Bad48KHzCodecs: Disabling 48 KHz - Device is NOT in 48 KHz AAC allowlist</code></pre></div><p><strong>What&#039;s happening:</strong> macOS maintains an internal list of Bluetooth devices that have been tested and verified to work properly with 48 kHz audio. The Bowers &amp; Wilkins Px7 S2e is <strong>not on this allowlist</strong>. Even if the headphones claim they support 48 kHz, macOS won&#039;t use it. This is a protective measure against devices with buggy 48 kHz implementations that could cause audio problems.<br /><strong>Result:</strong> Audio will be limited to <strong>44.1 kHz</strong> (CD quality) instead of 48 kHz.</p><p><strong>2. HFP (Hands-Free Profile) Setup - Voice Calls</strong></p><div class="codebox"><pre><code>default    21:33:06.121260+0100    bluetoothd    Creating HFPAudioDevice for device EC:66:D1:BF:02:05 with codec: mSBC</code></pre></div><p><strong>What&#039;s happening:</strong> While setting up music playback (A2DP profile), macOS simultaneously configures the <strong>Hands-Free Profile (HFP)</strong> for phone calls, Siri, and voice communication. <br /><strong>Technical details:</strong></p><ul><li><p><strong>Device MAC address:</strong> <strong>[font=Courier New]EC:66:D1:BF:02:05[/font]</strong> (unique identifier for these headphones)</p></li><li><p><strong>Voice codec:</strong> <strong>mSBC</strong> (modified Sub-Band Codec) - provides wideband speech at 16 kHz for better call quality than older 8 kHz narrowband codecs</p></li></ul><p><strong>Note:</strong> This is separate from music quality. Voice calls and music use different Bluetooth profiles and codecs.</p><p><strong>3. Voice Codec Parsing (HFP Capabilities)</strong></p><div class="codebox"><pre><code>default    21:33:06.143723+0100    coreaudiod    ParseSWCodecs uwbsMono 0, uwbsStereo 0, swbMono 0, swbStereo 0, swbStereoFake 0, mStereoSupported 0</code></pre></div><p><strong>What&#039;s happening:</strong> Core Audio (macOS&#039;s audio system) is checking which advanced voice codecs the headphones support. Each &quot;0&quot; means &quot;not supported&quot;, &quot;1&quot; would mean &quot;supported&quot;.<br /><strong>Codec breakdown:</strong></p><ul><li><p><strong>uwbsMono/uwbsStereo</strong> = Ultra-wideband speech (mono/stereo): <strong>Not supported (0)</strong></p></li><li><p><strong>swbMono/swbStereo</strong> = Super-wideband speech: <strong>Not supported (0)</strong></p></li><li><p><strong>swbStereoFake</strong> = Fake stereo super-wideband: <strong>Not supported (0)</strong></p></li><li><p><strong>mStereoSupported</strong> = Stereo voice calls: <strong>Not supported (0)</strong></p></li></ul><p><strong>Translation:</strong> These headphones only support basic mono voice codecs, not the advanced high-quality or stereo voice features.</p><p><strong>4. Available Voice Codecs Summary</strong></p><div class="codebox"><pre><code>default    21:33:06.145067+0100    coreaudiod    Codecs available. NBS (CVSD): 1, WBS (mSBC): 1, UWBS (AAC-ELD): 0, mSWB:0, Stereo: 0</code></pre></div><p><strong>What&#039;s happening:</strong> macOS summarizes which voice call codecs are available:</p><ul><li><p><strong>NBS (CVSD)</strong> = Narrowband Speech: <strong>Supported (1)</strong> - Basic 8 kHz voice quality (sounds like an old phone)</p></li><li><p><strong>WBS (mSBC)</strong> = Wideband Speech: <strong>Supported (1)</strong> - Better 16 kHz voice quality (sounds clearer, like modern mobile phones)</p></li><li><p><strong>UWBS (AAC-ELD)</strong> = Ultra-wideband Speech: <strong>Not supported (0)</strong> - Premium AAC-based voice codec</p></li><li><p><strong>mSWB</strong> = Modified super-wideband: <strong>Not supported (0)</strong></p></li><li><p><strong>Stereo</strong> voice: <strong>Not supported (0)</strong></p></li></ul><p><strong>For calls:</strong> macOS will use <strong>mSBC</strong> (wideband) for decent call quality.</p><p><strong>5-8. Codec Discovery (A2DP Music Profile)</strong></p><div class="codebox"><pre><code>default    21:33:10.270226+0100    bluetoothd    Audio Codec ID VENDOR-SPECIFIC for remote SEID 9
error    21:33:10.471543+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
default    21:33:10.471637+0100    bluetoothd    Audio Codec ID VENDOR-SPECIFIC for remote SEID 7
error    21:33:10.607426+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
default    21:33:10.607626+0100    bluetoothd    Audio Codec ID VENDOR-SPECIFIC for remote SEID 5
default    21:33:10.743925+0100    bluetoothd    Audio Codec ID MPEG-2,4 AAC for remote SEID 3
default    21:33:10.880295+0100    bluetoothd    Audio Codec ID SBC for remote SEID 1</code></pre></div><p><strong>What&#039;s happening:</strong> macOS is asking the headphones: &quot;What music codecs do you support?&quot; The headphones respond with a list of available codecs. Each codec has a <strong>SEID</strong> (Stream Endpoint ID) - think of it as a numbered slot.<br /><strong>The headphones advertise 5 codec endpoints:</strong></p><ul><li><p><strong>SEID 9, 7, 5:</strong> Vendor-specific codecs (likely proprietary Bowers &amp; Wilkins audio processing features)<br />&#160; </p><ul><li><p><strong>Error messages:</strong> These vendor codecs don&#039;t follow Apple&#039;s expected format correctly, so macOS rejects them as incompatible</p></li></ul></li><li><p><strong>SEID 3:</strong> <strong>AAC (MPEG-2,4 AAC)</strong> - Apple&#039;s preferred high-quality music codec ✓</p></li><li><p><strong>SEID 1:</strong> <strong>SBC</strong> (Sub-Band Codec) - The mandatory baseline codec that all Bluetooth audio devices must support ✓</p></li></ul><p><strong>Result:</strong> Two usable music codecs: AAC and SBC. macOS will prefer AAC.</p><p><strong>9-10. Codec Selection</strong></p><div class="codebox"><pre><code>default    21:33:10.880630+0100    bluetoothd    Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 5 available endpoints
default    21:33:10.880740+0100    bluetoothd    Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 5 available endpoints</code></pre></div><p><strong>What&#039;s happening:</strong> macOS chooses <strong>AAC</strong> (codec ID 0x2) as the preferred codec from the 5 available endpoints. <br /><strong>Why twice?</strong> This message appears twice, likely confirming the selection for both audio channels or for redundancy.<br /><strong>Why AAC?</strong> On macOS, AAC is always preferred over SBC when available because it provides significantly better sound quality at the same bitrate.</p><p><strong>11-12. Vendor Codec Rejection (Confirmation)</strong></p><div class="codebox"><pre><code>error    21:33:10.880817+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
error    21:33:10.880892+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec</code></pre></div><p><strong>What&#039;s happening:</strong> macOS confirms it&#039;s rejecting the malformed vendor-specific codecs from the headphones. These errors are harmless - they just mean the proprietary Bowers &amp; Wilkins features aren&#039;t compatible with macOS&#039;s expectations.</p><p><strong>13. A2DP Stream Configuration (The Main Event!)</strong></p><div class="codebox"><pre><code>default    21:33:11.467514+0100    bluetoothd    A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 244 kbps. 1 frames * (12+709) bytes = 721 per RTP (max=879) every 23.22 ms</code></pre></div><p><strong>What&#039;s happening:</strong> This is the <strong>most important line</strong> - it shows the final negotiated Bluetooth music stream configuration.<br /><strong>Breaking it down:</strong></p><ul><li><p><strong>A2DP configured at 44.1 KHz:</strong> Sample rate is <strong>44.1 kHz</strong> (CD quality)<br />&#160; </p><ul><li><p>Remember: 48 kHz was disabled earlier because this device isn&#039;t on the allowlist</p></li></ul></li><li><p><strong>Codec: AAC-LC:</strong> Using <strong>AAC Low Complexity</strong> profile (the standard AAC variant)</p></li><li><p><strong>VBR max: 244 kbps:</strong> Variable Bit Rate with a maximum of 244 kilobits per second<br />&#160; </p><ul><li><p><em>Note: Later logs reveal the actual encoding uses 192 kbps CBR (Constant Bit Rate), so this is just the negotiated maximum ceiling</em></p></li></ul></li><li><p><strong>Frame structure:</strong><br />&#160; </p><ul><li><p><strong>1 frame</strong> per RTP packet (RTP = Real-time Transport Protocol, the Bluetooth streaming format)</p></li><li><p><strong>12 bytes</strong> = RTP header overhead</p></li><li><p><strong>709 bytes</strong> = AAC-encoded audio data</p></li><li><p><strong>721 total bytes</strong> per packet (12 + 709)</p></li><li><p><strong>Maximum packet size: 879 bytes</strong> (extra headroom for variable bitrate bursts)</p></li></ul></li><li><p><strong>Timing: every 23.22 ms</strong><br />&#160; </p><ul><li><p>Each packet contains <strong>1024 audio samples</strong></p></li><li><p>Calculation: 1024 samples ÷ 44,100 samples/second = 0.02322 seconds = <strong>23.22 milliseconds</strong></p></li></ul></li></ul><p><strong>Translation for non-technical users:</strong> Every 23.22 milliseconds (roughly 43 times per second), your Mac sends a small packet of compressed AAC audio data (721 bytes) over Bluetooth to your headphones.</p><p><strong>14-18. AAC Encoder Negotiation (Finding the Perfect Settings)</strong></p><div class="codebox"><pre><code>default    21:33:11.486010+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 64, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0</code></pre></div><p><strong>What&#039;s happening:</strong> Core Audio doesn&#039;t just blindly use any AAC settings. It intelligently <strong>tests multiple encoder configurations</strong> to find the optimal balance between quality, latency, and Bluetooth packet size. Think of this as macOS trying on different &quot;outfits&quot; to see which fits best.<br /><strong>Test 1 - High Quality CBR:</strong></p><ul><li><p><strong>srIn/srOut = 44100:</strong> Input and output sample rate both 44.1 kHz (no resampling needed - bit-perfect!)</p></li><li><p><strong>chans = 2:</strong> Stereo (2 channels)</p></li><li><p><strong>bitRateFormat = 1:</strong> CBR (Constant Bit Rate)</p></li><li><p><strong>bitrate = 128000:</strong> 128 kbps (kilobits per second)</p></li><li><p><strong>quality (complexity) = 64:</strong> High CPU complexity for better encoding quality (0-127 scale)</p></li><li><p><strong>VBRQ = -1:</strong> VBR Quality setting not used (because this is CBR mode)</p></li><li><p><strong>speechOptimization = 0:</strong> Disabled (music-optimized encoding, not voice-optimized)</p></li><li><p><strong>packetSizeLimit = 0:</strong> No packet size limit in this test</p></li><li><p><strong>packetBitSizeMin = 0:</strong> No minimum packet size</p></li><li><p><strong>mMaxPacketSize = 1536 bytes:</strong> Maximum 1536 bytes per packet</p></li><li><p><strong>mCodecDelay = 2112:</strong> Encoder latency is 2112 samples<br />&#160; </p><ul><li><p>Calculation: 2112 ÷ 44,100 = <strong>47.89 milliseconds</strong> of encoding delay</p></li></ul></li><li><p><strong>drcConfiguration = 0:</strong> Dynamic Range Compression disabled</p></li></ul><div class="codebox"><pre><code>default    21:33:11.490819+0100    coreaudiod      ... bitRateFormat = 1, bitrate = 128000, quality (complexity) = 32 ...</code></pre></div><p><strong>Test 2 - Medium Quality CBR:</strong></p><ul><li><p>Same as Test 1, but <strong>complexity reduced to 32</strong> (medium)</p></li><li><p>Lower complexity = faster encoding, uses less CPU, slightly lower quality</p></li></ul><div class="codebox"><pre><code>default    21:33:11.492162+0100    coreaudiod      ... bitRateFormat = 3, bitrate = 128000, quality (complexity) = 32 ...</code></pre></div><p><strong>Test 3 - VBR Mode:</strong></p><ul><li><p><strong>bitRateFormat = 3:</strong> VBR (Variable Bit Rate) - bitrate can fluctuate for better efficiency</p></li><li><p><strong>128 kbps average</strong></p></li><li><p><strong>Complexity 32</strong> (medium)</p></li></ul><div class="codebox"><pre><code>default    21:33:11.493346+0100    coreaudiod      ... bitRateFormat = 3, bitrate = 128000, quality (complexity) = 32, VBRQ = -1, ... packetBitSizeMin = 256 (bits) ...</code></pre></div><p><strong>Test 4 - VBR with Minimum Packet Constraint:</strong></p><ul><li><p>VBR mode with <strong>minimum packet size = 256 bits</strong> (32 bytes)</p></li><li><p>This ensures packets aren&#039;t too small, which could waste Bluetooth transmission efficiency</p></li></ul><div class="codebox"><pre><code>default    21:33:11.494194+0100    coreaudiod      ... bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, ... packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits) ...</code></pre></div><p><strong>Test 5 - THIS IS THE WINNER! ✓</strong></p><ul><li><p><strong>bitRateFormat = 3:</strong> VBR (Variable Bit Rate)</p></li><li><p><strong>bitrate = 192000:</strong> <strong>192 kbps</strong> average (significantly higher than the 128 kbps tests)</p></li><li><p><strong>quality (complexity) = 32:</strong> Balanced CPU usage</p></li><li><p><strong>packetSizeLimit = 5672 bits:</strong> Maximum 709 bytes per packet (5672 ÷ 8 = 709)<br />&#160; </p><ul><li><p><strong>This matches exactly</strong> the &quot;709 bytes&quot; we saw in the bluetoothd configuration!</p></li></ul></li><li><p><strong>packetBitSizeMin = 256 bits:</strong> Minimum 32 bytes per packet</p></li></ul><p><strong>Why this configuration won:</strong></p><ul><li><p>Higher bitrate (192 kbps) = better sound quality</p></li><li><p>VBR mode = efficient use of bandwidth (complex music passages get more bits, simple passages use fewer)</p></li><li><p>Packet size (256-5672 bits) perfectly fits the Bluetooth MTU (Maximum Transmission Unit)</p></li><li><p>Complexity 32 = good quality without excessive CPU usage</p></li></ul><p><strong>19-23. Encoder Reconfiguration Events</strong></p><div class="codebox"><pre><code>default    21:35:26.865271+0100    coreaudiod      ... (same 192 kbps VBR config)
default    21:37:35.865684+0100    coreaudiod      ... (same 192 kbps VBR config)
default    21:37:43.660216+0100    coreaudiod      ... (same 192 kbps VBR config)
default    21:38:10.692347+0100    coreaudiod      ... (same 192 kbps VBR config)
default    21:38:12.218420+0100    coreaudiod      ... (same 192 kbps VBR config)
default    21:40:55.879479+0100    coreaudiod      ... (same 192 kbps VBR config)</code></pre></div><p><strong>What&#039;s happening:</strong> These log entries show the AAC encoder being <strong>reinitialized</strong> with the same proven configuration (192 kbps VBR, complexity 32).<br /><strong>When does this happen?</strong></p><ul><li><p>You start or stop music playback</p></li><li><p>You switch between different audio apps (Spotify → Apple Music → YouTube)</p></li><li><p>System audio routing changes</p></li><li><p>Headphones briefly disconnect and reconnect</p></li><li><p>macOS adjusts audio priorities</p></li></ul><p>Each time, macOS reinitializes the encoder with the same optimal settings it discovered during the initial tests.</p><p><strong>Technical Configuration</strong></p><div class="codebox"><pre><code>| Parameter          | Value        | Explanation                                    |
| ------------------ | ------------ | ---------------------------------------------- |
| Sample Rate        | 44.1 kHz     | CD quality; 48 kHz disabled (not on allowlist) |
| Codec              | AAC-LC       | Advanced Audio Coding - Low Complexity         |
| Bitrate            | 192 kbps CBR | Actually constant despite VBR negotiation      |
| Encoder Complexity | 32 (medium)  | Balanced CPU vs. quality                       |
| Frame Size         | 1024 samples | 23.22 ms per frame                             |
| Packet Size        | 721 bytes    | 12-byte header + 709-byte AAC data             |
| Codec Delay        | 2112 samples | ~48 ms encoder latency                         |</code></pre></div><p><strong>The Process macOS Follows</strong></p><ol class="decimal"><li><p><strong>Check device allowlist</strong> → Disable 48 kHz (device not approved)</p></li><li><p><strong>Set up voice profile (HFP)</strong> → Use mSBC for calls</p></li><li><p><strong>Discover available codecs</strong> → Find AAC and SBC</p></li><li><p><strong>Select preferred codec</strong> → Choose AAC over SBC</p></li><li><p><strong>Negotiate stream parameters</strong> → 44.1 kHz, VBR max 244 kbps</p></li><li><p><strong>Test encoder configurations</strong> → Try 5 different settings</p></li><li><p><strong>Select optimal configuration</strong> → 192 kbps VBR, complexity 32</p></li><li><p><strong>Stream audio</strong> → Send 721-byte packets every 23.22 ms</p></li></ol><p><strong>A Note on Sound Quality</strong></p><p>It may be worth noting that, when using the same Bluetooth headphones, the sound quality on macOS is rather better than on Linux. Not enormously so, you understand, but one might say the difference is... perceptible to the discerning ear.<br />Both systems use AAC encoding over Bluetooth, both operate at 44.1 kHz, and both follow broadly similar technical processes. Yet the macOS implementation does seem to possess a certain refinement in its execution - perhaps in the encoder&#039;s architectural elegance, or in the rather more sophisticated manner in which Core Audio handles the signal path.<br />It&#039;s rather like comparing motorcars, really. A Toyota and a Rolls-Royce both have four wheels, an engine, and a steering wheel. Both will convey you from point A to point B. The fundamental principles are identical. Yet one wouldn&#039;t claim the experience is quite the same, would one?<br />The quality, as they say, is in the details of the realisation.</p><p><strong>On Linux with BlueALSA:</strong></p><ul><li><p>You <strong>cannot force</strong> 320 kbps VBR or CBR - the bitrate is <strong>negotiated</strong> between the system and the headphones</p></li><li><p>Getting detailed logs like these requires modifying the BlueALSA source code with debug statements and recompiling the daemon</p></li><li><p>Both 44.1 kHz and 48 kHz are typically available (no allowlist restrictions)</p></li><li><p>You can request the AAC &quot;afterburner&quot; mode for maximum encoder quality using the <strong>[font=Courier New]--aac-afterburner[/font]</strong> flag</p></li></ul><p><strong>On macOS:</strong></p><ul><li><p>Logging is built-in via Console.app - no compilation required</p></li><li><p>The system automatically tests and selects optimal encoder settings</p></li><li><p>Device allowlists protect against buggy hardware implementations</p></li><li><p>The Core Audio architecture provides a cleaner signal path</p></li></ul><p><em>This guide was created by capturing real Bluetooth connection logs and analyzing the internal behavior of macOS&#039;s Bluetooth audio stack.</em></p><div class="codebox"><pre><code>default    21:33:05.750639+0100    bluetoothd    Bad48KHzCodecs: Disabling 48 KHz - Device is NOT in 48 KHz AAC allowlist
default    21:33:06.121260+0100    bluetoothd    Creating HFPAudioDevice for device EC:66:D1:BF:02:05 with codec: mSBC
default    21:33:06.143723+0100    coreaudiod    ParseSWCodecs uwbsMono 0, uwbsStereo 0, swbMono 0, swbStereo 0, swbStereoFake 0, mStereoSupported 0
default    21:33:06.145067+0100    coreaudiod    Codecs available. NBS (CVSD): 1, WBS (mSBC): 1, UWBS (AAC-ELD): 0, mSWB:0, Stereo: 0
default    21:33:10.270226+0100    bluetoothd    Audio Codec ID VENDOR-SPECIFIC for remote SEID 9
error    21:33:10.471543+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
default    21:33:10.471637+0100    bluetoothd    Audio Codec ID VENDOR-SPECIFIC for remote SEID 7
error    21:33:10.607426+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
default    21:33:10.607626+0100    bluetoothd    Audio Codec ID VENDOR-SPECIFIC for remote SEID 5
default    21:33:10.743925+0100    bluetoothd    Audio Codec ID MPEG-2,4 AAC for remote SEID 3
default    21:33:10.880295+0100    bluetoothd    Audio Codec ID SBC for remote SEID 1
default    21:33:10.880630+0100    bluetoothd    Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 5 available endpoints
default    21:33:10.880740+0100    bluetoothd    Selected preferred codec AVDTP_CODEC_MPEG_AAC (0x2) out of 5 available endpoints
error    21:33:10.880817+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
error    21:33:10.880892+0100    bluetoothd    Length of AVDTP Codec Info is too short for Apple Vendor-Specific Codec
default    21:33:11.467514+0100    bluetoothd    A2DP configured at 44.1 KHz. Codec: AAC-LC, VBR max: 244 kbps. 1 frames * (12+709) bytes = 721 per RTP (max=879) every 23.22 ms
default    21:33:11.486010+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 64, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:33:11.490819+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 1, bitrate = 128000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:33:11.492162+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 128000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 0 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:33:11.493346+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 128000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 0 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:33:11.494194+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:35:26.865271+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0

default    21:37:35.865684+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:37:43.660216+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:38:10.692347+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:38:12.218420+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0
default    21:40:55.879479+0100    coreaudiod      ACMP4AACBaseEncoder.cpp:692   (0x7fb47f97dc40) @@@@ &#039;aac &#039; encoder configuration: srIn = 44100, srOut = 44100, chans = 2, bitRateFormat = 3, bitrate = 192000, quality (complexity) = 32, VBRQ = -1, speechOptimization = 0, packetSizeLimit = 5672 (bits), packetBitSizeMin = 256 (bits), mMaxPacketSize = 1536 (bytes), userBandwidth = 0, delayMode = 0, mCodecDelay = 2112, drcConfiguration = 0, mPrePostFillMask = 0x0</code></pre></div><p>An amusing discovery emerged during this research: both the Bowers &amp; Wilkins Px7 S2e and Sennheiser HD 450BT work perfectly well on macOS—they connect, they play audio, users remain blissfully unaware of any limitation. Yet according to macOS&#039;s own logs, these devices are <em>not supported</em>. They are excluded from the 48 kHz AAC allowlist, relegated to 44.1 kHz like common peasants.<br />Which headphones, then, enjoy this privilege? The answer is as predictable as it is illuminating: <strong>Beats</strong>.<br />Apple acquired Beats Electronics for $3 billion in 2014. Since then, Beats headphones have shipped with Apple&#039;s proprietary wireless chips—the W1, H1, and now H2. These chips are not merely Bluetooth transceivers; they are <strong>trusted devices</strong> in the macOS ecosystem.<br />Headphones with H1/W1/H2 chips receive preferential treatment from <em><strong>bluetoothd</strong></em>:</p><ul><li><p><strong>48 kHz AAC support</strong> (others are capped at 44.1 kHz)</p></li><li><p>Likely higher bitrates than standard AAC-LC</p></li><li><p>Optimized audio pipeline routing</p></li><li><p>Possibly lower latency</p></li></ul><p>The chips almost certainly maintain persistent encrypted connections, use custom pairing protocols beyond standard Bluetooth, and report extended capabilities that trigger allowlist matching against hardcoded device IDs.</p><p><strong>Apple&#039;s Rationale</strong></p><ol class="decimal"><li><p><strong>Quality Control</strong> – They know their chips handle 48 kHz reliably</p></li><li><p><strong>Battery &amp; Stability</strong> – Guaranteed experience without edge-case failures</p></li><li><p><strong>Product Differentiation</strong> – A tangible reason to buy within the ecosystem</p></li><li><p><strong>Ecosystem Lock-in</strong> – Yet another thread in the web</p></li></ol><p>The goal is transparent: the best Bluetooth audio quality on macOS shall be delivered by Beats headphones and AirPods. The Apple audio engineers are perfectly capable of implementing this. They have simply chosen to do so exclusively for their own products.<br />The so-called &quot;Bluetooth audiophiles&quot; often insist that Beats are inferior to Sennheiser, Bowers &amp; Wilkins, and their ilk. One might safely disregard such opinions with the same confidence one dismisses the pronouncements of fast food connoisseurs on any cuisine.</p><p><strong>Summary</strong></p><p>On macOS, you are graciously <em>invited</em> to remain within the Apple ecosystem—that is, to consume Apple products exclusively for optimal functionality.<br />On Linux, you are similarly <em>encouraged</em> to remain within the Linux ecosystem—that is, to use systemd, PulseAudio, PipeWire, ALSA, and whichever resampler happens to be fashionable this quarter, whether you like them or not.<br />The difference, modest though it may be, is this: <strong>on Linux, it remains possible to remove systemd, PulseAudio, and PipeWire, and enjoy the true freedom</strong>—the freedom to trust your senses and your ability to think, to understand and to solve problems.</p>]]></description>
			<author><![CDATA[dummy@example.com (igorzwx)]]></author>
			<pubDate>Mon, 12 Jan 2026 02:46:07 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=61279#p61279</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bluetooth Audio: How It Works]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=61240#p61240</link>
			<description><![CDATA[<p><strong>BlueALSA Configuration</strong></p><p>BlueALSA is already configured and ready to use. The ALSA configuration file for BlueALSA is located at:</p><div class="codebox"><pre><code>/usr/share/alsa/alsa.conf.d/20-bluealsa.conf  </code></pre></div><div class="codebox"><pre><code>$ dpkg -S /usr/share/alsa/alsa.conf.d/20-bluealsa.conf
bluez-alsa:amd64: /usr/share/alsa/alsa.conf.d/20-bluealsa.conf</code></pre></div><p>This file contains optimal default settings that work for most users. These have been carefully selected to deliver the best performance. As audio quality is not a primary concern for Linux developers, you may wish to adjust some of the default settings.</p><p><strong>What&#039;s Already Configured</strong></p><p>The system already defines:</p><ul><li><p><span class="bbc">pcm.bluealsa</span> - The main Bluetooth audio device.</p></li><li><p><span class="bbc">ctl.bluealsa</span> - Mixer controls for Bluetooth devices.</p></li></ul><p>Note that <span class="bbc">pcm.bluealsa</span> is a virtual PCM device, not a full virtual sound card. As such, it does not support direct use of ALSA plugins like <span class="bbc">dmix</span>, <span class="bbc">dsnoop</span>, or <span class="bbc">asym</span> to enable software mixing or concurrent access. BlueALSA PCM devices are designed for direct Bluetooth audio streaming and lack built-in multi-client capabilities — only one application can use the PCM at a time.</p><p><strong>Optimal Configuration for AAC codec</strong></p><p>Here is the complete optimal configuration for AAC codec. Put this in <span class="bbc">~/.asoundrc</span>:</p><div class="codebox"><pre><code># File: ~/.asoundrc  
defaults.pcm.rate_converter &quot;fftrate&quot;  
defaults.bluealsa.ctl.extended &quot;yes&quot;
defaults.bluealsa.softvol &quot;off&quot;  
defaults.bluealsa.codec &quot;aac&quot;   
pcm.!default &quot;bluealsa&quot;</code></pre></div><p><strong>What These Settings Do</strong></p><ul><li><p><span class="bbc">defaults.pcm.rate_converter &quot;fftrate&quot;</span> - Uses high-quality sample rate conversion</p></li><li><p><span class="bbc">defaults.bluealsa.ctl.extended &quot;yes&quot;</span> - Shows which codec is actually being used</p></li><li><p><span class="bbc">defaults.bluealsa.codec &quot;aac&quot;</span> - Forces AAC codec for best quality</p></li><li><p><span class="bbc">pcm.!default &quot;bluealsa&quot;</span> - Makes Bluetooth audio the system default</p></li></ul><p>If you open <span class="bbc">alsamixer</span> for the BlueALSA virtual PCM device:</p><div class="codebox"><pre><code>alsamixer -D bluealsa</code></pre></div><p>you will see codec controls like:</p><ul><li><p><strong>AAC Codec Enum</strong> - Shows the currently selected AAC codec</p></li><li><p><strong>Volume Mode</strong> - Switch between &quot;pass-through&quot; and &quot;software&quot;</p></li><li><p><strong>Sync</strong> - Client delay adjustment</p></li><li><p><strong>Battery</strong> - Device battery level (if supported)</p></li></ul><p>The codec control lets you verify your <span class="bbc">defaults.bluealsa.codec &quot;aac&quot;</span> setting is working<br />The following default settings work well and don&#039;t need to be changed:</p><ul><li><p>Volume mode: <span class="bbc">&#039;pass-through&#039;</span> (uses device&#039;s native volume control)</p></li><li><p>Delay: <span class="bbc">+0 ms</span> (no extra delay added)</p></li></ul><p>These settings are already optimal for most users.</p><p><strong>Important</strong>: Do not load aptX or aptX-HD codecs in <span class="bbc">bluealsad</span>, if you intend to use the AAC codec exclusively. <br />This ensures only AAC (and mandatory SBC) codecs are available for <span class="bbc">a2dp</span> playback, as <strong>SBC codec cannot be disabled</strong> — it is required by the A2DP specification and is always enabled by default in BlueALSA.<br />To run <span class="bbc">bluealsad</span> from the terminal, use:</p><div class="codebox"><pre><code>sudo -u bluealsad bluealsad -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c -sbc -c aac -c msbc --aac-afterburner --aac-bitrate=320000 --aac-vbr --aac-true-bps  </code></pre></div><p> In the init script <span class="bbc">/etc/init.d/bluealsad</span>, configure the options accordingly:</p><div class="codebox"><pre><code>BA_OPTS=&quot;-S -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c -sbc -c aac -c msbc --aac-afterburner --aac-bitrate=320000 --aac-vbr --aac-true-bps&quot;</code></pre></div><p>This configuration avoids codec conflicts and ensures reliable AAC usage.</p><p><strong>How BlueALSA Handles Sample Rates (Bit Perfect)</strong></p><p>BlueALSA does not perform resampling. When sample rate conversion is required (e.g., from DXD to 48 kHz), it is handled by ALSA using the configured resampler — such as <span class="bbc">fftrate</span>:</p><div class="codebox"><pre><code>$ cat ~/.asoundrc | grep rate
defaults.pcm.rate_converter &quot;fftrate&quot;</code></pre></div><p>Since the AAC codec supports both 44.1 kHz and 48 kHz, no resampling is needed, and BlueALSA preserves the original sample rate — a concept often referred to as &quot;bit perfect&quot; in macOS contexts. The default BlueALSA configuration avoids unnecessary audio processing that could degrade sound quality.<br />When your audio player changes sample rates (e.g., from 48 kHz to 44.1 kHz), BlueALSA automatically renegotiates the connection with the Bluetooth device to match the new rate.</p><p><strong>How to configure media applications</strong></p><p>Note that it is generally <strong>not possible to disable resampling in Chromium-based browsers</strong>.</p><p><strong>MPV Player</strong> </p><div class="codebox"><pre><code>$ cat ~/.config/mpv/mpv.conf
ao=alsa
alsa-resample=yes
alsa-buffer-time=160000
alsa-periods=4</code></pre></div><p><strong>Celluloid:</strong></p><ul><li><p>Open the Preferences menu.</p></li><li><p>Go to the Miscellaneous tab.</p></li><li><p>Enter mpv command-line options into the &quot;Extra MPV Options&quot; text box:</p></li></ul><div class="codebox"><pre><code>ao=alsa alsa-resample=yes alsa-buffer-time=160000 alsa-periods=4</code></pre></div><p><strong>Audacious:</strong></p><ul><li><p>go to Preferences → Audio → Buffer size</p></li><li><p>set 2000 ms</p></li></ul><p><strong>aplay and arecord</strong></p><div class="codebox"><pre><code>aplay -F 40000 -B 160000 input.wav
arecord -F 40000 -B 160000  -V mono -f CD output.wav</code></pre></div><p><strong>Firefox</strong><br /><span class="bbc">about:config</span></p><div class="codebox"><pre><code>media.mediasource.webm.enabled                false
media.cubeb.backend                           alsa
media.resampling.enabled                      false
media.cubeb_latency_playback_ms               160</code></pre></div><p><strong>Configuration Editor for Firefox</strong>&#160; <br />_https://support.mozilla.org/en-US/kb/about-config-editor-firefox</p>]]></description>
			<author><![CDATA[dummy@example.com (igorzwx)]]></author>
			<pubDate>Sat, 10 Jan 2026 17:33:51 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=61240#p61240</guid>
		</item>
		<item>
			<title><![CDATA[Bluetooth Audio: How It Works]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=61169#p61169</link>
			<description><![CDATA[<p>The following is a simplified log of a BlueALSA session, with extraneous lines discreetly removed for clarity.</p><div class="codebox"><pre class="vscroll"><code># COMMAND: Start BlueALSA with AAC codec and debug logging  
sudo -u bluealsad bluealsad -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c -sbc -c aac -c msbc --aac-afterburner --aac-bitrate=320000 --aac-vbr --aac-true-bps --loglevel=debug  

# DAEMON INITIALIZATION  
bluealsad: [31361] D: log.c:701: FDK-AAC encoder capabilities: AAC=[AAC-LC AAC-SCAL DRC ] SBR=[SBR-PS ] DMX=[none]  
bluealsad: [31361] D: log.c:701: FDK-AAC decoder capabilities: AAC=[AAC-LC HE-AAC AAC-LD AAC-ELD AAC-SCAL DRC ] SBR=[SBR-HQ SBR-PS ] DMX=[2ch 6ch 8ch ]  
bluealsad: [31361] D: storage.c:86: Initializing persistent storage: /var/lib/bluealsa  
bluealsad: [31361] D: main.c:707: Starting main dispatching loop  
bluealsad: [31361] D: main.c:121: Acquired D-Bus service name: org.bluealsa  
bluealsad: [31361] D: bluealsa-dbus.c:404: Registering BlueALSA D-Bus manager: /org/bluealsa  

# AAC CODEC DISCOVERY  
bluealsad: [31361] D: bluez.c:1271: Adding new Stream End-Point: EC:66:D1:BF:02:05: SNK: AAC  
bluealsad: [31361] D: log.c:347: AAC_CODEC: AAC capabilities - Object Type=MPEG2-LC | MPEG4-LC, Sample Rate=8000 Hz | 11025 Hz | 12000 Hz | 16000 Hz | 22050 Hz | 24000 Hz | 32000 Hz | 44100 Hz | 48000 Hz, Channels=Mono | Stereo, VBR=enabled, Bitrate=320000  

# AAC CODEC NEGOTIATION  
bluealsad: [31361] D: dbus.c:43: Called: org.bluez.MediaEndpoint1.SelectConfiguration() on /org/bluez/hci0/A2DP/AAC/source/1  
bluealsad: [31361] D: bluez.c:442: BlueZ endpoint select_configuration called  
bluealsad: [31361] D: log.c:347: AAC_CODEC: _CODEC: A2DP peer capabilities - Object Type=MPEG2-LC | MPEG4-LC, Sample Rate=8000 Hz | 11025 Hz | 12000 Hz | 16000 Hz | 22050 Hz | 24000 Hz | 32000 Hz | 44100 Hz | 48000 Hz, Channels=Mono | Stereo, VBR=enabled, Bitrate=320000  
bluealsad: [31361] D: a2dp-aac.c:664: AAC configuration_select called  
bluealsad: [31361] D: dbus.c:43: Called: org.bluez.MediaEndpoint1.SetConfiguration() on /org/bluez/hci0/A2DP/AAC/source/1  
bluealsad: [31361] D: log.c:347: AAC_CODEC: A2DP selected configuration - Object Type=MPEG4-LC, Sample Rate=48000 Hz, Channels=Stereo (2), VBR=enabled, Bitrate=320000  
bluealsad: [31361] D: bluez.c:637: A2DP Source (AAC) configured for device EC:66:D1:BF:02:05  
bluealsad: [31361] D: bluez.c:640: PCM configuration: channels=2 rate=48000  
bluealsad: [31361] D: bluez.c:642: Delay reporting: unsupported  

# AUDIO STREAMING SETUP  
bluealsad: [31401] D: dbus.c:43: Called: org.bluealsa.PCM1.Open() on /org/bluealsa/hci0/dev_EC_66_D1_BF_02:05/a2dpsrc/sink  
bluealsad: [31401] D: ba-transport.c:316: New A2DP transport: 28  
bluealsad: [31401] D: ba-transport.c:317: A2DP socket MTU: 28: R:672 W:895  
bluealsad: [31361] D: ba-transport.c:1082: Starting transport: A2DP Source (AAC)  
bluealsad: [31361] D: ba-transport-pcm.c:287: Created BT socket duplicate: [28]: 29  
bluealsad: [31361] D: ba-transport-pcm.c:366: Created new IO thread [ba-a2dp-aac]: A2DP Source (AAC)  
bluealsad: [31419] D: a2dp-aac.c:332: AAC_CODEC: Encoder Info - FrameLength=1024, InputChannels=2, MaxOutBufBytes=1536, Delay=1600 samples  
bluealsad: [31419] D: a2dp-aac.c:336: AAC_CODEC: Configuration - Bitrate=320000, Afterburner=enabled, VBR=enabled, Quality=VBR  
bluealsad: [31419] D: a2dp-aac.c:391: PCM IO loop: START: a2dp_aac_enc_thread: A2DP Source (AAC) 

# AAC Frame Monitoring
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=497, Target bitrate=320000
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=496, Target bitrate=320000
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=600, Target bitrate=320000
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=469, Target bitrate=320000 </code></pre></div><p><strong>Command Line Options</strong></p><div class="codebox"><pre><code>sudo -u bluealsad bluealsad -p a2dp-source -p a2dp-sink -p hfp-ag -p hfp-hf -c -sbc -c aac -c msbc --aac-afterburner --aac-bitrate=320000 --aac-vbr --aac-true-bps --loglevel=debug</code></pre></div><ul><li><p><span class="bbc">sudo -u bluealsad</span>: Runs the daemon under a dedicated user—nothing excessive, just sound security practice.</p></li><li><p><span class="bbc">-p a2dp-source -p a2dp-sink</span>: Enables bidirectional audio. One might call it <em>thorough</em>.</p></li><li><p><span class="bbc">-p hfp-ag -p hfp-hf</span>: Supports hands-free calling. Useful, if one must.</p></li><li><p><span class="bbc">-c aac</span>: Enables the AAC codec—rather more refined than the alternatives.</p></li><li><p><span class="bbc">--aac-afterburner</span>: Activates Fraunhofer’s quality enhancement. It does its work quietly.</p></li><li><p><span class="bbc">--aac-bitrate=320000</span>: Sets a generous bitrate. One might say it leaves nothing wanting.</p></li><li><p><span class="bbc">--aac-vbr</span>: Prefers variable bit rate—efficient without being showy.</p></li><li><p><span class="bbc">--aac-true-bps</span>: Ensures accurate bit-per-second reporting. A minor detail, but a correct one.</p></li><li><p><span class="bbc">--loglevel=debug</span>: Enables verbose logging. Helpful, if one is inclined to look.</p></li></ul><p><strong>NOTE:</strong> To enable debug, you have to compile <span class="bbc">bluez-alsa</span> with <span class="bbc">--enable-debug</span>. Then you can run <span class="bbc">bluealsad</span> daemon with <span class="bbc">--loglevel=debug</span>.</p><p><strong>Security:</strong></p><div class="codebox"><pre><code>./configure --with-bluealsaduser=bluealsad       # D-Bus policy files are automatically generated with the correct user permissions</code></pre></div><p>Running BlueALSA as the <span class="bbc">bluealsad</span> user is not an indulgence—it is a matter of principle. The daemon operates with minimal privileges, should anything untoward occur.</p><ul><li><p><strong>Least Privilege</strong>: The <span class="bbc">bluealsad</span> user has no unnecessary access. One might say it knows its place.</p></li><li><p><strong>Systemd Sandboxing</strong>: Features such as <span class="bbc">ProtectSystem=strict</span> and <span class="bbc">IPAddressDeny=any</span> ensure the service remains discreet.</p></li><li><p><strong>D-Bus Policy Control</strong>: Communication is limited to <span class="bbc">org.bluealsa</span>. No eavesdropping, no surprises.</p></li><li><p><strong>Filesystem Confinement</strong>: The daemon is restricted to <span class="bbc">/var/lib/bluealsa</span>. One might call it tidy.</p></li></ul><p>This is not paranoia—it is simply good form. </p><p><strong>Daemon Startup Process</strong></p><div class="codebox"><pre><code># FDK-AAC library capabilities - what audio formats we can encode/decode  
bluealsad: [31361] D: log.c:701: FDK-AAC encoder capabilities: AAC=[AAC-LC AAC-SCAL DRC ] SBR=[SBR-PS ] DMX=[none]  
bluealsad: [31361] D: log.c:701: FDK-AAC decoder capabilities: AAC=[AAC-LC HE-AAC AAC-LD AAC-ELD AAC-SCAL DRC ] SBR=[SBR-HQ SBR-PS ] DMX=[2ch 6ch 8ch ]</code></pre></div><p><strong>EXPLANATION</strong>: BlueALSA checks what AAC formats your system supports. The encoder can handle basic AAC-LC and scalable coding, while the decoder supports advanced formats like HE-AAC for better compression.</p><div class="codebox"><pre><code># System initialization  
bluealsad: [31361] D: storage.c:86: Initializing persistent storage: /var/lib/bluealsa  
bluealsad: [31361] D: main.c:707: Starting main dispatching loop  
bluealsad: [31361] D: main.c:121: Acquired D-Bus service name: org.bluealsa  
bluealsad: [31361] D: bluealsa-dbus.c:404: Registering BlueALSA D-Bus manager: /org/bluealsa</code></pre></div><p><strong>EXPLANATION</strong>: BlueALSA starts up, creates storage for remembering device settings, and registers with the Linux D-Bus system so applications can communicate with it.</p><p><strong>AAC Codec Discovery</strong></p><div class="codebox"><pre><code># Device announces its AAC support  
bluealsad: [31361] D: bluez.c:1271: Adding new Stream End-Point: EC:66:D1:BF:02:05: SNK: AAC  
bluealsad: [31361] D: log.c:347: AAC_CODEC: AAC capabilities - Object Type=MPEG2-LC | MPEG4-LC, Sample Rate=8000 Hz | 11025 Hz | 12000 Hz | 16000 Hz | 22050 Hz | 24000 Hz | 32000 Hz | 44100 Hz | 48000 Hz, Channels=Mono | Stereo, VBR=enabled, Bitrate=320000</code></pre></div><p><strong>EXPLANATION</strong>:&#160; The Bluetooth device, that is, BT Headphones, <span class="bbc">EC:66:D1:BF:02:05</span> tells BlueALSA it supports AAC audio. It can handle many sample rates from 8kHz (voice quality) up to 48kHz (CD quality), supports mono and stereo, and can use Variable Bit Rate for efficient encoding.</p><p><strong>AAC Codec Negotiation</strong></p><div class="codebox"><pre><code># BlueZ asks BlueALSA to select the best AAC configuration  
bluealsad: [31361] D: dbus.c:43: Called: org.bluez.MediaEndpoint1.SelectConfiguration() on /org/bluez/hci0/A2DP/AAC/source/1  
bluealsad: [31361] D: bluez.c:442: BlueZ endpoint select_configuration called  
bluealsad: [31361] D: log.c:347: AAC_CODEC: _CODEC: A2DP peer capabilities - Object Type=MPEG2-LC | MPEG4-LC, Sample Rate=8000 Hz | 11025 Hz | 12000 Hz | 16000 Hz | 22050 Hz | 24000 Hz | 32000 Hz | 44100 Hz | 48000 Hz, Channels=Mono | Stereo, VBR=enabled, Bitrate=320000  
bluealsad: [31361] D: a2dp-aac.c:664: AAC configuration_select called</code></pre></div><p><strong>EXPLANATION</strong>: The Bluetooth system (BlueZ) asks BlueALSA to choose the best AAC settings. BlueALSA looks at what the device (that is, BT Headphones) supports and selects optimal parameters.</p><div class="codebox"><pre><code># Final configuration is selected and applied  
bluealsad: [31361] D: dbus.c:43: Called: org.bluez.MediaEndpoint1.SetConfiguration() on /org/bluez/hci0/A2DP/AAC/source/1  
bluealsad: [31361] D: log.c:347: AAC_CODEC: A2DP selected configuration - Object Type=MPEG4-LC, Sample Rate=48000 Hz, Channels=Stereo (2), VBR=enabled, Bitrate=320000  
bluealsad: [31361] D: bluez.c:637: A2DP Source (AAC) configured for device EC:66:D1:BF:02:05  
bluealsad: [31361] D: bluez.c:640: PCM configuration: channels=2 rate=48000  
bluealsad: [31361] D: bluez.c:642: Delay reporting: unsupported</code></pre></div><p><strong>EXPLANATION</strong>: BlueALSA selects the best quality settings: MPEG4-LC at 48kHz stereo with 320kbps VBR. This provides near-CD quality audio. The PCM is configured to match these settings.</p><p><strong>Audio Streaming Setup</strong></p><div class="codebox"><pre><code># Application requests to play audio  
bluealsad: [31401] D: dbus.c:43: Called: org.bluealsa.PCM1.Open() on /org/bluealsa/hci0/dev_EC_66_D1_BF_02:05/a2dpsrc/sink  
bluealsad: [31401] D: ba-transport.c:316: New A2DP transport: 28  
bluealsad: [31401] D: ba-transport.c:317: A2DP socket MTU: 28: R:672 W:895</code></pre></div><p><strong>EXPLANATION</strong>: An application (like mpv) asks to play audio through the Bluetooth device. BlueALSA creates a transport channel with MTU (Maximum Transmission Unit) settings for efficient data transfer.</p><div class="codebox"><pre><code># Audio encoding starts  
bluealsad: [31361] D: ba-transport.c:1082: Starting transport: A2DP Source (AAC)  
bluealsad: [31361] D: ba-transport-pcm.c:287: Created BT socket duplicate: [28]: 29  
bluealsad: [31361] D: ba-transport-pcm.c:366: Created new IO thread [ba-a2dp-aac]: A2DP Source (AAC)  
bluealsad: [31419] D: a2dp-aac.c:332: AAC_CODEC: Encoder Info - FrameLength=1024, InputChannels=2, MaxOutBufBytes=1536, Delay=1600 samples  
bluealsad: [31419] D: a2dp-aac.c:336: AAC_CODEC: Configuration - Bitrate=320000, Afterburner=enabled, VBR=enabled, Quality=VBR  
bluealsad: [31419] D: a2dp-aac.c:391: PCM IO loop: START: a2dp_aac_enc_thread: A2DP Source (AAC)  
bluealsad: [31361] D: ba-transport-pcm.c:473: PCM resume: 24</code></pre></div><p><strong>EXPLANATION</strong>: BlueALSA starts the audio encoding process. It creates a dedicated thread for AAC encoding, with 1024-sample frames, 2-channel stereo input, and the afterburner enhancement enabled. The encoder is now ready to convert your audio into AAC format for Bluetooth transmission.</p><p><strong>AAC Frame Monitoring</strong></p><div class="codebox"><pre><code># AAC Frame Monitoring
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=497, Target bitrate=320000
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=496, Target bitrate=320000
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=600, Target bitrate=320000
bluealsad: [31419] D: a2dp-aac.c:419: AAC_CODEC: Frame - Output bytes=469, Target bitrate=320000</code></pre></div><p>The AAC frame monitoring shows the real-time encoding efficiency of the&#160; Fraunhofer AAC encoder as it processes audio for Bluetooth transmission.<br />Each line represents one AAC audio frame that has been encoded from PCM audio data. The varying output bytes (469-600) demonstrate the <strong>Variable Bit Rate (VBR)</strong> encoding at work:</p><ul><li><p><strong>Target bitrate=320000</strong>: The configured maximum bitrate of 320 kbps for high-quality audio.</p></li><li><p><strong>Output bytes variation</strong>: Shows VBR efficiency - simpler audio passages use fewer bytes (469), complex passages use more (600)</p></li><li><p><strong>Real-time monitoring</strong>: Each frame is logged as it&#039;s encoded in the <span class="bbc">a2dp_aac_enc_thread</span> (<span class="bbc">a2dp-aac.c</span>)</p></li></ul><p>The real-time monitoring reveals how AAC intelligently allocates bandwidth based on audio complexity, unlike fixed-bitrate codecs that waste data on simple passages. The afterburner enhancement you enabled further optimizes this process for better audio quality. The frame-by-frame variation is quite normal and indicates the encoder is working rather efficiently, adapting to the musical content as it processes each segment of audio.</p><ul><li><p>The real-time monitoring appears only when <span class="bbc">--loglevel=debug</span> is enabled</p></li><li><p>The byte variations are typical for VBR encoding with afterburner enabled</p></li><li><p>Each frame represents approximately 1024 samples of audio data</p></li><li><p>The actual transmission rate averages around the target 320 kbps over time</p></li></ul><p><strong>Notes</strong></p><p>This simplified log illustrates the full Bluetooth audio pipeline — from daemon startup to active streaming — with a focus on AAC codec negotiation and configuration. It demonstrates how BlueALSA serves as a bridge between Linux applications and Bluetooth audio devices, handling codec discovery, negotiation, and real-time encoding with quiet efficiency.</p><p><strong>ALSA configuration for BlueALSA virtual PCM with AAC codec</strong></p><div class="codebox"><pre><code>$ cat ~/.asoundrc
defaults.pcm.rate_converter &quot;fftrate&quot;
defaults.bluealsa.codec &quot;aac&quot; 
pcm.!default &quot;bluealsa&quot;</code></pre></div><p><strong>BlueALSA Commands</strong></p><div class="codebox"><pre><code>bluealsactl codec $(bluealsactl list-pcms | grep a2dpsrc | head -1) aac</code></pre></div><div class="codebox"><pre><code>$ bluealsactl codec $(bluealsactl list-pcms | grep a2dpsrc | head -1) 
Available codecs: SBC AAC
Selected codec: AAC</code></pre></div><p>BlueALSA preserves the original sample rate when:</p><ul><li><p>The source audio is 44.1kHz or 48kHz (the A2DP mandatory rates)</p></li><li><p>The Bluetooth receiver supports the same rate</p></li></ul><p>When resampling is needed (e.g., DXD to 48kHz), it is performed by the default ALSA resampler (now <span class="bbc">fftrate</span>)</p><p><strong>Command for Real-Time Sample Rate Monitoring</strong></p><div class="codebox"><pre><code>$ bluecodec
Selected: AAC:40008484e200
MPEG-2,4 AAC &lt;hex:40008484e200&gt; {
  Object Type ( MPEG4-LC )
  Dynamic Range Control ( false )
  Sample Rate ( 48000 Hz )
  Channel Mode ( Stereo )
  VBR ( true )
  Bitrate ( 320000 )
}</code></pre></div><div class="codebox"><pre><code>$ bluecodec
Selected: AAC:40010484e200
MPEG-2,4 AAC &lt;hex:40010484e200&gt; {
  Object Type ( MPEG4-LC )
  Dynamic Range Control ( false )
  Sample Rate ( 44100 Hz )
  Channel Mode ( Stereo )
  VBR ( true )
  Bitrate ( 320000 )
}</code></pre></div><div class="codebox"><pre><code>bluecodec() {
    local pcm=$(bluealsactl list-pcms | grep a2dpsrc | head -1)
    local codec=$(bluealsactl --verbose codec &quot;$pcm&quot; | grep &quot;Selected codec&quot; | awk &#039;{print $3}&#039;)
    echo &quot;Selected: $codec&quot;
    a2dpconf &quot;$codec&quot;
}</code></pre></div><p><strong>Technical Details</strong></p><p>BlueALSA preserves native sample rates because the D-Bus API exposes the actual PCM rate property, and the A2DP specification mandates support for 44.1kHz and 48kHz rates . When source and sink support the same rate, no resampling occurs, maintaining optimal audio quality.<br />The <span class="bbc">bluecodec</span> function provides real-time visibility into the actual negotiated configuration, showing whether BlueALSA is transmitting at 44.1kHz, 48kHz, or other supported rates based on the codec capabilities and device compatibility.</p><p><strong>On Afterburner and CPU Usage</strong></p><div class="codebox"><pre><code>$ man bluealsad | grep afterburner -A2
       --aac-afterburner
              Enables  Fraunhofer  AAC afterburner feature, which is a type of analysis by synthesis algorithm.  This
              feature increases the audio quality at the cost of increased processing power and overall  memory  con‐
              sumption.</code></pre></div><div class="codebox"><pre><code>$ cat bluez-alsa-4.3.1-86/src/ba-config.c | grep ENABLE_AAC -A21
#if ENABLE_AAC
    /* There are two issues with the afterburner: a) it uses a LOT of power,
     * b) it generates larger payload. These two reasons are good enough to
     * not enable afterburner by default. */
    .aac_afterburner = false,
    /* By default try not to not use the VBR mode. Please note, that for A2DP
     * sink the VBR mode might still be used if the connection is initialized
     * by a remote BT device. */
    .aac_prefer_vbr = false,
    /* Do not enable true &quot;bit per second&quot; bit rate by default because it
     * violates A2DP AAC specification. */
    .aac_true_bps = false,
    /* For CBR mode the 220 kbps bitrate should result in an A2DP frame equal
     * to 651 bytes. Such frame size should fit within writing MTU of most BT
     * headsets, so it will prevent RTP fragmentation which seems not to be
     * supported by every BT headset out there. */
    .aac_bitrate = 220000,
    /* Use newer LATM syntax by default. Please note, that some older BT
     * devices might not understand this syntax, so for them it might be
     * required to use LATM version 0 (ISO-IEC 14496-3 (2001)). */
    .aac_latm_version = 1,
#endif</code></pre></div><p>The BlueALSA documentation suggests the afterburner “uses a LOT of power.” In practice, testing on an Intel Core i3-3220 (2012) shows average CPU usage of <strong>3.47%</strong>, peaking at <strong>6%</strong> during playback. One might conclude that the concern is, at best, a trifle overblown.<br /><strong>Tested with:</strong><br /><strong>ASUS USB-BT540</strong> Bluetooth 5.4 Dongle Adapter Compatible with Linux&#160; <br /><strong>Sennheiser HD 450BT</strong> Bluetooth Wireless Headphones<br /><strong>Bowers &amp; Wilkins Px7 S2e</strong> Bluetooth Wireless Headphones</p><p><strong>Sound Quality</strong></p><p>AAC over Bluetooth isn’t Hi-Res by any stretch, but with afterburner and VBR at 320 kbps, it delivers <strong>transparent, near-CD quality</strong> for most listeners. The afterburner enhances perceptual quality through analysis-by-synthesis — it does work rather well. It won’t satisfy a true audiophile, but for the average person, it’s perfectly acceptable.<br />With AAC, BlueALSA delivers proper AAC sound quality. If you’re unsure what that means, try it yourself using Firefox and YouTube.<br /><strong>Step 1:</strong> Disable WebM support in Firefox (<span class="bbc">media.mediasource.webm.enabled = false</span>).&#160; <br /><strong>Step 2:</strong> Play a high-quality AAC audio source, such as:&#160; <br /><em>Robert de Visée – Prélude et Allemande (Jonas Nordberg, theorbo)</em> on YouTube: <span class="bbc">_https://youtu.be/qeUcGD4rRRc</span></p><div class="quotebox"><blockquote><div><p><strong>Reference media files:</strong><br /><strong>Robert de Visée Prélude et Allemande, Jonas Nordberg, theorbo</strong><br /><span class="bbc">_https://youtu.be/qeUcGD4rRRc</span></p><div class="codebox"><pre><code>$ youtube-dl -F &quot;https://youtu.be/qeUcGD4rRRc&quot; | grep &quot;audio only&quot;
249          webm       audio only audio_quality_low   52k , webm_dash container, opus  (48000Hz), 1.81MiB
250          webm       audio only audio_quality_low   70k , webm_dash container, opus  (48000Hz), 2.43MiB
140          m4a        audio only audio_quality_medium  129k , m4a_dash container, mp4a.40.2 (44100Hz), 4.47MiB
251          webm       audio only audio_quality_medium  137k , webm_dash container, opus  (48000Hz), 4.75MiB</code></pre></div><div class="codebox"><pre><code>$ firefox 2&gt;&amp;1 https://youtu.be/qeUcGD4rRRc
Input:  44100 Hz, 2 ch, &#039;s32_le&#039; (0xa): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, &#039;s16_le&#039; (0x2): dummy = 0, period = 1920
Rates:  44100 --&gt; 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.</code></pre></div><p><strong>Naseer Shamma with Master Musicians in Berlin</strong> (2023)<br />_https://youtu.be/GfSeEevp9xo<br />Naseer Shamma - Oud &amp; Composition<br />Thanasis Polikadriotis - Bouzouki<br />Hussein Zahawy - Daf (Bandir)<br />Ashraf Sharif Khan - Sitar<br />Jorge Bezzera - Various Percussions<br />Alex Simu - Clarinet<br />Emel Bostanci - Kemenche</p></div></blockquote></div><div class="quotebox"><blockquote><div><p><strong>Firefox settings for better sound quality:</strong></p><ul><li><p>Open <span class="bbc">about:config</span></p></li><li><p>Set <span class="bbc">media.mediasource.webm.enabled</span> to <span class="bbc">false</span> to force AAC (m4a) playback on YouTube</p></li><li><p>Set <span class="bbc">media.cubeb.backend</span> to <span class="bbc">alsa</span> for direct audio output on Linux</p></li><li><p>Disable resampling: set <span class="bbc">media.resampling.enabled</span> to <span class="bbc">false</span></p></li><li><p>Adjust latency: set <span class="bbc">media.cubeb_latency_playback_ms</span> to <span class="bbc">160</span> for balanced performance</p></li></ul><p>These settings help Firefox deliver cleaner, more consistent audio, especially when streaming AAC content.<br /><span class="bbc">about:config</span></p><div class="codebox"><pre><code>media.mediasource.webm.enabled		false
media.cubeb.backend                    		alsa
media.resampling.enabled            		false
media.cubeb_latency_playback_ms        		160</code></pre></div><p><strong>Configuration Editor for Firefox</strong><br /><span class="bbc">_https://support.mozilla.org/en-US/kb/about-config-editor-firefox</span></p></div></blockquote></div><p><strong>Advanced Audio Coding</strong><br /><span class="bbc">_https://en.wikipedia.org/wiki/Advanced_Audio_Coding</span></p><p><strong>The FDK-AAC licence</strong></p><p>The FDK-AAC codec is open source under a permissive copyright licence that grants broad rights—allowing free redistribution, requiring source availability for binaries, permitting modifications with attribution, and imposing no royalty fees. However, it does not convey patent rights; separate licences are necessary for commercial use.</p><div class="codebox"><pre><code>$ cat fdk-aac/NOTICE 
...
AAC-ELD is considered the best-performing full-bandwidth communications codec 
by independent studies and is widely deployed. AAC has been standardized by ISO 
and IEC as part of the MPEG specifications.</code></pre></div><p><strong>BlueALSA Logging: A Modest Affair</strong></p><p>BlueALSA&#039;s default logging maintains a certain reserve - quite minimal by design, you see. The logging system resides in <span class="bbc">src/shared/log.c</span>&#160; with corresponding declarations in <span class="bbc">src/shared/log.h</span> </p><p><strong>The Current Situation</strong></p><p>By default, BlueALSA rather keeps to itself with basic error and warning messages. The debug macros are quite simply disabled in release builds:</p><div class="codebox"><pre><code>#define debug(M, ...) do {} while (0)</code></pre></div><p>Rather tidy, though perhaps not terribly informative when things go awry.</p><p><strong>Adding Comprehensive Logging</strong></p><p>Should one wish for more verbose output, it&#039;s really not such a tremendous undertaking. The framework is already there - one merely <br />needs to sprinkle <span class="bbc">debug()</span> statements about the codebase:</p><div class="codebox"><pre><code>debug(&quot;Transport state changed: %s&quot;, state_name);  
debug(&quot;Codec negotiation: %s selected&quot;, codec_name);</code></pre></div><p>The debug system handles the niceties - thread safety, priority filtering, and rather useful timestamps when built with <span class="bbc">--enable-debug-time</span>.</p><p><strong>A Matter of Compilation</strong></p><p>Of course, one must remember to compile with debugging support:</p><div class="codebox"><pre><code>./configure --enable-debug  
make</code></pre></div><p>Quite straightforward, really. The system then provides rather detailed output including file locations, thread IDs, and relative timing .</p><p><strong>Notes</strong></p><p>The understated approach to default logging keeps BlueALSA rather quiet in normal operation, though the comprehensive debug framework means adding detailed logging is merely a matter of adding a few well-placed statements here and there. Not terribly difficult, as these things go.</p>]]></description>
			<author><![CDATA[dummy@example.com (igorzwx)]]></author>
			<pubDate>Wed, 07 Jan 2026 16:43:01 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=61169#p61169</guid>
		</item>
	</channel>
</rss>
