Skip to content
Open
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
11 changes: 6 additions & 5 deletions Fruit_Jam/Fruit_Jam_Spell_Jam/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
# initialize Fruit Jam built-in hardware
fj = FruitJam()
fj.neopixels.brightness = 0.1
fj.peripherals.volume = 9
fj.peripherals.volume = 0.5
vol_int = 50

# AWS auth requires us to have accurate date/time
now = fj.sync_time()
Expand Down Expand Up @@ -119,13 +120,13 @@ def say_and_spell_lastword():
say_and_spell_lastword()
elif c.encode("utf-8") == b"\x1b[B":
# down arrow
fj.peripherals.volume = max(1, fj.peripherals.volume - 1)
vol_int = max(0, vol_int - 5)
fj.peripherals.volume = vol_int / 100
print(f"Volume: {fj.peripherals.volume}")
elif c.encode("utf-8") == b"\x1b[A":
# up arrow
fj.peripherals.volume = min(
fj.peripherals.safe_volume_limit, fj.peripherals.volume + 1
)
vol_int = min(fj.peripherals.safe_volume_limit * 100, vol_int + 5)
fj.peripherals.volume = vol_int / 100
print(f"Volume: {fj.peripherals.volume}")
else:
print(f"unused key: {c.encode('utf-8')}")
12 changes: 6 additions & 6 deletions Fruit_Jam/Larsio_Paint_Music/sound_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def __init__(self, audio_output="pwm", seconds_per_eighth=0.25):
# Initialize TLV320
fjPeriphs = adafruit_fruitjam.Peripherals(
audio_output=launcher_config["audio"].get("output", "headphone"),
safe_volume_limit=launcher_config["audio"].get("volume_override_danger",12),
safe_volume_limit=
launcher_config["audio"].get("volume_override_danger",.75),
sample_rate=11025,
bit_depth=16,
i2c=board.STEMMA_I2C()
Expand All @@ -103,7 +104,8 @@ def __init__(self, audio_output="pwm", seconds_per_eighth=0.25):
# Initialize TLV320
fjPeriphs = adafruit_fruitjam.Peripherals(
audio_output=launcher_config["audio"].get("output", "headphone"),
safe_volume_limit=launcher_config["audio"].get("volume_override_danger",12),
safe_volume_limit=
launcher_config["audio"].get("volume_override_danger",.75),
sample_rate=11025,
bit_depth=16,
i2c=board.I2C()
Expand All @@ -112,10 +114,8 @@ def __init__(self, audio_output="pwm", seconds_per_eighth=0.25):
self.tlv = fjPeriphs.dac

# If volume was specified use it, otherwise use the fruitjam library default
if "volume_override_danger" in launcher_config["audio"]:
fjPeriphs.volume = launcher_config["audio"]["volume_override_danger"]
elif "volume" in launcher_config["audio"]:
fjPeriphs.volume = launcher_config["audio"]["volume"] # FruitJam vol (1-20)
if "volume" in launcher_config["audio"]:
fjPeriphs.volume = launcher_config["audio"]["volume"] # FruitJam vol 0.0-1.0

# Setup I2S audio output - important to do this AFTER configuring the DAC
# Fruitjam library actually does this before we modify the configuration
Expand Down
8 changes: 3 additions & 5 deletions Metro/Metro_RP2350_Chips_Challenge/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

fjPeriphs = adafruit_fruitjam.Peripherals.Peripherals(
audio_output=launcher_config["audio"].get("output", "headphone"),
safe_volume_limit=launcher_config["audio"].get("volume_override_danger",12),
safe_volume_limit=launcher_config["audio"].get("volume_override_danger",.75),
sample_rate=44100,
bit_depth=16,
i2c=board.I2C()
Expand All @@ -61,10 +61,8 @@
fjPeriphs.audio = audiobusio.I2SOut(board.D9, board.D10, board.D11)

# If volume was specified use it, otherwise use the fruitjam library default
if "volume_override_danger" in launcher_config["audio"]:
fjPeriphs.volume = launcher_config["audio"]["volume_override_danger"]
elif "volume" in launcher_config["audio"]:
fjPeriphs.volume = launcher_config["audio"]["volume"] # FruitJam vol (1-20)
if "volume" in launcher_config["audio"]:
fjPeriphs.volume = launcher_config["audio"]["volume"] # FruitJam vol 0.0-1.0

if fjPeriphs.audio is not None:
audio = Audio(fjPeriphs.audio, SOUND_EFFECTS)
Expand Down