Fix oscilloscope — overwrite in place instead of scrolling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 01:25:19 -04:00
parent ebb6067e53
commit e5e0093dc9
+2 -5
View File
@@ -291,9 +291,7 @@ def play_audio(buf, sample_rate, title="", info_lines=None, offset_sec=0.0):
print()
print(" [+/f] +5s [-/s] -5s [d] +30s [a] -30s [space] pause [n] next [p] prev [q] quit")
print()
print() # blank lines for oscilloscope + whitespace + progress
print()
print()
print() # scope line + progress line
stream = sd.OutputStream(
samplerate=sample_rate,
@@ -363,8 +361,7 @@ def play_audio(buf, sample_rate, title="", info_lines=None, offset_sec=0.0):
else:
scope = "\033[90m" + "" * scope_w + "\033[0m"
sys.stderr.write(f"\033[3A\r\n {scope}\n\n")
sys.stderr.write(f"\r {icon} {cur_m}:{cur_s:02d} / {tot_m}:{tot_s:02d} {bar} \n")
sys.stderr.write(f"\033[2A\r {scope} \r\n\n\r {icon} {cur_m}:{cur_s:02d} / {tot_m}:{tot_s:02d} {bar} ")
sys.stderr.flush()
# Non-blocking single char read