Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,10 @@ import gradio as gr
|
|
| 4 |
notes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
|
| 5 |
|
| 6 |
def generate_tone(note, octave, duration):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
audio = np.linspace(0, duration, duration * sr)
|
| 12 |
-
audio = (20000 * np.sin(audio * (2 * np.pi * frequency))).astype(np.int16)
|
| 13 |
-
return sr, audio
|
| 14 |
|
| 15 |
demo = gr.Interface(
|
| 16 |
generate_tone,
|
|
@@ -19,7 +16,7 @@ demo = gr.Interface(
|
|
| 19 |
gr.Slider(4, 6, step=1),
|
| 20 |
gr.Textbox(value=1, label="Duration in seconds"),
|
| 21 |
],
|
| 22 |
-
"
|
| 23 |
)
|
| 24 |
if __name__ == "__main__":
|
| 25 |
demo.launch()
|
|
|
|
| 4 |
notes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
|
| 5 |
|
| 6 |
def generate_tone(note, octave, duration):
|
| 7 |
+
wav_file_path = "14763.wav"
|
| 8 |
+
sr, audio_data = wavfile.read(wav_file_path)
|
| 9 |
+
|
| 10 |
+
return wav_file_path
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
demo = gr.Interface(
|
| 13 |
generate_tone,
|
|
|
|
| 16 |
gr.Slider(4, 6, step=1),
|
| 17 |
gr.Textbox(value=1, label="Duration in seconds"),
|
| 18 |
],
|
| 19 |
+
"text",
|
| 20 |
)
|
| 21 |
if __name__ == "__main__":
|
| 22 |
demo.launch()
|