A easy Broadcast Audio Source
Broadcast Audio Transmitters and Receivers
A easy BAP broadcast supply (transmitter) that will probably be suitable with LE Audio broadcast receivers (e.g. some high-end earbuds out there now) ought to promote, together with a discipline containing service knowledge for the Broadcast Audio Announcement Service (0x1852) with a Broadcast ID as the info.
It additionally wants to supply (LC3) encoded audio packets by means of a periodic promoting practice (the precise Audio knowledge).
Information in regards to the supply stream(s) can also be offered by means of periodic promoting:
- BIGinfo: Provides info wanted by receivers to know the stream (e.g. timings, attainable encryption, and many others.)
- BASE (Broadcast Audio Source Endpoint): Contains details about the streams offered by the printed supply, e.g. left/proper channels, meta knowledge like language and extra
When a receiver is instructed to "tune in" to the printed (given Bluetooth LE handle, Broadcast ID and Advertising Set ID), it’s going to then have the ability to uncover the right broadcast supply and synchronize to the broadcasted periodic promoting and ultimately, decode and playback the audio broadcasted from the chosen broadcast supply (transmitter).
NOTE: This part solely incorporates a really excessive degree overview of the transmitter. For extra particulars, Nick Hunn wrote a wonderful guide on LE Audio: Introducing Bluetooth LE Audio, 2nd Edition
Zephyr and LE Audio Broadcasting
The Zephyr RTOS incorporates some nice Bluetooth LE Audio associated samples. One of them is the Basic Audio Profile (BAP) Broadcast Source pattern.
By default, this pattern features as a quite simple broadcast transmitter, both transmitting (mock) sine wave audio or – if out there and configured – features as a USB sound card, transmitting audio offered by means of a USB interface (e.g. from a related PC or cellphone).
Although this works effectively for some setups, for some check and improvement eventualities, it will be sensible to have an array of broadcast sources, broadcasting (audible) completely different audio with minimal configuration and {hardware} wanted.
nRF52840 Dongle and pre-encoded audio
As the pattern already compiles and runs on the Nordic Semiconductor nRF52840 Dongle, it appeared affordable to research if this dongle might be used for the aim.
When constructing the bap_broadcast_source pattern for the nRF52840 (with 1024 kB flash), reminiscence utilization is the next:
Memory area Used Size Region Size %age Used
FLASH: 260908 B 1020 KB 24.98%
RAM: 62284 B 256 KB 23.76%
IDT_LIST: 0 GB 32 KB 0.00%
This ought to go away round 750 kB of flash reminiscence, which might be used to comprise audio knowledge.
The bap_broadcast_source pattern helps on-the-fly encoding of uncompressed PCM audio samples to LC3 encoded packets for broadcasting. But if we pre-encode the audio in LC3 format and retailer it in flash reminiscence, we are able to eradicate the encoding step whereas additionally saving reminiscence.
Taking a more in-depth take a look at the liblc3 module used to encode/decode audio in Zephyr, originating from https://github.com/google/liblc3, exhibits that it additionally incorporates sensible command line instruments to encode and decode *.wav information to/from LC3 format.
Encoding a *.wav file, containing simply above 2 minutes of 16 kHz, mono audio (input16KHz.wav at 4016868 bytes):
.../liblc3/bin$ ./elc3 -b 32000 input16KHz.wav output16KHz.lc3
(32000 is the bitrate for 16 kHz LC3)
The lead to output16KHz.lc3 is 527202 bytes of LC3 encoded audio knowledge (together with file and knowledge packet headers), which is effectively beneath the restrict of the 750 kB flash out there.
For extra info and full supply code, look right here
Tracing
In an earlier put up, I wrote about utilizing the RFcreations mini-moreph along with the blueSpy software program.
This time, it might be fascinating to see what knowledge it is ready to seize from the nRF52840 Dongle, broadcasting 16 kHz (mono channel) audio.
Connecting the mini-moreph and beginning capturing with the blueSpy software program instantly finds the printed supply with BT identify Music and Broadcast identify Hold on a Sec, which is chosen within the Filter Devices tab to give attention to the promoting despatched from the printed supply dongle.
Looking on the timeline within the backside, it is also attainable to see the 16 kHz mono audio stream captured and appropriately detected
Now, if we choose one of many entries within the abstract pane, containing periodic promoting knowledge and take a look at the Details pane, it is very straightforward to examine each the BIGinfo:
And the BASE, which appropriately exhibits a single subgroup with a single mono-channel 16 kHz BIS:
Another cool characteristic is within the Audio Export panel, the place it is each attainable to take heed to a particular BIS by means of the PC speaker and exporting to a file.
Here I observed yet one more very good characteristic. By right-clicking on the entries of captured supply streams within the Audio Export panel, it is attainable to generate a Broadcast Audio URI (with QR code):
By utilizing the easy internet check web page, described in one other put up, I used to be capable of confirm the code:
Conclusion
In this put up, we have lined the way to create a easy, reasonably priced standalone BAP Broadcast Source, broadcasting music in a loop from a tiny nRF52840 Dongle and the way to seize audio and verifying BIGinfo and BASE with the RFcreations mini-moreph.
The full supply code for the easy BAP broadcast supply is obtainable right here.
Enjoy 😉
HI-FI News
by way of DEV Community https://dev.to
March 3, 2025 at 11:15PM
-
Product on sale
Audiophile Vinyl Records Cleaning BundleOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Product on sale
Easy Start Vinyl Records Cleaning KitOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Vinyl Records Cleaner Easy Groove Concentrate€34.95 incl. VAT -
Easy Groove Super Set€199.00 incl. VAT -
Easy Groove Enzycaster – vinyl records prewash cleaner€34.95 incl. VAT -
Easy Groove Extreme MK. II- vinyl records prewash cleaner€45.00 incl. VAT -
Vinyl Records Cleaner – Easy Groove Virgin Concentrate€35.00 incl. VAT -
Easy Groove Spray&Wipe vinyl records cleaner€34.95 incl. VAT














