import numpy as np | |
import gradio as gr | |
from scipy.io import wavfile | |
notes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"] | |
def generate_tone(note, octave, duration): | |
wav_file_path = "14763.wav" | |
sr, audio_data = wavfile.read(wav_file_path) | |
return sr, audio_data | |
demo = gr.Interface( | |
generate_tone, | |
[ | |
gr.Dropdown(notes, type="index"), | |
gr.Slider(4, 6, step=1), | |
gr.Textbox(value=1, label="Duration in seconds"), | |
], | |
"audio", | |
) | |
if __name__ == "__main__": | |
demo.launch() |