From e5e0093dc97c4b9eed2c53396ae2866d198d4218 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 4 Apr 2026 01:25:19 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20oscilloscope=20=E2=80=94=20overwrite=20in?= =?UTF-8?q?=20place=20instead=20of=20scrolling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- play.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/play.py b/play.py index a437826..f06b314 100644 --- a/play.py +++ b/play.py @@ -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