Files
bumble_mirror/apps_and_tools/speaker.html
2023-06-10 15:27:33 -07:00

1381 lines
30 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.3.1, mkdocs-material-8.4.0">
<title>Speaker - Bumble</title>
<link rel="stylesheet" href="../assets/stylesheets/main.69437709.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.cbb835fc.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../assets/_mkdocstrings.css">
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="none" data-md-color-accent="none">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#speaker-app" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../index.html" title="Bumble" class="md-header__button md-logo" aria-label="Bumble" data-md-component="logo">
<img src="../images/logo.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Bumble
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Speaker
</span>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/google/bumble" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../index.html" title="Bumble" class="md-nav__button md-logo" aria-label="Bumble" data-md-component="logo">
<img src="../images/logo.png" alt="logo">
</a>
Bumble
</label>
<div class="md-nav__source">
<a href="https://github.com/google/bumble" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../index.html" class="md-nav__link">
Introduction
</a>
</li>
<li class="md-nav__item">
<a href="../getting_started.html" class="md-nav__link">
Getting Started
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3">
Development
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Development" data-md-level="1">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Development
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../development/python_environments.html" class="md-nav__link">
Python Environments
</a>
</li>
<li class="md-nav__item">
<a href="../development/contributing.html" class="md-nav__link">
Contributing
</a>
</li>
<li class="md-nav__item">
<a href="../development/code_style.html" class="md-nav__link">
Code Style
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4">
Use Cases
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Use Cases" data-md-level="1">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Use Cases
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../use_cases/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_1.html" class="md-nav__link">
Use Case 1
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_2.html" class="md-nav__link">
Use Case 2
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_3.html" class="md-nav__link">
Use Case 3
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_4.html" class="md-nav__link">
Use Case 4
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_5.html" class="md-nav__link">
Use Case 5
</a>
</li>
<li class="md-nav__item">
<a href="../use_cases/use_case_6.html" class="md-nav__link">
Use Case 6
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
<label class="md-nav__link" for="__nav_5">
Components
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Components" data-md-level="1">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Components
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../components/controller.html" class="md-nav__link">
Controller
</a>
</li>
<li class="md-nav__item">
<a href="../components/host.html" class="md-nav__link">
Host
</a>
</li>
<li class="md-nav__item">
<a href="../components/gatt.html" class="md-nav__link">
GATT
</a>
</li>
<li class="md-nav__item">
<a href="../components/security_manager.html" class="md-nav__link">
Security Manager
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6">
Transports
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Transports" data-md-level="1">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Transports
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../transports/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../transports/serial.html" class="md-nav__link">
Serial
</a>
</li>
<li class="md-nav__item">
<a href="../transports/usb.html" class="md-nav__link">
USB
</a>
</li>
<li class="md-nav__item">
<a href="../transports/pty.html" class="md-nav__link">
PTY
</a>
</li>
<li class="md-nav__item">
<a href="../transports/udp.html" class="md-nav__link">
UDP
</a>
</li>
<li class="md-nav__item">
<a href="../transports/tcp_client.html" class="md-nav__link">
TCP Client
</a>
</li>
<li class="md-nav__item">
<a href="../transports/tcp_server.html" class="md-nav__link">
TCP Server
</a>
</li>
<li class="md-nav__item">
<a href="../transports/ws_client.html" class="md-nav__link">
WebSocket Client
</a>
</li>
<li class="md-nav__item">
<a href="../transports/ws_server.html" class="md-nav__link">
WebSocket Server
</a>
</li>
<li class="md-nav__item">
<a href="../transports/vhci.html" class="md-nav__link">
VHCI
</a>
</li>
<li class="md-nav__item">
<a href="../transports/hci_socket.html" class="md-nav__link">
HCI Socket
</a>
</li>
<li class="md-nav__item">
<a href="../transports/android_emulator.html" class="md-nav__link">
Android Emulator
</a>
</li>
<li class="md-nav__item">
<a href="../transports/file.html" class="md-nav__link">
File
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7">
API
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="API" data-md-level="1">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
API
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../api/guide.html" class="md-nav__link">
Guide
</a>
</li>
<li class="md-nav__item">
<a href="../api/examples.html" class="md-nav__link">
Examples
</a>
</li>
<li class="md-nav__item">
<a href="../api/reference.html" class="md-nav__link">
Reference
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" checked>
<label class="md-nav__link" for="__nav_8">
Apps & Tools
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Apps & Tools" data-md-level="1">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Apps & Tools
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="console.html" class="md-nav__link">
Console
</a>
</li>
<li class="md-nav__item">
<a href="bench.html" class="md-nav__link">
Bench
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<a href="speaker.html" class="md-nav__link md-nav__link--active">
Speaker
</a>
</li>
<li class="md-nav__item">
<a href="hci_bridge.html" class="md-nav__link">
HCI Bridge
</a>
</li>
<li class="md-nav__item">
<a href="gg_bridge.html" class="md-nav__link">
Golden Gate Bridge
</a>
</li>
<li class="md-nav__item">
<a href="show.html" class="md-nav__link">
Show
</a>
</li>
<li class="md-nav__item">
<a href="gatt_dump.html" class="md-nav__link">
GATT Dump
</a>
</li>
<li class="md-nav__item">
<a href="pair.html" class="md-nav__link">
Pair
</a>
</li>
<li class="md-nav__item">
<a href="unbond.html" class="md-nav__link">
Unbond
</a>
</li>
<li class="md-nav__item">
<a href="usb_probe.html" class="md-nav__link">
USB Probe
</a>
</li>
<li class="md-nav__item">
<a href="link_relay.html" class="md-nav__link">
Link Relay
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" >
<label class="md-nav__link" for="__nav_9">
Hardware
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Hardware" data-md-level="1">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Hardware
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../hardware/index.html" class="md-nav__link">
Overview
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_10" type="checkbox" id="__nav_10" >
<label class="md-nav__link" for="__nav_10">
Platforms
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Platforms" data-md-level="1">
<label class="md-nav__title" for="__nav_10">
<span class="md-nav__icon md-icon"></span>
Platforms
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../platforms/index.html" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/macos.html" class="md-nav__link">
macOS
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/linux.html" class="md-nav__link">
Linux
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/windows.html" class="md-nav__link">
Windows
</a>
</li>
<li class="md-nav__item">
<a href="../platforms/android.html" class="md-nav__link">
Android
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_11" type="checkbox" id="__nav_11" >
<label class="md-nav__link" for="__nav_11">
Examples
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Examples" data-md-level="1">
<label class="md-nav__title" for="__nav_11">
<span class="md-nav__icon md-icon"></span>
Examples
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">
Overview
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="speaker-app">SPEAKER APP<a class="headerlink" href="#speaker-app" title="Permanent link">&para;</a></h1>
<p><img alt="logo" height="320" src="../images/speaker_screenshot.png" width="400" /></p>
<p>The Speaker app is virtual Bluetooth speaker (A2DP sink).
The app runs as a command-line executable, but also offers an optional simple
web-browser-based user interface.</p>
<h1 id="general-usage">General Usage<a class="headerlink" href="#general-usage" title="Permanent link">&para;</a></h1>
<p>You can invoke the app either as <code>bumble-speaker</code> when installed as command
from <code>pip</code>, or <code>python3 apps/speaker/speaker.py</code> when running from a source
distribution.</p>
<div class="highlight"><pre><span></span><code>Usage: speaker.py [OPTIONS] TRANSPORT
Run the speaker.
Options:
--codec [sbc|aac] [default: aac]
--discover Discover remote endpoints once connected
--output NAME Send audio to this named output (may be used more
than once for multiple outputs)
--ui-port HTTP_PORT HTTP port for the UI server [default: 7654]
--connect ADDRESS_OR_NAME Address or name to connect to
--device-config FILENAME Device configuration file
--help Show this message and exit.
</code></pre></div>
<h1 id="connection">Connection<a class="headerlink" href="#connection" title="Permanent link">&para;</a></h1>
<p>By default, the virtual speaker will wait for another device (like a phone or
computer) to connect to it (and possibly pair). Alternatively, the speaker can
be told to initiate a connection to a remote device, using the <code>--connect</code>
option.</p>
<h1 id="outputs">Outputs<a class="headerlink" href="#outputs" title="Permanent link">&para;</a></h1>
<p>The speaker can have one or more outputs. By default, the only output is a text
display on the console, as well as a browser-based user interface if connected.
In addition, a file output can be used, in which case the received audio data is
saved to a specified file.
Finally, if the host computer on which your are running the application has <code>ffplay</code>
as an available command line executable, the <code>@ffplay</code> output can be selected, in
which case the received audio will be played on the computer's builtin speakers via
a pipe to <code>ffplay</code>. (see the <a href="https://www.ffmpeg.org/ffplay.html">ffplay documentation</a>
for details)</p>
<h1 id="web-user-interface">Web User Interface<a class="headerlink" href="#web-user-interface" title="Permanent link">&para;</a></h1>
<p>When the speaker app starts, it prints out on the console the local URL at which you
may point a browser (Chrome recommended for full functionality). The console line
specifying the local UI URL will look like:
<div class="highlight"><pre><span></span><code>UI HTTP server at http://127.0.0.1:7654
</code></pre></div></p>
<p>By default, the web UI will show the status of the connection, as well as a realtime
graph of the received audio bandwidth.
In order to also hear the received audio, you need to click the <code>Audio on</code> button
(this is due to the fact that most browsers will require some user interface with the
page before granting access to the audio output APIs).</p>
<h1 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">&para;</a></h1>
<p>In the following examples, we use a single USB Bluetooth controllers <code>usb:0</code>. Other
transports can be used of course.</p>
<div class="admonition example">
<p class="admonition-title">Start the speaker and wait for a connection</p>
<div class="highlight"><pre><span></span><code>$ bumble-speaker usb:0
</code></pre></div>
</div>
<div class="admonition example">
<p class="admonition-title">Start the speaker and save the AAC audio to a file named <code>audio.aac</code>.</p>
<div class="highlight"><pre><span></span><code>$ bumble-speaker --output audio.aac usb:0
</code></pre></div>
</div>
<div class="admonition example">
<p class="admonition-title">Start the speaker and save the SBC audio to a file named <code>audio.sbc</code>.</p>
<div class="highlight"><pre><span></span><code>$ bumble-speaker --codec sbc --output audio.sbc usb:0
</code></pre></div>
</div>
<div class="admonition example">
<p class="admonition-title">Start the speaker and connect it to a phone at address <code>B8:7B:C5:05:57:ED</code>.</p>
<div class="highlight"><pre><span></span><code>$ bumble-speaker --connect B8:7B:C5:05:57:ED usb:0
</code></pre></div>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="bench.html" title="Bench" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Bench
</span>
</div>
</a>
<a href="hci_bridge.html" title="HCI Bridge" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
HCI Bridge
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Copyright 2021-2023 Google LLC
</div>
</div>
<div class="md-social">
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
<script src="../assets/javascripts/bundle.9c69f0bc.min.js"></script>
</body>
</html>