File size: 542 Bytes
455c922 57d76c0 455c922 52dc6f4 42acf0b 52dc6f4 42acf0b 455c922 5f338c5 455c922 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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() |