Skip to content

Commit ffd9c8f

Browse files
Update main.py
1 parent 339d137 commit ffd9c8f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ def find_loudest_freq_index_in_bucket(slice_index: int, bucket_index: int) -> in
106106
print(f"{bucket:>16}", end="")
107107
print()
108108

109-
sound_instruction_buffers = ["hex`"] * len(frequency_buckets)
109+
# Start with empty buffers instead of "hex`"
110+
sound_instruction_buffers = ["" for _ in range(len(frequency_buckets))]
111+
110112
for slice_index in range(len(loudest_frequencies)):
111113
if debug_output:
112114
print(f"{slice_index:<6}", end="")
@@ -126,9 +128,11 @@ def find_loudest_freq_index_in_bucket(slice_index: int, bucket_index: int) -> in
126128
print("0 Hz 0 amp".rjust(16), end="")
127129
if debug_output:
128130
print()
129-
sound_instruction_buffers = [buffer + "`" for buffer in sound_instruction_buffers]
130131

131-
# TypeScript output (no f-strings to avoid syntax errors)
132+
# Properly wrap in hex`...`
133+
sound_instruction_buffers = [f"hex`{buffer}`" for buffer in sound_instruction_buffers]
134+
135+
# TypeScript output
132136
code = (
133137
"namespace music {\n"
134138
" //% shim=music::playInstructions\n"

0 commit comments

Comments
 (0)