Documentation
ΒΆ
Overview ΒΆ
Package soundtouch provides a comprehensive Go library, CLI tool, and local service for controlling and emulating Bose SoundTouch devices.
This project implements the complete Bose SoundTouch Web API, enabling programmatic control of SoundTouch speakers including playback control, volume management, source selection, multiroom zone management, and real-time event monitoring.
It also provides a local service (`soundtouch-service`) that can emulate the Bose Cloud, allowing for offline control and enhanced debugging through HTTP interaction recording.
Quick Start ΒΆ
Install the library:
go get github.com/gesellix/bose-soundtouch
Basic usage example:
package main
import (
"fmt"
"log"
"github.com/gesellix/bose-soundtouch/pkg/client"
)
func main() {
// Create a client for your SoundTouch device
config := &client.Config{
Host: "192.168.1.100",
Port: 8090,
}
client := client.NewClient(config)
// Get device information
info, err := client.GetInfo()
if err != nil {
log.Fatal(err)
}
fmt.Printf("Device: %s\n", info.Name)
// Control playback
err = client.Play()
if err != nil {
log.Fatal(err)
}
}
SoundTouch Service ΒΆ
The `soundtouch-service` provides several advanced features:
- Bose Cloud Emulation: Allows speakers to work without an internet connection.
- HTTP Interaction Recording: Captures all traffic as IntelliJ-compatible .http files.
- Speaker Migration: Automated tools to redirect speakers to the local service.
- Web Interface: A management dashboard for proxy settings and speaker setup.
Install the service:
go install github.com/gesellix/bose-soundtouch/cmd/soundtouch-service@latest
CLI Tool ΒΆ
The package includes a comprehensive CLI tool for device control:
# Install the CLI go install github.com/gesellix/bose-soundtouch/cmd/soundtouch-cli@latest # Discover devices soundtouch-cli discover devices # Control a device soundtouch-cli --host 192.168.1.100 play start
Supported Features ΒΆ
- β Device Information & Capabilities
- β Playback, Volume, Bass, and Balance Control
- β Source Selection & Preset Management
- β Real-time WebSocket Events
- β Multiroom Zone Management
- β Device Discovery (UPnP/SSDP and mDNS)
- β Local Cloud Emulation (soundtouch-service)
- β HTTP Traffic Recording & Sanitization
- β Automated Speaker Migration & Revert
Package Structure ΒΆ
- client: HTTP client for SoundTouch Web API
- discovery: Device discovery using UPnP/SSDP and mDNS
- models: Data structures for API requests/responses
- service: Core logic for the soundtouch-service (proxy, recording, setup)
- cmd/soundtouch-cli: Command-line interface tool
- cmd/soundtouch-service: Local cloud emulation service
Implementation Notes ΒΆ
This project is an independent effort to preserve the functionality of Bose SoundTouch devices and provide enhanced debugging and control capabilities. It is not affiliated with or endorsed by Bose Corporation.
For detailed API documentation, examples, and advanced usage patterns, visit: https://pkg.go.dev/github.com/gesellix/bose-soundtouch
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
debug-consolidation
command
Package main provides a debug tool for analyzing device consolidation and migration scenarios.
|
Package main provides a debug tool for analyzing device consolidation and migration scenarios. |
|
example-mdns
command
Package main provides an example of discovering SoundTouch devices using mDNS.
|
Package main provides an example of discovering SoundTouch devices using mDNS. |
|
example-unified
command
Package main provides an example of discovering SoundTouch devices using all three mechanisms.
|
Package main provides an example of discovering SoundTouch devices using all three mechanisms. |
|
example-upnp
command
Package main provides an example of discovering SoundTouch devices using UPnP.
|
Package main provides an example of discovering SoundTouch devices using UPnP. |
|
favicon-gen
command
Package main provides a utility to generate PNG and ICO favicons from SVG source files.
|
Package main provides a utility to generate PNG and ICO favicons from SVG source files. |
|
mdns-scanner
command
Package main provides a simple mDNS scanner to discover SoundTouch devices on the network.
|
Package main provides a simple mDNS scanner to discover SoundTouch devices on the network. |
|
mock-spotify
command
Package main provides a mock Spotify server for testing purposes.
|
Package main provides a mock Spotify server for testing purposes. |
|
soundtouch-cli
command
Package main provides the soundtouch-cli balance control commands.
|
Package main provides the soundtouch-cli balance control commands. |
|
soundtouch-service
command
Package main provides the SoundTouch service daemon that acts as a proxy and management interface for Bose SoundTouch devices, providing Marge service emulation and device discovery.
|
Package main provides the SoundTouch service daemon that acts as a proxy and management interface for Bose SoundTouch devices, providing Marge service emulation and device discovery. |
|
soundtouch-web
command
Package main provides a web UI for controlling Bose SoundTouch devices.
|
Package main provides a web UI for controlling Bose SoundTouch devices. |
|
soundtouch-web/handlers
Package handlers contains HTTP handlers for the SoundTouch web UI.
|
Package handlers contains HTTP handlers for the SoundTouch web UI. |
|
soundtouch-web/webtypes
Package webtypes contains type definitions for the SoundTouch web UI.
|
Package webtypes contains type definitions for the SoundTouch web UI. |
|
websocket-demo
command
Package main provides a demonstration of WebSocket event handling for Bose SoundTouch devices.
|
Package main provides a demonstration of WebSocket event handling for Bose SoundTouch devices. |
|
Package main demonstrates the new recording filename format that includes date information.
|
Package main demonstrates the new recording filename format that includes date information. |
|
account-management
command
Package main demonstrates music service account management functionality for Bose SoundTouch devices.
|
Package main demonstrates music service account management functionality for Bose SoundTouch devices. |
|
advanced-audio-controls
command
Package main provides an example of using advanced audio controls.
|
Package main provides an example of using advanced audio controls. |
|
content-selection
command
Package main demonstrates content selection functionality for Bose SoundTouch devices.
|
Package main demonstrates content selection functionality for Bose SoundTouch devices. |
|
introspect
command
Package main demonstrates introspect functionality for Bose SoundTouch devices.
|
Package main demonstrates introspect functionality for Bose SoundTouch devices. |
|
recents
command
Package main demonstrates recent content functionality for Bose SoundTouch devices.
|
Package main demonstrates recent content functionality for Bose SoundTouch devices. |
|
service-availability
command
Package main demonstrates service availability checking for SoundTouch devices
|
Package main demonstrates service availability checking for SoundTouch devices |
|
service-demo
command
Package main provides a demo client for the SoundTouch service API, demonstrating how to interact with devices and retrieve media information.
|
Package main provides a demo client for the SoundTouch service API, demonstrating how to interact with devices and retrieve media information. |
|
zone-slave-operations
command
Package main provides an example of using zone slave operations.
|
Package main provides an example of using zone slave operations. |
|
pkg
|
|
|
client
Package client provides a comprehensive HTTP client for controlling Bose SoundTouch devices.
|
Package client provides a comprehensive HTTP client for controlling Bose SoundTouch devices. |
|
config
Package config provides configuration management for the Bose SoundTouch Go library.
|
Package config provides configuration management for the Bose SoundTouch Go library. |
|
discovery
Package discovery provides device discovery functionality for Bose SoundTouch devices using mDNS and UPnP protocols.
|
Package discovery provides device discovery functionality for Bose SoundTouch devices using mDNS and UPnP protocols. |
|
models
Package models provides data structures and types for music service account management on Bose SoundTouch devices.
|
Package models provides data structures and types for music service account management on Bose SoundTouch devices. |
|
service/bmx
Package bmx implements minimal helper calls to public TuneIn endpoints and wraps them into Bose-compatible response models.
|
Package bmx implements minimal helper calls to public TuneIn endpoints and wraps them into Bose-compatible response models. |
|
service/certmanager
Package certmanager provides tools for managing Root CAs and generating SSL certificates.
|
Package certmanager provides tools for managing Root CAs and generating SSL certificates. |
|
service/constants
Package constants defines file names, directories, and common values used by the service layer.
|
Package constants defines file names, directories, and common values used by the service layer. |
|
service/datastore
Package datastore provides a simple XML-based datastore for SoundTouch devices.
|
Package datastore provides a simple XML-based datastore for SoundTouch devices. |
|
service/handlers
Package handlers provides HTTP handlers for the SoundTouch service.
|
Package handlers provides HTTP handlers for the SoundTouch service. |
|
service/marge
Package marge provides XML generation and data management for the Marge service, which handles SoundTouch device configuration, presets, recents, and account management.
|
Package marge provides XML generation and data management for the Marge service, which handles SoundTouch device configuration, presets, recents, and account management. |
|
service/proxy
Package proxy provides a logging reverse proxy used for speaker traffic debugging.
|
Package proxy provides a logging reverse proxy used for speaker traffic debugging. |
|
service/setup
Package setup contains speaker migration and configuration helpers.
|
Package setup contains speaker migration and configuration helpers. |
|
service/spotify
Package spotify provides Spotify OAuth integration and token management for the SoundTouch service, ported from soundcork's Python implementation.
|
Package spotify provides Spotify OAuth integration and token management for the SoundTouch service, ported from soundcork's Python implementation. |
|
service/ssh
Package ssh provides simple SSH operations used during device setup and migration.
|
Package ssh provides simple SSH operations used during device setup and migration. |
|
testutils/spotify
Package spotify provides shared handlers for mocking the Spotify API.
|
Package spotify provides shared handlers for mocking the Spotify API. |
|
scripts
|
|
|
extract-log-interactions
command
|
|
|
extract-ws
command
|
|
|
http-diff
command
|
|
|
tests
|
|
|
integration/mocks
Package mocks provides mock implementations for external services during testing.
|
Package mocks provides mock implementations for external services during testing. |