Spaces:
Sleeping
Sleeping
File size: 939 Bytes
3d7f8a1 a759efd 3d7f8a1 a759efd 3d7f8a1 a759efd 3d7f8a1 a759efd 3d7f8a1 a759efd 3d7f8a1 a759efd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
from music21 import converter
def process_musicxml(file):
score = converter.parse(file.name)
notes = [str(n.pitch) for n in score.flat.notes if n.isNote]
unique_notes = sorted(set(notes))
study_plan = {
"Scales": {
"All Notes": unique_notes,
"Suggested Practice": [f"{note} Major Scale" for note in unique_notes]
},
"Practice Exercises": {
"Sight Reading (4-note chunks)": [notes[i:i+4] for i in range(0, len(notes)-3, 4)],
"Finger Exercises": [f"{note} Arpeggio" for note in unique_notes]
}
}
return study_plan
gr.Interface(
fn=process_musicxml,
inputs=gr.File(file_types=[".musicxml", ".xml"], label="Upload MusicXML File"),
outputs=gr.JSON(label="Study Plan"),
title="🎼 MusicXML Study Generator",
description="Upload a MusicXML file to generate scales and practice routines."
).launch() |