Documentation for controlling and preserving Bose SoundTouch devices
The Bose SoundTouch Go client provides comprehensive bass control functionality through the GET /bass and POST /bass endpoints. This feature allows you to adjust bass levels from -9 (maximum bass cut) to +9 (maximum bass boost) with full validation and safety features.
✅ Complete - All bass control functionality implemented and tested
GetBass()SetBass()Purpose: Retrieve current bass settings
Response Format:
<bass deviceID="ABCD1234EFGH">
<targetbass>3</targetbass>
<actualbass>3</actualbass>
</bass>
Fields:
targetbass - The desired bass level (-9 to +9)actualbass - The current actual bass level (may differ during adjustment)deviceID - Unique device identifierPurpose: Set bass level
Request Format:
<bass>5</bass>
Valid Range: -9 to +9
Response: HTTP 200 OK (no body) on success
import "github.com/gesellix/bose-soundtouch/pkg/client"
// Create client
config := client.ClientConfig{
Host: "192.168.1.100",
Port: 8090,
}
c := client.NewClient(config)
// Get current bass level
bass, err := c.GetBass()
if err != nil {
fmt.Printf("Failed to get bass: %v\n", err)
}
fmt.Printf("Bass Level: %d (%s)\n", bass.GetLevel(), bass.String())
// Set bass level
err = c.SetBass(3)
if err != nil {
fmt.Printf("Failed to set bass: %v\n", err)
}
// Get bass level information
bass, err := c.GetBass()
if err != nil {
return err
}
// Access bass level details
level := bass.GetLevel() // Target bass level
actual := bass.GetActualLevel() // Current actual level
isAtTarget := bass.IsAtTarget() // true if target == actual
// Bass categorization
isBoost := bass.IsBassBoost() // true if level > 0
isCut := bass.IsBassCut() // true if level < 0
isFlat := bass.IsFlat() // true if level == 0
// Human-readable descriptions
levelName := models.GetBassLevelName(level) // "Slightly High", "Very Low", etc.
category := models.GetBassLevelCategory(level) // "Bass Boost", "Bass Cut", "Flat"
// SetBassSafe automatically clamps values to valid range
err := c.SetBassSafe(15) // Will be clamped to +9
err = c.SetBassSafe(-15) // Will be clamped to -9
// Increment/decrement with automatic clamping
newBass, err := c.IncreaseBass(2) // Increase by 2, clamp if needed
newBass, err := c.DecreaseBass(1) // Decrease by 1, clamp if needed
import "github.com/gesellix/bose-soundtouch/pkg/models"
// Validate bass level before setting
if models.ValidateBassLevel(level) {
err := c.SetBass(level)
}
// Clamp to valid range
safeLevel := models.ClampBassLevel(100) // Returns +9
// Constants
fmt.Printf("Bass range: %d to %d\n", models.BassLevelMin, models.BassLevelMax) // -9 to 9
fmt.Printf("Default: %d\n", models.BassLevelDefault) // 0
# Get current bass level
soundtouch-cli -host 192.168.1.100 -bass
# Set specific bass level
soundtouch-cli -host 192.168.1.100 -set-bass 3
soundtouch-cli -host 192.168.1.100 -set-bass -5
# Increment/decrement bass
soundtouch-cli -host 192.168.1.100 -inc-bass 1
soundtouch-cli -host 192.168.1.100 -dec-bass 2
# Check current bass settings
soundtouch-cli -host 192.168.1.100 -bass
# Output: Bass Level: 0 (Neutral)
# Category: Flat
# Set bass boost
soundtouch-cli -host 192.168.1.100 -set-bass 6
# Output: ✓ Bass set to 6 (High)
# Reset to neutral
soundtouch-cli -host 192.168.1.100 -set-bass 0
# Output: ✓ Bass set to 0 (Neutral)
# Gradual bass adjustment
soundtouch-cli -host 192.168.1.100 -inc-bass 2
# Output: ✓ Bass increased to 2 (Slightly High)
| Flag | Description | Range | Default |
|---|---|---|---|
-bass |
Get current bass level | N/A | N/A |
-set-bass <level> |
Set bass level | -9 to +9 | N/A |
-inc-bass <amount> |
Increase bass | 1-3 | 1 |
-dec-bass <amount> |
Decrease bass | 1-3 | 1 |
-safe methods| Level | Name | Category | Description |
|---|---|---|---|
| -9 to -7 | Very Low | Bass Cut | Maximum bass reduction |
| -6 to -4 | Low | Bass Cut | Moderate bass reduction |
| -3 to -1 | Slightly Low | Bass Cut | Mild bass reduction |
| 0 | Neutral | Flat | No bass adjustment |
| 1 to 3 | Slightly High | Bass Boost | Mild bass enhancement |
| 4 to 6 | High | Bass Boost | Moderate bass enhancement |
| 7 to 9 | Very High | Bass Boost | Maximum bass enhancement |
For Different Music Genres:
For Different Environments:
func adjustBassForContent(client *client.Client, contentType string) error {
var targetBass int
switch contentType {
case "music":
targetBass = 3 // Moderate bass boost for music
case "podcast":
targetBass = -1 // Slight bass cut for voice clarity
case "movie":
targetBass = 5 // Strong bass for movie experience
default:
targetBass = 0 // Neutral for unknown content
}
return client.SetBass(targetBass)
}
type BassPreset struct {
Name string
Level int
}
var bassPresets = []BassPreset{
{"Flat", 0},
{"Voice", -2},
{"Music", 3},
{"Movies", 5},
{"Heavy", 7},
}
func applyBassPreset(client *client.Client, presetName string) error {
for _, preset := range bassPresets {
if preset.Name == presetName {
return client.SetBass(preset.Level)
}
}
return fmt.Errorf("preset not found: %s", presetName)
}
func gradualBassChange(client *client.Client, targetLevel int, stepSize int) error {
currentBass, err := client.GetBass()
if err != nil {
return err
}
current := currentBass.GetLevel()
for current != targetLevel {
var step int
if targetLevel > current {
step = min(stepSize, targetLevel-current)
_, err = client.IncreaseBass(step)
} else {
step = min(stepSize, current-targetLevel)
_, err = client.DecreaseBass(step)
}
if err != nil {
return err
}
// Update current level
currentBass, err = client.GetBass()
if err != nil {
return err
}
current = currentBass.GetLevel()
time.Sleep(200 * time.Millisecond) // Brief pause between adjustments
}
return nil
}
err := client.SetBass(15)
// Error: invalid bass level: 15 (must be between -9 and 9)
Solution: Use valid range (-9 to +9) or SetBassSafe() for auto-clamping.
soundtouch-cli -host 192.168.1.100 -bass
# Error: failed to get bass: API request failed with status 404
Solutions:
Some devices may:
Solutions:
soundtouch-cli -host <ip> -bass
soundtouch-cli -host <ip> -set-bass 0 # Reset to neutral
soundtouch-cli -host <ip> -set-bass 1 # Small positive adjustment
soundtouch-cli -host <ip> -bass # Verify change
soundtouch-cli -host <ip> -set-bass 15 # Should fail validation
soundtouch-cli -host <ip> -set-bass -15 # Should fail validation
Run bass control tests:
go test ./pkg/models -v -run ".*Bass.*"
go test ./pkg/client -v -run ".*Bass.*"
Test with real hardware:
SOUNDTOUCH_TEST_HOST=192.168.1.100 go test ./pkg/client -v -run ".*Bass.*Integration.*"
# Complete bass control test sequence
soundtouch-cli -discover
soundtouch-cli -host <discovered-ip> -bass
soundtouch-cli -host <discovered-ip> -set-bass 3
soundtouch-cli -host <discovered-ip> -inc-bass 1
soundtouch-cli -host <discovered-ip> -dec-bass 2
soundtouch-cli -host <discovered-ip> -bass # Verify final state
The implementation follows the official SoundTouch API:
<bass>level</bass> structure for requests<bass><targetbass> and <actualbass> in responsesapplication/xml headersImplementation Date: 2026-01-09
Status: ✅ Complete and tested
Real Device Validation: SoundTouch 10, SoundTouch 20
API Compliance: Full compliance with SoundTouch Web API specification