Spaces:
Running
Running
update copy
Browse files
app.py
CHANGED
@@ -129,13 +129,34 @@ def piano_music_demo():
|
|
129 |
secondary_piece=piece_b,
|
130 |
)
|
131 |
|
132 |
-
st.write("#### Music generation
|
133 |
st.write("""
|
134 |
-
Here's how to
|
135 |
-
We can
|
136 |
-
This
|
|
|
137 |
""")
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
df = piece.df.copy()
|
140 |
|
141 |
ids = df.pitch < 72
|
|
|
129 |
secondary_piece=piece_b,
|
130 |
)
|
131 |
|
132 |
+
st.write("#### Music generation")
|
133 |
st.write("""
|
134 |
+
Here's how to show the results of a generative algorithm designed to respond to a musical input prompt.
|
135 |
+
We can use notes with pitches below 72 (C5) as the prompt and display them alongside the generated output.
|
136 |
+
This example performs a random shuffle of note pitch values, so the results are not musically appealing
|
137 |
+
(your algorithms should produce better results).
|
138 |
""")
|
139 |
|
140 |
+
code = """
|
141 |
+
df = piece.df.copy()
|
142 |
+
|
143 |
+
ids = df.pitch < 72
|
144 |
+
|
145 |
+
prompt_df = df[ids].copy()
|
146 |
+
prompt_piece = MidiPiece(df=part_a)
|
147 |
+
|
148 |
+
# Use your implementation here
|
149 |
+
generated_df = music_generation_algorithm(prompt_df)
|
150 |
+
|
151 |
+
generated_piece = MidiPiece(df=generated_df)
|
152 |
+
|
153 |
+
streamlit_pianoroll.from_fortepyan(
|
154 |
+
piece=prompt_piece,
|
155 |
+
secondary_piece=generated_piece,
|
156 |
+
)
|
157 |
+
"""
|
158 |
+
st.code(code, language="python")
|
159 |
+
|
160 |
df = piece.df.copy()
|
161 |
|
162 |
ids = df.pitch < 72
|