Skip to content

Commit 776410b

Browse files
Comments
1 parent b2f441a commit 776410b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

internal_filesystem/lib/mpos/audio/audioflinger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
_i2s_pins = None # I2S pin configuration dict (created per-stream)
1919
_buzzer_instance = None # PWM buzzer instance
2020
_current_stream = None # Currently playing stream
21-
_volume = 25 # System volume (0-100)
21+
_volume = 50 # System volume (0-100)
2222
_stream_lock = None # Thread lock for stream management
2323

2424

internal_filesystem/lib/mpos/audio/stream_wav.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def play(self):
372372
# with optimized volume scaling:
373373
# 6144 => audio stutters and quasibird at ~17fps
374374
# 7168 => audio slightly stutters and quasibird at ~16fps
375-
# 8192 => no audio stutters and quasibird runs at ~15fps
375+
# 8192 => no audio stutters and quasibird runs at ~15-17fps => this is probably best
376376
# with shift volume scaling:
377377
# 6144 => audio slightly stutters and quasibird at ~16fps?!
378378
# 8192 => no audio stutters, quasibird runs at ~13fps?!
@@ -412,8 +412,12 @@ def play(self):
412412
raw = self._upsample_buffer(raw, upsample_factor)
413413

414414
# 3. Volume scaling
415-
shift = 16 - int(self.volume / 6.25)
416-
_scale_audio_powers_of_2(raw, len(raw), shift)
415+
#shift = 16 - int(self.volume / 6.25)
416+
#_scale_audio_powers_of_2(raw, len(raw), shift)
417+
scale = self.volume / 100.0
418+
if scale < 1.0:
419+
scale_fixed = int(scale * 32768)
420+
_scale_audio_optimized(raw, len(raw), scale_fixed)
417421

418422
# 4. Output to I2S
419423
if self._i2s:

0 commit comments

Comments
 (0)