File size: 538 Bytes
7700c61
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from __future__ import annotations
import streamlit.components.v1 as components
from sim.notation_svg import grand_staff_svg

def notation_staff(chord_midi, prefer_sharps: bool = True):
    """
    Offline notation renderer (no CDN).
    Generates an SVG grand staff for the chord and embeds it via components.html.
    """
    svg = grand_staff_svg(list(chord_midi), prefer_sharps=prefer_sharps)
    nonce = "_".join(str(int(x)) for x in chord_midi)
    components.html(svg + f"<!-- vf_offline_{nonce} -->", height=270, scrolling=False)