Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions examples/fruitjam_headphone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 Tim Cocks for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time

import adafruit_fruitjam

pobj = adafruit_fruitjam.peripherals.Peripherals()
dac = pobj.dac # use Fruit Jam's codec

# Route once for headphones
dac.headphone_output = True
dac.speaker_output = False

FILES = ["beep.wav", "dip.wav", "rise.wav"]
VOLUMES_DB = [12, 6, 0, -6, -12]

while True:
print("\n=== Headphones Test ===")
for vol in VOLUMES_DB:
dac.dac_volume = vol
print(f"Headphones volume: {vol} dB")
for f in FILES:
print(f" -> {f}")
pobj.play_file(f)
time.sleep(0.2)
time.sleep(1.0)
27 changes: 27 additions & 0 deletions examples/fruitjam_speaker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 Tim Cocks for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time

import adafruit_fruitjam

pobj = adafruit_fruitjam.peripherals.Peripherals()
dac = pobj.dac # use Fruit Jam's codec

# Route once for speaker
dac.headphone_output = False
dac.speaker_output = True

FILES = ["beep.wav", "dip.wav", "rise.wav"]
VOLUMES_DB = [12, 6, 0, -6, -12]

while True:
print("\n=== Speaker Test ===")
for vol in VOLUMES_DB:
dac.dac_volume = vol
print(f"Speaker volume: {vol} dB")
for f in FILES:
print(f" -> {f}")
pobj.play_file(f)
time.sleep(0.2)
time.sleep(1.0)
Binary file added examples/wav/beep.wav
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/wav/beep.wav.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 Adafruit Industries
#
# SPDX-License-Identifier: CC-BY-4.0
Binary file added examples/wav/dip.wav
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/wav/dip.wav.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 Adafruit Industries
#
# SPDX-License-Identifier: CC-BY-4.0
Binary file added examples/wav/rise.wav
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/wav/rise.wav.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 Adafruit Industries
#
# SPDX-License-Identifier: CC-BY-4.0