File size: 638 Bytes
e701383
a2df844
 
e701383
a01aab6
 
e701383
a01aab6
 
 
 
 
 
a2df844
be3a34b
a2df844
a01aab6
 
e701383
a01aab6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import parselmouth
from parselmouth.praat import call

# def greet(name):
#     return "Hello " + name + "!!"

# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# demo.launch()


def get_pitch(audio_file):
    sound = parselmouth.Sound(audio_file)
    pitch = call(sound, "To Pitch", 0.0, 75, 500)  # Make sure these settings are appropriate for your needs
    pitch_values = pitch.selected_array['frequency']
    return "Pitch frequencies: " + str(pitch_values)  # Printing is not suitable here, return the string instead

demo = gr.Interface(fn=get_pitch, inputs="audio", outputs="text")
demo.launch()