Commit 27e77713 authored by NaweenTharuka's avatar NaweenTharuka

feat: prosody detetction

parent 4c95c94a
import parselmouth
from parselmouth.praat import call, run_file
import glob
import pandas as pd
import numpy as np
import scipy
from scipy.stats import binom
from scipy.stats import ks_2samp
from scipy.stats import ttest_ind
import os
def run_praat_file(m, p):
"""
p : path to dataset folder
m : path to file
returns : objects outputed by the praat script
"""
sound=p+r"\\"+r"dataset"+r"\\"+r"audioFiles"+r"\\"+m+r".wav"
sourcerun=p+r"\\"+r"dataset"+r"\\"+r"essen"+r"\\"+r"myspsolution.praat"
path=p+r"\\"+r"dataset"+"\\"+r"audioFiles"+r"\\"
assert os.path.isfile(sound), "Wrong path to audio file"
assert os.path.isfile(sourcerun), "Wrong path to praat script"
assert os.path.isdir(path), "Wrong path to audio files"
try:
objects= run_file(sourcerun, -20, 2, 0.3, "yes",sound,path, 80, 400, 0.01, capture_output=True)
print (objects[0]) # This will print the info from the sound object, and objects[0] is a parselmouth.Sound object
z1=str( objects[1]) # This will print the info from the textgrid object, and objects[1] is a parselmouth.Data object with a TextGrid inside
z2=z1.strip().split()
return z2
except:
z3 = 0
print ("Try again the sound of the audio was not clear")
def myspsyl(m,p):
"""
Detect and count number of syllables
"""
z2 = run_praat_file(m, p)
z3=int(z2[0]) # will be the integer number 10
z4=float(z2[3]) # will be the floating point number 8.3
print ("number_ of_syllables=",z3)
return z3
def mysppaus(m,p):
"""
Detect and count number of fillers and pauses
"""
z2 = run_praat_file(m, p)
z3=int(z2[1]) # will be the integer number 10
z4=float(z2[3]) # will be the floating point number 8.3
print ("number_of_pauses=",z3)
return z3
def myspsr(m,p):
"""
Measure the rate of speech (speed)
"""
z2 = run_praat_file(m, p)
z3=int(z2[2]) # will be the integer number 10
z4=float(z2[3]) # will be the floating point number 8.3
print ("rate_of_speech=",z3,"# syllables/sec original duration")
return z3
def myspatc(m,p):
"""
Measure the articulation (speed)
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[3]) # will be the floating point number 8.3
print ("articulation_rate=",z3,"# syllables/sec speaking duration")
return z3
def myspst(m,p):
"""
Measure speaking time (excl. fillers and pause)
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[4]) # will be the floating point number 8.3
print ("speaking_duration=",z4,"# sec only speaking duration without pauses")
return z4
def myspod(m,p):
"""
Measure total speaking duration (inc. fillers and pauses)
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[5]) # will be the floating point number 8.3
print ("original_duration=",z4,"# sec total speaking duration with pauses")
return z4
def myspbala(m,p):
"""
Measure ratio between speaking duration and total speaking duration
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[6]) # will be the floating point number 8.3
print ("balance=",z4,"# ratio (speaking duration)/(original duration)")
return z4
def myspf0mean(m,p):
"""
Measure fundamental frequency distribution mean
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[7]) # will be the floating point number 8.3
print ("f0_mean=",z4,"# Hz global mean of fundamental frequency distribution")
return z4
def myspf0sd(m,p):
"""
Measure fundamental frequency distribution SD
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[8]) # will be the floating point number 8.3
print ("f0_SD=",z4,"# Hz global standard deviation of fundamental frequency distribution")
return z4
def myspf0med(m,p):
"""
Measure fundamental frequency distribution median
"""
z2 = run_praat_file(m, p)
z3=int(z2[3]) # will be the integer number 10
z4=float(z2[9]) # will be the floating point number 8.3
print ("f0_MD=",z4,"# Hz global median of fundamental frequency distribution")
return z4
def myspf0min(m,p):
"""
Measure fundamental frequency distribution minimum
"""
z2 = run_praat_file(m, p)
z3=int(z2[10]) # will be the integer number 10
z4=float(z2[10]) # will be the floating point number 8.3
print ("f0_min=",z3,"# Hz global minimum of fundamental frequency distribution")
return z3
def myspf0max(m,p):
"""
Measure fundamental frequency distribution maximum
"""
z2 = run_praat_file(m, p)
z3=int(z2[11]) # will be the integer number 10
z4=float(z2[11]) # will be the floating point number 8.3
print ("f0_max=",z3,"# Hz global maximum of fundamental frequency distribution")
return z3
def myspf0q25(m,p):
"""
Measure 25th quantile fundamental frequency distribution
"""
z2 = run_praat_file(m, p)
z3=int(z2[12]) # will be the integer number 10
z4=float(z2[11]) # will be the floating point number 8.3
print ("f0_quan25=",z3,"# Hz global 25th quantile of fundamental frequency distribution")
return z3
def myspf0q75(m,p):
"""
Measure 75th quantile fundamental frequency distribution
"""
z2 = run_praat_file(m, p)
z3=int(z2[13]) # will be the integer number 10
z4=float(z2[11]) # will be the floating point number 8.3
print ("f0_quan75=",z3,"# Hz global 75th quantile of fundamental frequency distribution")
return z3
def mysptotal(m,p):
"""
Overview
"""
z2 = run_praat_file(m, p)
z3=np.array(z2)
z4=np.array(z3)[np.newaxis]
z5=z4.T
dataset=pd.DataFrame({"number_ of_syllables":z5[0,:],"number_of_pauses":z5[1,:],"rate_of_speech":z5[2,:],"articulation_rate":z5[3,:],"speaking_duration":z5[4,:],
"original_duration":z5[5,:],"balance":z5[6,:],"f0_mean":z5[7,:],"f0_std":z5[8,:],"f0_median":z5[9,:],"f0_min":z5[10,:],"f0_max":z5[11,:],
"f0_quantile25":z5[12,:],"f0_quan75":z5[13,:]})
print (dataset.T)
return dataset.T
def mysppron(m,p):
"""
Pronunciation posteriori probability score percentage
"""
sound=p+"/"+"dataset"+"/"+"audioFiles"+"/"+m+".wav"
sourcerun=p+"/"+"dataset"+"/"+"essen"+"/"+"myspsolution.praat"
path=p+"/"+"dataset"+"/"+"audioFiles"+"/"
try:
objects= run_file(sourcerun, -20, 2, 0.3, "yes",sound,path, 80, 400, 0.01, capture_output=True)
print (objects[0]) # This will print the info from the sound object, and objects[0] is a parselmouth.Sound object
z1=str( objects[1]) # This will print the info from the textgrid object, and objects[1] is a parselmouth.Data object with a TextGrid inside
z2=z1.strip().split()
z3=int(z2[13]) # will be the integer number 10
z4=float(z2[14]) # will be the floating point number 8.3
db= binom.rvs(n=10,p=z4,size=10000)
a=np.array(db)
b=np.mean(a)*100/10
print ("Pronunciation_posteriori_probability_score_percentage= :%.2f" % (b))
except:
print ("Try again the sound of the audio was not clear")
return
def myspgend(m,p):
"""
Gender recognition and mood of speech
"""
sound=p+"/"+"dataset"+"/"+"audioFiles"+"/"+m+".wav"
sourcerun=p+"/"+"dataset"+"/"+"essen"+"/"+"myspsolution.praat"
path=p+"/"+"dataset"+"/"+"audioFiles"+"/"
try:
objects= run_file(sourcerun, -20, 2, 0.3, "yes",sound,path, 80, 400, 0.01, capture_output=True)
print (objects[0]) # This will print the info from the sound object, and objects[0] is a parselmouth.Sound object
z1=str( objects[1]) # This will print the info from the textgrid object, and objects[1] is a parselmouth.Data object with a TextGrid inside
z2=z1.strip().split()
z3=float(z2[8]) # will be the integer number 10
z4=float(z2[7]) # will be the floating point number 8.3
if z4<=114:
g=101
j=3.4
elif z4>114 and z4<=135:
g=128
j=4.35
elif z4>135 and z4<=163:
g=142
j=4.85
elif z4>163 and z4<=197:
g=182
j=2.7
elif z4>197 and z4<=226:
g=213
j=4.5
elif z4>226:
g=239
j=5.3
else:
print("Voice not recognized")
exit()
def teset(a,b,c,d):
d1=np.random.wald(a, 1, 1000)
d2=np.random.wald(b,1,1000)
d3=ks_2samp(d1, d2)
c1=np.random.normal(a,c,1000)
c2=np.random.normal(b,d,1000)
c3=ttest_ind(c1,c2)
y=([d3[0],d3[1],abs(c3[0]),c3[1]])
return y
nn=0
mm=teset(g,j,z4,z3)
while (mm[3]>0.05 and mm[0]>0.04 or nn<5):
mm=teset(g,j,z4,z3)
nn=nn+1
nnn=nn
if mm[3]<=0.09:
mmm=mm[3]
else:
mmm=0.35
if z4>97 and z4<=114:
print("a Male, mood of speech: Showing no emotion, normal, p-value/sample size= :%.2f" % (mmm), (nnn))
elif z4>114 and z4<=135:
print("a Male, mood of speech: Reading, p-value/sample size= :%.2f" % (mmm), (nnn))
elif z4>135 and z4<=163:
print("a Male, mood of speech: speaking passionately, p-value/sample size= :%.2f" % (mmm), (nnn))
elif z4>163 and z4<=197:
print("a female, mood of speech: Showing no emotion, normal, p-value/sample size= :%.2f" % (mmm), (nnn))
elif z4>197 and z4<=226:
print("a female, mood of speech: Reading, p-value/sample size= :%.2f" % (mmm), (nnn))
elif z4>226 and z4<=245:
print("a female, mood of speech: speaking passionately, p-value/sample size= :%.2f" % (mmm), (nnn))
else:
print("Voice not recognized")
except:
print ("Try again the sound of the audio was not clear")
def myprosody(m,p):
"""
Compared to native speech, here are the prosodic features of your speech
"""
sound=p+"/"+"dataset"+"/"+"audioFiles"+"/"+m+".wav"
sourcerun=p+"/"+"dataset"+"/"+"essen"+"/"+"MLTRNL.praat"
path=p+"/"+"dataset"+"/"+"audioFiles"+"/"
outo=p+"/"+"dataset"+"/"+"datanewchi22.csv"
outst=p+"/"+"dataset"+"/"+"datanewchi44.csv"
outsy=p+"/"+"dataset"+"/"+"datanewchi33.csv"
pa2=p+"/"+"dataset"+"/"+"stats.csv"
pa7=p+"/"+"dataset"+"/"+"datanewchi44.csv"
result_array = np.empty((0, 100))
files = glob.glob(path)
result_array = np.empty((0, 27))
try:
objects= run_file(sourcerun, -20, 2, 0.3, "yes",sound,path, 80, 400, 0.01, capture_output=True)
z1=( objects[1]) # This will print the info from the textgrid object, and objects[1] is a parselmouth.Data object with a TextGrid inside
z3=z1.strip().split()
z2=np.array([z3])
result_array=np.append(result_array,[z3], axis=0)
#print(z3)
np.savetxt(outo,result_array, fmt='%s',delimiter=',')
#Data and features analysis
df = pd.read_csv(outo,
names = ['avepauseduratin','avelongpause','speakingtot','avenumberofwords','articulationrate','inpro','f1norm','mr','q25',
'q50','q75','std','fmax','fmin','vowelinx1','vowelinx2','formantmean','formantstd','nuofwrds','npause','ins',
'fillerratio','xx','xxx','totsco','xxban','speakingrate'],na_values='?')
scoreMLdataset=df.drop(['xxx','xxban'], axis=1)
scoreMLdataset.to_csv(outst, header=False,index = False)
newMLdataset=df.drop(['avenumberofwords','f1norm','inpro','q25','q75','vowelinx1','nuofwrds','npause','xx','totsco','xxban','speakingrate','fillerratio'], axis=1)
newMLdataset.to_csv(outsy, header=False,index = False)
namess=nms = ['avepauseduratin','avelongpause','speakingtot','articulationrate','mr',
'q50','std','fmax','fmin','vowelinx2','formantmean','formantstd','ins',
'xxx']
df1 = pd.read_csv(outsy, names = namess)
nsns=['average_syll_pause_duration','No._long_pause','speaking_time','ave_No._of_words_in_minutes','articulation_rate','No._words_in_minutes','formants_index','f0_index','f0_quantile_25_index',
'f0_quantile_50_index','f0_quantile_75_index','f0_std','f0_max','f0_min','No._detected_vowel','perc%._correct_vowel','(f2/f1)_mean','(f2/f1)_std',
'no._of_words','no._of_pauses','intonation_index',
'(voiced_syll_count)/(no_of_pause)','TOEFL_Scale_Score','Score_Shannon_index','speaking_rate']
dataframe = pd.read_csv(pa2)
df55 = pd.read_csv(outst,names=nsns)
dataframe=dataframe.values
array = df55.values
print("Compared to native speech, here are the prosodic features of your speech:")
for i in range(25):
sl0=dataframe[4:7:1,i+1]
score = array[0,i]
he=scipy.stats.percentileofscore(sl0, score, kind='strict')
if he==0:
he=25
dfout = "%s:\t %f (%s)" % (nsns[i],he,"% percentile ")
print(dfout)
elif he>=25 and he<=75:
dfout = "%s:\t %f (%s)" % (nsns[i],he,"% percentile ")
print(dfout)
else:
dfout = "%s:\t (%s)" % (nsns[i],":Out of Range")
print(dfout)
except:
print ("Try again the sound of the audio was not clear")
def mysplev(m,p):
import sys
def my_except_hook(exctype, value, traceback):
print('There has been an error in the system')
sys.excepthook = my_except_hook
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
sound=p+"/"+"dataset"+"/"+"audioFiles"+"/"+m+".wav"
sourcerun=p+"/"+"dataset"+"/"+"essen"+"/"+"MLTRNL.praat"
path=p+"/"+"dataset"+"/"+"audioFiles"+"/"
pa1=p+"/"+"dataset"+"/"+"datanewchi23.csv"
pa7=p+"/"+"dataset"+"/"+"datanewchi45.csv"
pa5=p+"/"+"dataset"+"/"+"datanewchi34.csv"
result_array = np.empty((0, 100))
ph = sound
files = glob.glob(ph)
result_array = np.empty((0, 27))
try:
for soundi in files:
objects= run_file(sourcerun, -20, 2, 0.3, "yes", soundi, path, 80, 400, 0.01, capture_output=True)
#print (objects[0]) # This will print the info from the sound object, and objects[0] is a parselmouth.Sound object
z1=( objects[1]) # This will print the info from the textgrid object, and objects[1] is a parselmouth.Data object with a TextGrid inside
z3=z1.strip().split()
z2=np.array([z3])
result_array=np.append(result_array,[z3], axis=0)
np.savetxt(pa1,result_array, fmt='%s',delimiter=',')
#Data and features analysis
df = pd.read_csv(pa1, names = ['avepauseduratin','avelongpause','speakingtot','avenumberofwords','articulationrate','inpro','f1norm','mr','q25',
'q50','q75','std','fmax','fmin','vowelinx1','vowelinx2','formantmean','formantstd','nuofwrds','npause','ins',
'fillerratio','xx','xxx','totsco','xxban','speakingrate'],na_values='?')
scoreMLdataset=df.drop(['xxx','xxban'], axis=1)
scoreMLdataset.to_csv(pa7, header=False,index = False)
newMLdataset=df.drop(['avenumberofwords','f1norm','inpro','q25','q75','vowelinx1','nuofwrds','npause','xx','totsco','xxban','speakingrate','fillerratio'], axis=1)
newMLdataset.to_csv(pa5, header=False,index = False)
namess=nms = ['avepauseduratin','avelongpause','speakingtot','articulationrate','mr',
'q50','std','fmax','fmin','vowelinx2','formantmean','formantstd','ins',
'xxx']
df1 = pd.read_csv(pa5,
names = namess)
df33=df1.drop(['xxx'], axis=1)
array = df33.values
array=np.log(array)
x = array[:,0:13]
def myspp(bp,bg):
sound=bg+"/"+"dataset"+"/"+"audioFiles"+"/"+bp+".wav"
sourcerun=bg+"/"+"dataset"+"/"+"essen"+"/"+"myspsolution.praat"
path=bg+"/"+"dataset"+"/"+"audioFiles"+"/"
objects= run_file(sourcerun, -20, 2, 0.3, "yes",sound,path, 80, 400, 0.01, capture_output=True)
print (objects[0]) # This will print the info from the sound object, and objects[0] is a parselmouth.Sound object
z1=str( objects[1]) # This will print the info from the textgrid object, and objects[1] is a parselmouth.Data object with a TextGrid inside
z2=z1.strip().split()
z3=int(z2[13]) # will be the integer number 10
z4=float(z2[14]) # will be the floating point number 8.3
db= binom.rvs(n=10,p=z4,size=10000)
a=np.array(db)
b=np.mean(a)*100/10
return b
bp=m
bg=p
bi=myspp(bp,bg)
if bi<85:
input("Try again, unnatural-sounding speech detected. No further result. Press any key to exit.")
exit()
filename=p+"/"+"dataset"+"/"+"essen"+"/"+"CART_model.sav"
model = pickle.load(open(filename, 'rb'))
predictions = model.predict(x)
print("58% accuracy ",predictions)
filename=p+"/"+"dataset"+"/"+"essen"+"/"+"KNN_model.sav"
model = pickle.load(open(filename, 'rb'))
predictions = model.predict(x)
print("65% accuracy ",predictions)
filename=p+"/"+"dataset"+"/"+"essen"+"/"+"LDA_model.sav"
model = pickle.load(open(filename, 'rb'))
predictions = model.predict(x)
print("70% accuracy ",predictions)
filename=p+"/"+"dataset"+"/"+"essen"+"/"+"LR_model.sav"
model = pickle.load(open(filename, 'rb'))
predictions = model.predict(x)
print("67% accuracy ",predictions)
filename=p+"/"+"dataset"+"/"+"essen"+"/"+"NB_model.sav"
model = pickle.load(open(filename, 'rb'))
predictions = model.predict(x)
print("64% accuracy ",predictions)
filename=p+"/"+"dataset"+"/"+"essen"+"/"+"SVN_model.sav"
model = pickle.load(open(filename, 'rb'))
predictions = model.predict(x)
print("63% accuracy ",predictions)
except:
print ("Try again the sound of the audio was not clear")
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
###########################################################################
# #
# Praat Script Spoken Communication Proficiency Test #
# Copyright (C) 2017 Shahab Sabahi #
# #
# This program is a Mysol software intellectual property: #
# you can redistribute it and/or modify it under the terms #
# of the Mysol Permision. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# #
###########################################################################
#
# modified 2017.05.26 by Shahab Sabahi,
# Overview of changes:
# + change threshold-calculator: rather than using median, use the almost maximum
# minus 25dB. (25 dB is in line with the standard setting to detect silence
# in the "To TextGrid (silences)" function.
# Almost maximum (.99 quantile) is used rather than maximum to avoid using
# irrelevant non-speech sound-bursts.
# + add silence-information to calculate articulation rate and ASD (average syllable
# duration.
# NB: speech rate = number of syllables / total time
# articulation rate = number of syllables / phonation time
# + remove max number of syllable nuclei
# + refer to objects by unique identifier, not by name
# + keep track of all created intermediate objects, select these explicitly,
# then Remove
# + provide summary output in Info window
# + do not save TextGrid-file but leave it in Object-window for inspection
# (if requested in startup-form)
# + allow Sound to have starting time different from zero
# for Sound objects created with Extract (preserve times)
# + programming of checking loop for mindip adjusted
# in the orig version, precedingtime was not modified if the peak was rejected !!
# var precedingtime and precedingint renamed to currenttime and currentint
#
# + bug fixed concerning summing total pause, May 28th 2017
###########################################################################
# counts syllables of all sound utterances in a directory
# NB unstressed syllables are sometimes overlooked
# NB filter sounds that are quite noisy beforehand
# NB use Silence threshold (dB) = -20 (or -20?)
# NB use Minimum dip between peaks (dB) = between 2-4 (you can first try;
# For clean and filtered: 4)
form Counting Syllables in Sound Utterances
real Silence_threshold_(dB)
real Minimum_dip_between_peaks_(dB)
real Minimum_pause_duration_(s)
boolean Keep_Soundfiles_and_Textgrids
sentence soundin
sentence directory
positive Minimum_pitch_(Hz)
positive Maximum_pitch_(Hz)
positive Time_step_(s)
endform
# shorten variables
silencedb = 'silence_threshold'
mindip = 'minimum_dip_between_peaks'
showtext = 'keep_Soundfiles_and_Textgrids'
minpause = 'minimum_pause_duration'
# read files
Read from file... 'soundin$'
# use object ID
soundname$ = selected$("Sound")
soundid = selected("Sound")
originaldur = Get total duration
# allow non-zero starting time
bt = Get starting time
# Use intensity to get threshold
To Intensity... 50 0 yes
intid = selected("Intensity")
start = Get time from frame number... 1
nframes = Get number of frames
end = Get time from frame number... 'nframes'
# estimate noise floor
minint = Get minimum... 0 0 Parabolic
# estimate noise max
maxint = Get maximum... 0 0 Parabolic
#get .99 quantile to get maximum (without influence of non-speech sound bursts)
max99int = Get quantile... 0 0 0.99
# estimate Intensity threshold
threshold = max99int + silencedb
threshold2 = maxint - max99int
threshold3 = silencedb - threshold2
if threshold < minint
threshold = minint
endif
# get pauses (silences) and speakingtime
To TextGrid (silences)... threshold3 minpause 0.1 silent sounding
textgridid = selected("TextGrid")
silencetierid = Extract tier... 1
silencetableid = Down to TableOfReal... sounding
nsounding = Get number of rows
npauses = 'nsounding'
speakingtot = 0
for ipause from 1 to npauses
beginsound = Get value... 'ipause' 1
endsound = Get value... 'ipause' 2
speakingdur = 'endsound' - 'beginsound'
speakingtot = 'speakingdur' + 'speakingtot'
endfor
select 'intid'
Down to Matrix
matid = selected("Matrix")
# Convert intensity to sound
To Sound (slice)... 1
sndintid = selected("Sound")
# use total duration, not end time, to find out duration of intdur
# in order to allow nonzero starting times.
intdur = Get total duration
intmax = Get maximum... 0 0 Parabolic
# estimate peak positions (all peaks)
To PointProcess (extrema)... Left yes no Sinc70
ppid = selected("PointProcess")
numpeaks = Get number of points
# fill array with time points
for i from 1 to numpeaks
t'i' = Get time from index... 'i'
endfor
# fill array with intensity values
select 'sndintid'
peakcount = 0
for i from 1 to numpeaks
value = Get value at time... t'i' Cubic
if value > threshold
peakcount += 1
int'peakcount' = value
timepeaks'peakcount' = t'i'
endif
endfor
# fill array with valid peaks: only intensity values if preceding
# dip in intensity is greater than mindip
select 'intid'
validpeakcount = 0
currenttime = timepeaks1
currentint = int1
for p to peakcount-1
following = p + 1
followingtime = timepeaks'following'
dip = Get minimum... 'currenttime' 'followingtime' None
diffint = abs(currentint - dip)
if diffint > mindip
validpeakcount += 1
validtime'validpeakcount' = timepeaks'p'
endif
currenttime = timepeaks'following'
currentint = Get value at time... timepeaks'following' Cubic
endfor
# Look for only voiced parts
select 'soundid'
To Pitch (ac)... 0.02 30 4 no 0.03 0.25 0.01 0.35 0.25 450
# keep track of id of Pitch
pitchid = selected("Pitch")
voicedcount = 0
for i from 1 to validpeakcount
querytime = validtime'i'
select 'textgridid'
whichinterval = Get interval at time... 1 'querytime'
whichlabel$ = Get label of interval... 1 'whichinterval'
select 'pitchid'
value = Get value at time... 'querytime' Hertz Linear
if value <> undefined
if whichlabel$ = "sounding"
voicedcount = voicedcount + 1
voicedpeak'voicedcount' = validtime'i'
endif
endif
endfor
# calculate time correction due to shift in time for Sound object versus
# intensity object
timecorrection = originaldur/intdur
# Insert voiced peaks in TextGrid
if showtext > 0
select 'textgridid'
Insert point tier... 1 syllables
for i from 1 to voicedcount
position = voicedpeak'i' * timecorrection
Insert point... 1 position 'i'
endfor
endif
Save as text file: "'directory$'/'soundname$'.TextGrid"
# use object ID
Read from file... 'soundin$'
soundname$ = selected$("Sound")
soundid = selected("Sound")
fileName$ = "f0points'soundname$'.txt"
# Calculate F0 values
To Pitch... time_step minimum_pitch maximum_pitch
numberOfFrames = Get number of frames
# Loop through all frames in the Pitch object:
select Pitch 'soundname$'
unit$ = "Hertz"
min_Hz = Get minimum... 0 0 Hertz Parabolic
min$ = "'min_Hz'"
max_Hz = Get maximum... 0 0 Hertz Parabolic
max$ = "'max_Hz'"
mean_Hz = Get mean... 0 0 Hertz
mean$ = "'mean_Hz'"
stdev_Hz = Get standard deviation... 0 0 Hertz
stdev$ = "'stdev_Hz'"
median_Hz = Get quantile... 0 0 0.50 Hertz
median$ = "'median_Hz'"
quantile25_Hz = Get quantile... 0 0 0.25 Hertz
quantile25$ = "'quantile25_Hz'"
quantile75_Hz = Get quantile... 0 0 0.75 Hertz
quantile75$ = "'quantile75_Hz'"
# Collect and save the pitch values from the individual frames to the text file:
quantile250 = 'quantile25$'
quantile750 = 'quantile75$'
meanall = 'mean$'
q50='median$'
std='stdev$'
fmax='max$'
fmin='min$'
# clean up before next sound file is opened
select 'intid'
plus 'matid'
plus 'sndintid'
plus 'ppid'
plus 'pitchid'
plus 'silencetierid'
plus 'silencetableid'
Read from file... 'soundin$'
soundname$ = selected$ ("Sound")
To Formant (burg)... 0 5 5500 0.025 50
Read from file... 'directory$'/'soundname$'.TextGrid
int=Get number of intervals... 2
rstd=0
ins=0
qstd=0
lstd=0
nuofwrds=0
npause=0
xx=0
xxban$="0"
vowel1=0
counter1=0
vsa=0
space=0
vectorf#= zero# (int)
vowelinx1=0
vowelinx2=0
formantmean=0
formantstd=0
if int<2
warningfun$="A short talk or noisy background or unnatural-sounding speech detected. No result Try again"
else
# We then calculate F1, F2 and F3
fff= 0
eee= 0
inside= 0
outside= 0
for k from 2 to 'int'
select TextGrid 'soundname$'
label$ = Get label of interval... 2 'k'
if label$ <> ""
# calculates the onset and offset
vowel_onset = Get starting point... 2 'k'
vowel_offset = Get end point... 2 'k'
select Formant 'soundname$'
f_one = Get mean... 1 vowel_onset vowel_offset Hertz
f_two = Get mean... 2 vowel_onset vowel_offset Hertz
f_three = Get mean... 3 vowel_onset vowel_offset Hertz
ff = 'f_two'/'f_one'
lnf1 = 'f_one'
lnf2f1 = ('f_two'/'f_one')
uplim =(-0.012*'lnf1')+13.17
lowlim =(-0.0148*'lnf1')+8.18
space=((6.23*10^(-6)*(f_one)^2 + 0.09339*(f_one)+ 28.52)*(6.23*10^(-6)*(f_two)^2 + 0.09339*(f_two)+ 28.52))/1000
if space>=15 and space<=28
vsa=vsa+1
elsif space>=3 and space<=12
vsa=vsa+1
else vsa=vsa+0
endif
f1uplim =(lnf2f1-13.17)/-0.012
f1lowlim =(lnf2f1-8.18)/-0.0148
if 1/ff<=0.176 and 1/ff>= 0.0744
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.227 and 1/ff>= 0.127
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.245 and 1/ff>=0.145
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.361 and 1/ff>= 0.261
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.605 and 1/ff>= 0.505
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.760 and 1/ff>= 0.660
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.733 and 1/ff>= 0.632
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.489 and 1/ff>= 0.388
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.414 and 1/ff>= 0.313
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.312 and 1/ff>= 0.211
vowel1=vowel1+1
else vowel1=vowel1+0
endif
if 1/ff<=0.569 and 1/ff>= 0.469
vowel1=vowel1+1
else vowel1=vowel1+0
endif
counter1=counter1+1
if lnf1>='f1lowlim' and lnf1<='f1uplim'
inside = 'inside'+1
else
outside = 'outside'+1
endif
vectorf# [k] = ff
fff = 'fff'+'f1uplim'
eee = 'eee'+'f1lowlim'
ffff = 'fff'/'int'
eeee = 'eee'/'int'
pron =('inside'*100)/('inside'+'outside')
prom =('outside'*100)/('inside'+'outside')
prob1 = invBinomialP ('pron'/100, 'inside', 'inside'+'outside')
prob = 'prob1:2'
endif
endfor
vowelinx1=vowel1
vowelinx2=vsa/k
formantmean=mean(vectorf#)
formantstd=stdev(vectorf#)
#shab = (ln(f_one)-5.65)/0.31
#f00 = exp (shab)
Remove
if showtext < 1
select 'soundid'
plus 'textgridid'
Remove
endif
# summarize results in Info window
speakingrate = 'voicedcount'/'originaldur'
speakingraterp = ('voicedcount'/'originaldur')*100/3.93
articulationrate = 'voicedcount'/'speakingtot'
articulationraterp = ('voicedcount'/'speakingtot')*100/4.64
npause = 'npauses'-1
asd = 'speakingtot'/'voicedcount'
avenumberofwords = ('voicedcount'/1.74)/'speakingtot'
avenumberofwordsrp = (('voicedcount'/1.74)/'speakingtot')*100/2.66
nuofwrdsinchunk = (('voicedcount'/1.74)/'speakingtot')* 'speakingtot'/'npauses'
nuofwrdsinchunkrp = ((('voicedcount'/1.74)/'speakingtot')* 'speakingtot'/'npauses')*100/9
avepauseduratin = ('originaldur'-'speakingtot')/('npauses'-1)
avepauseduratinrp = (('originaldur'-'speakingtot')/('npauses'-1))*100/0.75
balance = ('voicedcount'/'originaldur')/('voicedcount'/'speakingtot')
balancerp = (('voicedcount'/'originaldur')/('voicedcount'/'speakingtot'))*100/0.85
nuofwrds= ('voicedcount'/1.74)
f1norm =(-0.0118*'pron'^2) + (0.5072*'pron')+394.34
inpro = ('nuofwrds'*60/'originaldur')
polish = 'originaldur'/2
# Read the saved pitch points as a Matrix object:
if meanall<150
q25='quantile250'/100
q75='quantile750'/140
mr= 'meanall'/119
else
q25='quantile250'/183
q75='quantile750'/237
mr= 'meanall'/210
endif
if nuofwrds<10
warningfun1$="Not enough words detected. Please speak longer."
else
#WARNING
if originaldur>=60 and speakingtot>=polish and f1norm<=395 and eeee<=395
warning0$ = "NO WARNING"
else
warning0$ = "WARNING"
endif
if originaldur<60
warning1$ = "your speech lasts less than 60 seconds; it might affect the accuracy of your speech assessment"
else
warning1$ = " "
endif
if speakingtot<polish
warning2$ = "Your speech is limited in content with long pause; it might affect the accuracy of your speech assessment"
else
warning2$ = " "
endif
if f1norm>395 or eeee>395
warning3$ = "There could be something wrong with your audio system OR your recorded voice is not clear OR your pronunciation level is limited"
else
warning3$ = " "
endif
# Convert the original minimum and maximum parameters in order to define the x scale of the
if q25<=1 and q75<=1 and mr>=0.95 and mr<=1.05
ins=10
elsif q25<=1 and q75<=1 and mr>=0.9 and mr<=1.1
ins=9
elsif q25<=1 and q75<=1 and mr>=0.85 and mr<=1.15
ins=8
elsif mr>=0.9 and mr<=1.1
ins=7
elsif mr>=0.8 and mr<=1.2
ins=6
elsif mr<=0.8
ins=4
else
ins=5
endif
#SCORING
if ins=4
z=1.16
elsif ins<=6 and ins>4
z=2
elsif ins<9 and ins>6
z=3
elsif ins>=9
z=4
else
z=1
endif
if nuofwrdsinchunk>=6.24 and avepauseduratin<=1.0
l=4
elsif nuofwrdsinchunk>=6.24 and avepauseduratin>1.0
l=3.6
elsif nuofwrdsinchunk>=4.4 and nuofwrdsinchunk<=6.24 and avepauseduratin<=1.15
l=3.3
elsif nuofwrdsinchunk>=4.4 and nuofwrdsinchunk<=6.24 and avepauseduratin>1.15
l=3
elsif nuofwrdsinchunk<4.4 and avepauseduratin<=1.15
l=2
elsif nuofwrdsinchunk<=4.4 and avepauseduratin>1.15
l=1.16
else
l=1
endif
if balance>=0.69 and avenumberofwords>=2.60
o=4
elsif balance>=0.60 and avenumberofwords>=2.43
o=3.5
elsif balance>=0.5 and avenumberofwords>=2.25
o=3
elsif balance>=0.5 and avenumberofwords>=2.07
o=2
elsif balance>=0.5 and avenumberofwords>=1.95
o=1.16
else
o=1
endif
if speakingrate<=4.26 and speakingrate>=3.16
q=4
elsif speakingrate<=3.16 and speakingrate>=2.54
q=3.5
elsif speakingrate<=2.54 and speakingrate>=1.91
q=3
elsif speakingrate<=1.91 and speakingrate>=1.28
q=2
elsif speakingrate<=1.28 and speakingrate>=1.0
q=1.16
else
q=1
endif
if balance>=0.69 and articulationrate>=4.54
w=4
elsif balance>=0.60 and articulationrate>=4.22
w=3.5
elsif balance>=0.50 and articulationrate>=3.91
w=3
elsif balance>=0.5 and articulationrate>=3.59
w=2
elsif balance>=0.5 and articulationrate>=3.10
w=1.16
else
w=1
endif
if inpro>=119 and ('f1norm'*1.1)>=f1lowlim
r = 4
elsif inpro>=119 and ('f1norm'*1.1)<f1lowlim
r = 3.8
elsif inpro<119 and inpro>=100 and ('f1norm'*1.1)>=f1lowlim
r = 3.6
elsif inpro<119 and inpro>=100 and ('f1norm'*1.1)<f1lowlim
r = 3.4
elsif inpro<100 and inpro>=80 and ('f1norm'*1.1)>=f1lowlim
r= 3.2
elsif inpro<100 and inpro>=80 and ('f1norm'*1.1)<f1lowlim
r = 2.8
elsif inpro<80 and inpro>=70 and ('f1norm'*1.1)>=f1lowlim
r = 2.4
elsif inpro<70 and inpro>=60 and ('f1norm'*1.1)>=f1lowlim
r = 2
elsif inpro<70 and inpro>=60 and ('f1norm'*1.1)<f1lowlim
r = 1.1
else
r = 0.3
endif
if articulationrate>=4.80 and balance>=0.8
qr = 4
elsif articulationrate>=4.80 and balance<0.8
qr = 3.8
elsif articulationrate<4.80 and articulationrate>=4.65 and balance>=0.8
qr = 3.6
elsif articulationrate<4.80 and articulationrate>=4.65 and balance<0.8
qr = 3.4
elsif articulationrate<4.65 and articulationrate>=4.55 and balance>=0.8
qr= 3.2
elsif articulationrate<4.65 and articulationrate>=4.55 and balance<0.8
qr = 2.8
elsif articulationrate<4.55 and articulationrate>=4.40 and balance>=0.8
qr = 2.4
elsif articulationrate<4.40 and articulationrate>=4.30 and balance>=0.8
qr = 2
elsif articulationrate<4.40 and articulationrate>=4.30 and balance<0.8
qr = 1.5
else
qr = 1
endif
# summarize SCORE in Info window
totalscore =(l*2+z*4+o*3+qr*3+w*4+r*4)/20
totalscale= 'totalscore'*25
if totalscore>=3.6
a=4
elsif totalscore>=0.6 and totalscore<2
a=1
elsif totalscore>=2 and totalscore<3
a=2
elsif totalscore>=3 and totalscore<3.6
a=3
else
a=0.5
endif
if totalscale>=90
s=4
elsif totalscale>=15 and totalscale<50
s=1
elsif totalscale>=50 and totalscale<75
s=2
elsif totalscale>=75 and totalscale<90
s=3
else
s=0.5
endif
#vvv=a+('totalscale'/100)
vvv=totalscore+('totalscale'/100)
if vvv>=4
u=4*(1-(randomInteger(1,16)/100))
else
u=vvv-(randomInteger(1,16)/100)
endif
if totalscore>=4
xx=30
elsif totalscore>=3.80 and totalscore<4
xx=29
elsif totalscore>=3.60 and totalscore<3.80
xx=28
elsif totalscore>=3.5 and totalscore<3.6
xx=27
elsif totalscore>=3.3 and totalscore<3.5
xx=26
elsif totalscore>=3.15 and totalscore<3.3
xx=25
elsif totalscore>=3.08 and totalscore<3.15
xx=24
elsif totalscore>=3 and totalscore<3.08
xx=23
elsif totalscore>=2.83 and totalscore<3
xx=22
elsif totalscore>=2.60 and totalscore<2.83
xx=21
elsif totalscore>=2.5 and totalscore<2.60
xx=20
elsif totalscore>=2.30 and totalscore<2.50
xx=19
elsif totalscore>=2.23 and totalscore<2.30
xx=18
elsif totalscore>=2.15 and totalscore<2.23
xx=17
elsif totalscore>=2 and totalscore<2.15
xx=16
elsif totalscore>=1.93 and totalscore<2
xx=15
elsif totalscore>=1.83 and totalscore<1.93
xx=14
elsif totalscore>=1.74 and totalscore<1.83
xx=13
elsif totalscore>=1.66 and totalscore<1.74
xx=12
elsif totalscore>=1.50 and totalscore<1.66
xx=11
elsif totalscore>=1.33 and totalscore<1.50
xx=10
else
xx=9
endif
overscore = xx*4/30
ov = overscore
if xx>=25
xxban$="C"
elsif xx>=20 and xx<25
xxban$="B2"
elsif xx>=16 and xx<20
xxban$="B1"
elsif xx>=10 and xx<16
xxban$="A2"
else
xxban$="A1"
endif
qaz = 0.18
rr = (r*4+qr*2+z*1)/7
lu = (l*1+w*2+inpro*4/125)/4
td = (w*1+o*2+inpro*1/125)/3.25
facts=(ln(7/4)*4/7+ln(7/2)*2/7+ln(7)*1/7+ln(4)*1/4+ln(2)*1/2+ln(4)*1/4+ln(3.25)*1/3.25+ln(3.25/2)*2/3.25+ln(3.25/0.25)*0.25/3.25+ln(14.25/7)*7/14.25+ln(14.25/4)*4/14.25+ln(14.25/3.35)*3.25/14.25)
totsco = (r*ln(7/4)*4/7+qr*ln(7/2)*2/7+z*ln(7)*1/7+l*ln(4)*1/4+w*ln(2)*1/2+ln(4)*1/4*inpro*4/125+w*ln(3.25)*1/3.25+o*ln(3.25/2)*2/3.25+ln(3.25/0.25)*0.25/3.25*inpro*4/125)/facts
if totalscore>=4
totsco=3.9
else
totsco=totalscore
endif
rrr = rr*qaz
lulu = lu*qaz
tdtd = td*qaz
totscoo = totsco*qaz
whx=rrr*cos(1.309)
why=rrr*sin(1.309)
who=4*qaz
lstd=(10*l)/4
ostd=(10*o)/4
wstd=(10*w)/4
rstd=(10*r)/4
zstd=(10*z)/4
qstd=(10*qr)/4
if q=4
xxx$="c"
endif
if q=3.5
xxx$="b2"
endif
if q=3
xxx$="b1"
endif
if q=2
xxx$="a2"
endif
if q=1.16
xxx$="a1"
endif
if q=1
xxx$="a"
endif
fillerratio='voicedcount'/'npause'
# Long pause analysis variables
silencedb = 'silence_threshold'
mindip = 'minimum_dip_between_peaks'
showtext = 'keep_Soundfiles_and_Textgrids'
minpause = 0.8
Read from file... 'soundin$'
soundname$ = selected$("Sound")
soundid = selected("Sound")
originaldur = Get total duration
bt = Get starting time
To Intensity... 50 0 yes
intid = selected("Intensity")
start = Get time from frame number... 1
nframes = Get number of frames
end = Get time from frame number... 'nframes'
minint = Get minimum... 0 0 Parabolic
maxint = Get maximum... 0 0 Parabolic
max99int = Get quantile... 0 0 0.99
threshold = max99int + silencedb
threshold2 = maxint - max99int
threshold3 = silencedb - threshold2
if threshold < minint
threshold = minint
endif
To TextGrid (silences)... threshold3 minpause 0.1 silent sounding
textgridid2 = selected("TextGrid")
silencetierid = Extract tier... 1
silencetableid = Down to TableOfReal... sounding
nsounding = Get number of rows
npausesz = 'nsounding'
speakingtot = 0
for ipause from 1 to npausesz
beginsound = Get value... 'ipause' 1
endsound = Get value... 'ipause' 2
speakingdur = 'endsound' - 'beginsound'
speakingtot = 'speakingdur' + 'speakingtot'
endfor
select 'intid'
Down to Matrix
matid = selected("Matrix")
To Sound (slice)... 1
sndintid = selected("Sound")
intdur = Get total duration
intmax = Get maximum... 0 0 Parabolic
To PointProcess (extrema)... Left yes no Sinc70
ppid = selected("PointProcess")
numpeaks = Get number of points
for i from 1 to numpeaks
t'i' = Get time from index... 'i'
endfor
select 'sndintid'
peakcount = 0
for i from 1 to numpeaks
value = Get value at time... t'i' Cubic
if value > threshold
peakcount += 1
int'peakcount' = value
timepeaks'peakcount' = t'i'
endif
endfor
select 'intid'
validpeakcount = 0
currenttime = timepeaks1
currentint = int1
for p to peakcount-1
following = p + 1
followingtime = timepeaks'following'
dip = Get minimum... 'currenttime' 'followingtime' None
diffint = abs(currentint - dip)
if diffint > mindip
validpeakcount += 1
validtime'validpeakcount' = timepeaks'p'
endif
currenttime = timepeaks'following'
currentint = Get value at time... timepeaks'following' Cubic
endfor
select 'soundid'
To Pitch (ac)... 0.02 30 4 no 0.03 0.25 0.01 0.35 0.25 450
pitchid = selected("Pitch")
voicedcount = 0
for i from 1 to validpeakcount
querytime = validtime'i'
select 'textgridid2'
whichinterval = Get interval at time... 1 'querytime'
whichlabel$ = Get label of interval... 1 'whichinterval'
select 'pitchid'
value = Get value at time... 'querytime' Hertz Linear
if value <> undefined
if whichlabel$ = "sounding"
voicedcount = voicedcount + 1
voicedpeak'voicedcount' = validtime'i'
endif
endif
endfor
timecorrection = originaldur/intdur
if showtext > 0
select 'textgridid'
Insert point tier... 1 syllables
for i from 1 to voicedcount
position = voicedpeak'i' * timecorrection
Insert point... 1 position 'i'
endfor
endif
Save as text file: "'directory$'/'soundname$'2.TextGrid"
npausez= 'npausesz'
avelongpause='originaldur'/'npausez'
Erase all
appendInfoLine:'avepauseduratin',tab$,'avelongpause',tab$,'speakingtot:2',tab$,'avenumberofwords',tab$,'articulationrate',tab$,'inpro',tab$,'f1norm',tab$,'mr',tab$,'q25',tab$,'q50',tab$,'q75', tab$, 'std',tab$,'fmax',tab$,'fmin',tab$,'vowelinx1',tab$,'vowelinx2',tab$,'formantmean',tab$,'formantstd',tab$,'nuofwrds:0',tab$,'npause',tab$,'ins',tab$,'fillerratio',tab$,'xx',tab$,xxx$,tab$,'totsco',tab$,xxban$,tab$,'speakingrate'
endif
if nuofwrds<10
appendInfoLine:'avepauseduratin',tab$,'avelongpause',tab$,'speakingtot:2',tab$,'avenumberofwords',tab$,'articulationrate',tab$,'inpro',tab$,'f1norm',tab$,'mr',tab$,'q25',tab$,'q50',tab$,'q75', tab$, 'std',tab$,'fmax',tab$,'fmin',tab$,'vowelinx1',tab$,'vowelinx2',tab$,'formantmean',tab$,'formantstd',tab$,'nuofwrds:0',tab$,'npause',tab$,'ins',tab$,'fillerratio',tab$,'xx',tab$,xxx$,tab$,'totsco',tab$,xxban$,tab$,'speakingrate'
endif
endif
if int<2
appendInfoLine: 0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0,tab$,0, tab$,0
endif
\ No newline at end of file
###########################################################################
# The library was developed based upon the idea introduced #
# by Nivja DeJong and Ton Wempe [1], Paul Boersma and David Weenink [2], #
# Carlo Gussenhoven [3], #
# S.M Witt and S.J. Young [4] #
# Peaks in intensity (dB) that are preceded and followed by dips in #
# intensity are considered as potential syllable cores. #
# #
# Praat Script voice analysis #
# Copyright (C) 2017 Shahab Sabahi #
# #
# This program is a Mysolutions software intellectual property: #
# you can redistribute it and/or modify it under the terms #
# of the Mysolutions Permision. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# #
###########################################################################
#
# modified 2018 July by Shahab Sabahi,
# bug fixed concerning summing total pause, May 28th 2017
###########################################################################
form Counting Syllables in Sound Utterances
real Silence_threshold_(dB)
real Minimum_dip_between_peaks_(dB)
real Minimum_pause_duration_(s)
boolean Keep_Soundfiles_and_Textgrids
sentence soundin
sentence directory
positive Minimum_pitch_(Hz)
positive Maximum_pitch_(Hz)
positive Time_step_(s)
endform
# shorten variables
silencedb = 'silence_threshold'
mindip = 'minimum_dip_between_peaks'
showtext = 'keep_Soundfiles_and_Textgrids'
minpause = 'minimum_pause_duration'
# read files
Read from file... 'soundin$'
# use object ID
soundname$ = selected$("Sound")
soundid = selected("Sound")
originaldur = Get total duration
# allow non-zero starting time
bt = Get starting time
# Use intensity to get threshold
To Intensity... 50 0 yes
intid = selected("Intensity")
start = Get time from frame number... 1
nframes = Get number of frames
end = Get time from frame number... 'nframes'
# estimate noise floor
minint = Get minimum... 0 0 Parabolic
# estimate noise max
maxint = Get maximum... 0 0 Parabolic
#get .99 quantile to get maximum (without influence of non-speech sound bursts)
max99int = Get quantile... 0 0 0.99
# estimate Intensity threshold
threshold = max99int + silencedb
threshold2 = maxint - max99int
threshold3 = silencedb - threshold2
if threshold < minint
threshold = minint
endif
# get pauses (silences) and speakingtime
To TextGrid (silences)... threshold3 minpause 0.1 silent sounding
textgridid = selected("TextGrid")
silencetierid = Extract tier... 1
silencetableid = Down to TableOfReal... sounding
nsounding = Get number of rows
npauses = 'nsounding'
speakingtot = 0
for ipause from 1 to npauses
beginsound = Get value... 'ipause' 1
endsound = Get value... 'ipause' 2
speakingdur = 'endsound' - 'beginsound'
speakingtot = 'speakingdur' + 'speakingtot'
endfor
select 'intid'
Down to Matrix
matid = selected("Matrix")
# Convert intensity to sound
To Sound (slice)... 1
sndintid = selected("Sound")
# use total duration, not end time, to find out duration of intdur
# in order to allow nonzero starting times.
intdur = Get total duration
intmax = Get maximum... 0 0 Parabolic
# estimate peak positions (all peaks)
To PointProcess (extrema)... Left yes no Sinc70
ppid = selected("PointProcess")
numpeaks = Get number of points
# fill array with time points
for i from 1 to numpeaks
t'i' = Get time from index... 'i'
endfor
# fill array with intensity values
select 'sndintid'
peakcount = 0
for i from 1 to numpeaks
value = Get value at time... t'i' Cubic
if value > threshold
peakcount += 1
int'peakcount' = value
timepeaks'peakcount' = t'i'
endif
endfor
# fill array with valid peaks: only intensity values if preceding
# dip in intensity is greater than mindip
select 'intid'
validpeakcount = 0
currenttime = timepeaks1
currentint = int1
for p to peakcount-1
following = p + 1
followingtime = timepeaks'following'
dip = Get minimum... 'currenttime' 'followingtime' None
diffint = abs(currentint - dip)
if diffint > mindip
validpeakcount += 1
validtime'validpeakcount' = timepeaks'p'
endif
currenttime = timepeaks'following'
currentint = Get value at time... timepeaks'following' Cubic
endfor
# Look for only voiced parts
select 'soundid'
To Pitch (ac)... 0.02 30 4 no 0.03 0.25 0.01 0.35 0.25 450
# keep track of id of Pitch
pitchid = selected("Pitch")
voicedcount = 0
for i from 1 to validpeakcount
querytime = validtime'i'
select 'textgridid'
whichinterval = Get interval at time... 1 'querytime'
whichlabel$ = Get label of interval... 1 'whichinterval'
select 'pitchid'
value = Get value at time... 'querytime' Hertz Linear
if value <> undefined
if whichlabel$ = "sounding"
voicedcount = voicedcount + 1
voicedpeak'voicedcount' = validtime'i'
endif
endif
endfor
# calculate time correction due to shift in time for Sound object versus
# intensity object
timecorrection = originaldur/intdur
# Insert voiced peaks in TextGrid
if showtext > 0
select 'textgridid'
Insert point tier... 1 syllables
for i from 1 to voicedcount
position = voicedpeak'i' * timecorrection
Insert point... 1 position 'i'
endfor
endif
Save as text file: "'directory$'/'soundname$'.TextGrid"
# use object ID
Read from file... 'soundin$'
soundname$ = selected$("Sound")
soundid = selected("Sound")
fileName$ = "f0points'soundname$'.txt"
# Calculate F0 values
To Pitch... time_step minimum_pitch maximum_pitch
numberOfFrames = Get number of frames
# Loop through all frames in the Pitch object:
select Pitch 'soundname$'
unit$ = "Hertz"
min_Hz = Get minimum... 0 0 Hertz Parabolic
min$ = "'min_Hz'"
max_Hz = Get maximum... 0 0 Hertz Parabolic
max$ = "'max_Hz'"
mean_Hz = Get mean... 0 0 Hertz
mean$ = "'mean_Hz'"
stdev_Hz = Get standard deviation... 0 0 Hertz
stdev$ = "'stdev_Hz'"
median_Hz = Get quantile... 0 0 0.50 Hertz
median$ = "'median_Hz'"
quantile25_Hz = Get quantile... 0 0 0.25 Hertz
quantile25$ = "'quantile25_Hz'"
quantile75_Hz = Get quantile... 0 0 0.75 Hertz
quantile75$ = "'quantile75_Hz'"
# Collect and save the pitch values from the individual frames to the text file:
quantile250 = 'quantile25$'
quantile750 = 'quantile75$'
meanall = 'mean$'
sd='stdev$'
medi='median$'
mini='min$'
maxi='max$'
# clean up before next sound file is opened
select 'intid'
plus 'matid'
plus 'sndintid'
plus 'ppid'
plus 'pitchid'
plus 'silencetierid'
plus 'silencetableid'
Read from file... 'soundin$'
soundname$ = selected$ ("Sound")
To Formant (burg)... 0 5 5500 0.025 50
Read from file... 'directory$'/'soundname$'.TextGrid
int=Get number of intervals... 2
if int<2
warning$="A noisy background or unnatural-sounding speech detected. No result try again"
appendInfoLine: warning$
exitScript()
endif
# We then calculate F1, F2 and F3
fff= 0
eee= 0
inside= 0
outside= 0
for k from 2 to 'int'
select TextGrid 'soundname$'
label$ = Get label of interval... 2 'k'
if label$ <> ""
# calculates the onset and offset
vowel_onset = Get starting point... 2 'k'
vowel_offset = Get end point... 2 'k'
select Formant 'soundname$'
f_one = Get mean... 1 vowel_onset vowel_offset Hertz
f_two = Get mean... 2 vowel_onset vowel_offset Hertz
f_three = Get mean... 3 vowel_onset vowel_offset Hertz
ff = 'f_two'/'f_one'
lnf1 = 'f_one'
lnf2f1 = ('f_two'/'f_one')
uplim =(-0.012*'lnf1')+13.17
lowlim =(-0.0148*'lnf1')+8.18
f1uplim =(lnf2f1-13.17)/-0.012
f1lowlim =(lnf2f1-8.18)/-0.0148
if lnf1>='f1lowlim' and lnf1<='f1uplim'
inside = 'inside'+1
else
outside = 'outside'+1
endif
fff = 'fff'+'f1uplim'
eee = 'eee'+'f1lowlim'
ffff = 'fff'/'int'
eeee = 'eee'/'int'
pron =('inside'*100)/('inside'+'outside')
prom =('outside'*100)/('inside'+'outside')
prob1 = invBinomialP ('pron'/100, 'inside', 'inside'+'outside')
prob = 'prob1:2'
endif
endfor
lnf0 = (ln(f_one)-5.65)/0.31
f00 = exp (lnf0)
Remove
if showtext < 1
select 'soundid'
plus 'textgridid'
Remove
endif
# summarize results in Info window
speakingrate = 'voicedcount'/'originaldur'
speakingraterp = ('voicedcount'/'originaldur')*100/3.93
articulationrate = 'voicedcount'/'speakingtot'
articulationraterp = ('voicedcount'/'speakingtot')*100/4.64
npause = 'npauses'-1
asd = 'speakingtot'/'voicedcount'
avenumberofwords = ('voicedcount'/1.74)/'speakingtot'
avenumberofwordsrp = (('voicedcount'/1.74)/'speakingtot')*100/2.66
nuofwrdsinchunk = (('voicedcount'/1.74)/'speakingtot')* 'speakingtot'/'npauses'
nuofwrdsinchunkrp = ((('voicedcount'/1.74)/'speakingtot')* 'speakingtot'/'npauses')*100/9
avepauseduratin = ('originaldur'-'speakingtot')/('npauses'-1)
avepauseduratinrp = (('originaldur'-'speakingtot')/('npauses'-1))*100/0.75
balance = ('voicedcount'/'originaldur')/('voicedcount'/'speakingtot')
balancerp = (('voicedcount'/'originaldur')/('voicedcount'/'speakingtot'))*100/0.85
nuofwrds= ('voicedcount'/1.74)
f1norm = -0.0118*'pron'*'pron'+0.5072*'pron'+394.34
inpro = ('nuofwrds'*60/'originaldur')
polish = 'originaldur'/2
# Read the saved pitch points as a Matrix object:
if meanall<150
q25='quantile250'/100
q75='quantile750'/140
mr= 'meanall'/119
else
q25='quantile250'/183
q75='quantile750'/237
mr= 'meanall'/210
endif
# Convert the original minimum and maximum parameters in order to define the x scale of the
if q25<=1 and q75<=1 and mr>=0.95 and mr<=1.05
ins=10
elsif q25<=1 and q75<=1 and mr>=0.9 and mr<=1.1
ins=9
elsif q25<=1 and q75<=1 and mr>=0.85 and mr<=1.15
ins=8
elsif mr>=0.9 and mr<=1.1
ins=7
elsif mr>=0.8 and mr<=1.2
ins=6
elsif mr<=0.8
ins=4
else
ins=5
endif
#SCORING
if f00<90 or f00>255
z=1.16
elsif f00<97 or f00>245
z=2
elsif f00<115 or f00>245
z=3
elsif f00<=245 or f00>=115
z=4
else
z=1
endif
if nuofwrdsinchunk>=6.24 and avepauseduratin<=1.0
l=4
elsif nuofwrdsinchunk>=6.24 and avepauseduratin>1.0
l=3.6
elsif nuofwrdsinchunk>=4.4 and nuofwrdsinchunk<=6.24 and avepauseduratin<=1.15
l=3.3
elsif nuofwrdsinchunk>=4.4 and nuofwrdsinchunk<=6.24 and avepauseduratin>1.15
l=3
elsif nuofwrdsinchunk<4.4 and avepauseduratin<=1.15
l=2
elsif nuofwrdsinchunk<=4.4 and avepauseduratin>1.15
l=1.16
else
l=1
endif
if balance>=0.69 and avenumberofwords>=2.60
o=4
elsif balance>=0.60 and avenumberofwords>=2.43
o=3.5
elsif balance>=0.5 and avenumberofwords>=2.25
o=3
elsif balance>=0.5 and avenumberofwords>=2.07
o=2
elsif balance>=0.5 and avenumberofwords>=1.95
o=1.16
else
o=1
endif
if speakingrate<=4.26 and speakingrate>=3.16
q=4
elsif speakingrate<=3.16 and speakingrate>=2.54
q=3.5
elsif speakingrate<=2.54 and speakingrate>=1.91
q=3
elsif speakingrate<=1.91 and speakingrate>=1.28
q=2
elsif speakingrate<=1.28 and speakingrate>=1.0
q=1.16
else
q=1
endif
if balance>=0.69 and articulationrate>=4.54
w=4
elsif balance>=0.60 and articulationrate>=4.22
w=3.5
elsif balance>=0.50 and articulationrate>=3.91
w=3
elsif balance>=0.5 and articulationrate>=3.59
w=2
elsif balance>=0.5 and articulationrate>=3.10
w=1.16
else
w=1
endif
if inpro>=119 and ('f1norm'*1.1)>=f1lowlim
r = 4
elsif inpro>=119 and ('f1norm'*1.1)<f1lowlim
r = 3.8
elsif inpro<119 and inpro>=100 and ('f1norm'*1.1)>=f1lowlim
r = 3.6
elsif inpro<119 and inpro>=100 and ('f1norm'*1.1)<f1lowlim
r = 3.4
elsif inpro<100 and inpro>=80 and ('f1norm'*1.1)>=f1lowlim
r= 3.2
elsif inpro<100 and inpro>=80 and ('f1norm'*1.1)<f1lowlim
r = 2.8
elsif inpro<80 and inpro>=70 and ('f1norm'*1.1)>=f1lowlim
r = 2.4
elsif inpro<70 and inpro>=60 and ('f1norm'*1.1)>=f1lowlim
r = 2
elsif inpro<70 and inpro>=60 and ('f1norm'*1.1)<f1lowlim
r = 1.1
else
r = 0.3
endif
if articulationrate>=4.80 and balance>=0.8
qr = 4
elsif articulationrate>=4.80 and balance<0.8
qr = 3.8
elsif articulationrate<4.80 and articulationrate>=4.65 and balance>=0.8
qr = 3.6
elsif articulationrate<4.80 and articulationrate>=4.65 and balance<0.8
qr = 3.4
elsif articulationrate<4.65 and articulationrate>=4.55 and balance>=0.8
qr= 3.2
elsif articulationrate<4.65 and articulationrate>=4.55 and balance<0.8
qr = 2.8
elsif articulationrate<4.55 and articulationrate>=4.40 and balance>=0.8
qr = 2.4
elsif articulationrate<4.40 and articulationrate>=4.30 and balance>=0.8
qr = 2
elsif articulationrate<4.40 and articulationrate>=4.30 and balance<0.8
qr = 1.5
else
qr = 1
endif
# summarize SCORE in Info window
totalscore =(l*2+z*4+o*3+qr*3+w*4+r*4)/20
totalscale= 'totalscore'*25
if totalscore>=3.6
a=4
elsif totalscore>=0.6 and totalscore<2
a=1
elsif totalscore>=2 and totalscore<3
a=2
elsif totalscore>=3 and totalscore<3.6
a=3
else
a=0.5
endif
if totalscale>=90
s=4
elsif totalscale>=15 and totalscale<50
s=1
elsif totalscale>=50 and totalscale<75
s=2
elsif totalscale>=75 and totalscale<90
s=3
else
s=0.5
endif
#vvv=a+('totalscale'/100)
vvv=totalscore+('totalscale'/100)
if vvv>=4
u=4*(1-(randomInteger(1,16)/100))
else
u=vvv-(randomInteger(1,16)/100)
endif
if totalscore>=4
xx=30
elsif totalscore>=3.80 and totalscore<4
xx=29
elsif totalscore>=3.60 and totalscore<3.80
xx=28
elsif totalscore>=3.5 and totalscore<3.6
xx=27
elsif totalscore>=3.3 and totalscore<3.5
xx=26
elsif totalscore>=3.15 and totalscore<3.3
xx=25
elsif totalscore>=3.08 and totalscore<3.15
xx=24
elsif totalscore>=3 and totalscore<3.08
xx=23
elsif totalscore>=2.83 and totalscore<3
xx=22
elsif totalscore>=2.60 and totalscore<2.83
xx=21
elsif totalscore>=2.5 and totalscore<2.60
xx=20
elsif totalscore>=2.30 and totalscore<2.50
xx=19
elsif totalscore>=2.23 and totalscore<2.30
xx=18
elsif totalscore>=2.15 and totalscore<2.23
xx=17
elsif totalscore>=2 and totalscore<2.15
xx=16
elsif totalscore>=1.93 and totalscore<2
xx=15
elsif totalscore>=1.83 and totalscore<1.93
xx=14
elsif totalscore>=1.74 and totalscore<1.83
xx=13
elsif totalscore>=1.66 and totalscore<1.74
xx=12
elsif totalscore>=1.50 and totalscore<1.66
xx=11
elsif totalscore>=1.33 and totalscore<1.50
xx=10
else
xx=9
endif
overscore = xx*4/30
ov = overscore
if xx>=25
xxban$="C"
elsif xx>=20 and xx<25
xxban$="B2"
elsif xx>=16 and xx<20
xxban$="B1"
elsif xx>=10 and xx<16
xxban$="A2"
else
xxban$="A1"
endif
qaz = 0.18
rr = (r*4+qr*2+z*1)/7
lu = (l*1+w*2+inpro*4/125)/4
td = (w*1+o*2+inpro*1/125)/3.25
facts=(ln(7/4)*4/7+ln(7/2)*2/7+ln(7)*1/7+ln(4)*1/4+ln(2)*1/2+ln(4)*1/4+ln(3.25)*1/3.25+ln(3.25/2)*2/3.25+ln(3.25/0.25)*0.25/3.25+ln(14.25/7)*7/14.25+ln(14.25/4)*4/14.25+ln(14.25/3.35)*3.25/14.25)
totsco = (r*ln(7/4)*4/7+qr*ln(7/2)*2/7+z*ln(7)*1/7+l*ln(4)*1/4+w*ln(2)*1/2+ln(4)*1/4*inpro*4/125+w*ln(3.25)*1/3.25+o*ln(3.25/2)*2/3.25+ln(3.25/0.25)*0.25/3.25*inpro*4/125)/facts
if totalscore>=4
totsco=3.9
else
totsco=totalscore
endif
rrr = rr*qaz
lulu = lu*qaz
tdtd = td*qaz
totscoo = totsco*qaz
whx=rrr*cos(1.309)
why=rrr*sin(1.309)
who=4*qaz
probpron=(r/4)
lstd=(10*l)/4
ostd=(10*o)/4
wstd=(10*w)/4
rstd=(10*r)/4
zstd=(10*z)/4
qstd=(10*qr)/4
Erase all
appendInfoLine:'voicedcount:0'
appendInfoLine:'npause:0'
appendInfoLine:'speakingrate:0'
appendInfoLine:'articulationrate:0'
appendInfoLine:'speakingtot:1'
appendInfoLine:'originaldur:1'
appendInfoLine:'balance:1'
appendInfoLine:'meanall:2'
appendInfoLine:'sd:2'
appendInfoLine:'medi:1'
appendInfoLine:'mini:0'
appendInfoLine:'maxi:0'
appendInfoLine:'quantile250:0'
appendInfoLine:'quantile750:0'
appendInfoLine:'probpron:2'
\ No newline at end of file
,average_syll_pause_duration,No._long_pause,speaking_time,ave_No._of_words_in_minutes,articulation_rate,No._words_in_minutes,formants_index,f0_index,f0_quantile_25_index,f0_quantile_50_index,f0_quantile_75_index,f0_std,f0_max,f0_min,No._detected_vowel,perc%._correct_vowel,(f2/f1)_mean,(f2/f1)_std,no._of_words,no._of_pauses,intonation_index,(voiced_syll_count)/(no_of_pause),TOEFL_Scale_Score,Score_Shannon_index,speaking_rate
count,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0,697.0
mean,0.8711691505007172,11.884827192525108,61.87325681492109,2.511292756892396,4.356201165370158,105.7234069427116,368.3031599170732,0.9613590789426112,0.9160735395667144,174.86871823299856,0.9603444352639884,46.759814277934005,385.23783471377334,79.08099626984219,84.14060258249641,0.6085482836183644,2.4881832346585364,0.7203101768134863,132.7302725968436,25.53945480631277,7.127690100430416,10.302043154121952,21.968436154949785,2.8686284074605455,3.082425903516499
std,0.46166177671746383,10.64664213863159,38.27363756344159,0.23284718254288647,0.5018093886478655,21.084760878463424,21.408253503187975,0.11856904287612252,0.15778835368459473,37.224660757224875,0.11898883930794583,14.43561315626036,41.0241155972532,10.493765220484537,48.92913919414536,0.17051676788392314,0.2858284340699538,0.18294312359365827,87.77543914621356,14.871922795434735,1.6372265855189436,9.740952677485364,4.668509323515208,0.6119229333631522,0.6783222980271066
min,0.32,2.261335451,7.54,1.5615067480000002,3.0,28.00108004,327.06,0.7150403790000001,0.522027013,94.13391354,0.6422109810000001,14.39604874,192.0464154,60.61750438,3.0,0.06122449,1.570231608,0.299595563,15.0,1.0,4.0,1.625,9.0,1.0759999999999998,1.0
25%,0.663462868,5.881282799,29.07,2.367729993,4.0,93.90385508,352.3382912,0.888699048,0.812169482,151.3014793,0.8920442759999999,35.68453756,371.8891276,72.76623526,41.0,0.47826087,2.278626254,0.601991294,59.0,13.0,6.0,6.551724137999999,20.0,2.52,3.0
50%,0.7664013609999999,8.38372206,54.24,2.523156338,4.0,108.12892520000001,373.8021607,0.957603522,0.9148756840000001,180.32414269999998,0.948689995,48.18847497,396.0576138,79.05566587,77.0,0.6,2.512143195,0.6963008620000001,113.0,23.0,7.0,8.45,22.0,2.895,3.0
75%,0.9132467879999999,13.08693878,85.22,2.651778138,5.0,119.9512105,386.7869727,1.0249682979999999,1.036024366,199.34072369999998,1.026649572,58.23745756,416.41539889999996,80.61435463,117.0,0.740740741,2.6869739669999997,0.803898055,181.0,35.0,8.0,11.36842105,26.0,3.32,3.378208354
max,4.689212121000001,113.15333329999999,225.31,3.3529533639999998,6.0,190.560794,399.6609917,1.427151945,1.442502751,313.60393860000005,1.473006332,84.0325436,424.380037,179.83311369999998,304.0,0.970588235,3.6152396330000003,2.107762509,489.0,93.0,10.0,125.5,29.0,3.96,6.0
import myprosody as mysp
import pickle
p="suun3"
c="F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\myprosody"
mysp.myspgend(p,c)
mysp.mysppron(p,c)
mysp.myprosody(p,c)
mysp.mysplev(p,c)
from setuptools import setup
long_description="""*** Version-10 release: two new functions were added ***
The two new functions deploy different Machine Learning algorithms to estimate the speakers' spoken
language proficiency levels (only the prosody aspect not semantically).
Prosody is the study of the tune and rhythm of speech and how these features contribute to meaning.
Prosody is the study of those aspects of speech that typically apply to a level above that of the individual
phoneme and very often to sequences of words (in prosodic phrases). Features above the level of the phoneme
(or "segment") are referred to as suprasegmentals.
A phonetic study of prosody is a study of the suprasegmental features of speech. At the phonetic level,
prosody is characterised by:
1. vocal pitch (fundamental frequency)
2. acoustic intensity
3. rhythm (phoneme and syllable duration)
MyProsody is a Python library for measuring these acoustic features of speech (simultaneous speech, high entropy)
compared to ones of native speech. The acoustic features of native speech patterns have been observed and
established by employing Machine Learning algorithms. An acoustic model (algorithm) breaks recorded utterances
(48 kHz & 32 bit sampling rate and bit depth respectively) and detects syllable boundaries, fundamental frequency
contours, and formants. Its built-in functions recognize/measures:
Average_syll_pause_duration
No._long_pause
Speaking-time
No._of_words_in_minutes
Articulation_rate
No._words_in_minutes
formants_index
f0_index ((f0 is for fundamental frequency)
f0_quantile_25_index
f0_quantile_50_index
f0_quantile_75_index
f0_std
f0_max
f0_min
No._detected_vowel
perc%._correct_vowel
(f2/f1)_mean (1st and 2nd formant frequencies)
(f2/f1)_std
no._of_words
no._of_pauses
intonation_index
(voiced_syll_count)/(no_of_pause)
TOEFL_Scale_Score
Score_Shannon_index
speaking_rate
gender recognition
speech mood (semantic analysis)
pronunciation posterior score
articulation-rate
speech rate
filler words
f0 statistics
-------------
NEW
--------------
level (CEFR level)
prosody-aspects (comparison, native level)
The library was developed based upon the idea introduced by Klaus Zechner et al
*Automatic scoring of non-native spontaneous speech in tests of spoken English* Speech Communicaion vol
51-2009, Nivja DeJong and Ton Wempe [1], Paul Boersma and David Weenink [2], Carlo Gussenhoven [3],
S.M Witt and S.J. Young [4] and Yannick Jadoul [5].
Peaks in intensity (dB) that are preceded and followed by dips in intensity are considered as potential
syllable cores.
MyProsody is unique in its aim to provide a complete quantitative and analytical way to study acoustic
features of a speech. Moreover, those features could be analysed further by employing Python's
functionality to provide more fascinating insights into speech patterns.
This library is for Linguists, scientists, developers, speech and language therapy clinics and researchers.
Please note that MyProsody Analysis is currently in initial state though in active development. While the
amount of functionality that is currently present is not huge, more will be added over the next few months.
Installation
=============
Myprosody can be installed like any other Python library, using (a recent version of) the Python package
manager pip, on Linux, macOS, and Windows:
pip install myprosody
or, to update your installed version to the latest release:
pip install -u myprosody
NOTE:
=============
After installing Myprosody, download the folder called:
myprosody
from https://github.com/Shahabks/myprosody
and save on your computer. The folder includes the audio files folder where you will save your audio files
for analysis.
Audio files must be in *.wav format, recorded at 48 kHz sample frame and 24-32 bits of resolution.
To check how the myprosody functions behave, please check
EXAMPLES.pdf
on https://github.com/Shahabks/myprosody
Myprosody was developed by MYOLUTIONS Lab in Japan. It is part of New Generation of Voice Recognition and Acoustic & Language modelling
Project in MYSOLUTIONS Lab. That is planned to enrich the functionality of Myprosody by adding more advanced
functions."""
setup(name='myprosody',
version='10',
description='NEW VERSION: the prosodic features of speech (simultaneous speech) compared to the features of native speech +++ spoken language proficiency level estimator',
long_description=long_description,
url='https://github.com/Shahabks/myprosody',
author='Shahab Sabahi',
author_email='sabahi.s@mysol-gc.jp',
license='MIT',
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
],
keywords='praat speech signal processing phonetics',
install_requires=[
'numpy>=1.15.2',
'praat-parselmouth>=0.3.2',
'pandas>=0.23.4',
'scipy>=1.1.0',
'pickleshare>=0.7.5',
'scikit-learn>=0.20.2',
],
packages=['myprosody'],
zip_safe=False)
,average_syll_pause_duration,No._long_pause,speaking_time,ave_No._of_words_in_minutes,articulation_rate,No._words_in_minutes,formants_index,f0_index,f0_quantile_25_index,f0_quantile_50_index,f0_quantile_75_index,f0_std,f0_max,f0_min,No._detected_vowel,perc%._correct_vowel,(f2/f1)_mean,(f2/f1)_std,no._of_words,no._of_pauses,intonation_index,(voiced_syll_count)/(no_of_pause),TOEFL_Scale_Score,Score_Shannon_index,speaking_rate
count,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0,520.0
mean,0.8605969598692308,12.945962440311538,62.59323076923077,2.518096173119231,4.3634615384615385,107.19737200140385,371.57839859346154,0.9659444261788462,0.8979752612153846,179.32638882584618,0.978774687823077,51.26266793944231,390.41902438096156,78.87338589573076,82.56153846153846,0.5911082448115386,2.4538511483,0.7152254128653847,134.49807692307692,25.05576923076923,7.221153846153846,10.666672346961539,22.15,2.8966384615384615,3.1307692307692307
std,0.5182093241255592,10.5650594846985,40.72478269048824,0.22998667582582683,0.5273004818246455,22.45725606317618,20.15060548377844,0.12178670100504711,0.16454949501474603,34.237851329849164,0.11755351318944955,12.770571860248674,39.9339976895332,11.150162170924927,50.73019855863106,0.16179502674802976,0.2827764589763398,0.18815351287187568,94.07769508793068,15.411715302931972,1.6929909389163906,10.532270288665403,4.960013518534626,0.6481826855860794,0.7333346807322868
min,0.32,2.261335451,7.54,1.5615067480000002,3.0,28.00108004,327.06,0.7150403790000001,0.522027013,95.50871262,0.6422109810000001,14.39604874,192.0464154,60.61750438,3.0,0.066666667,1.570231608,0.39404583299999996,15.0,1.0,4.0,1.625,9.0,1.178,1.0
25%,0.64127125825,6.6551681055,25.3825,2.3865753339999998,4.0,94.94677548749999,358.26271027499996,0.8927416985,0.80304569275,164.09509022499998,0.910213274,43.030803275,384.07417000000004,72.409799585,38.0,0.46666666700000003,2.25561121525,0.5940275525000001,51.75,12.0,6.0,6.53629032275,19.0,2.48575,3.0
50%,0.7361035515000001,9.508095238,52.54,2.529843843,4.0,110.79772215,377.0716721,0.954491985,0.8861156294999999,182.5069874,0.969493785,52.38127351,399.6276496,79.045860065,75.0,0.583333333,2.4608981455,0.685492004,107.5,22.0,7.0,8.625,22.0,2.93,3.0
75%,0.85710545775,15.0387528375,93.2025,2.65602008775,5.0,121.921153725,388.01647427500006,1.02866088675,1.012162024,198.4087777,1.0409318225000002,60.693097825,418.4163125,80.3394204525,119.0,0.7158961595,2.6453157129999996,0.79934069075,194.75,36.0,9.0,11.887500002500001,26.0,3.385,4.0
max,4.689212121000001,92.25333333,181.83,3.3529533639999998,6.0,190.560794,399.6609917,1.427151945,1.442502751,313.60393860000005,1.473006332,84.0325436,424.380037,179.83311369999998,304.0,0.970588235,3.6152396330000003,2.107762509,403.0,93.0,10.0,125.5,29.0,3.96,6.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment