From bd8a1392ab28259a61d2fa7c7b9933af42896f47 Mon Sep 17 00:00:00 2001 From: Rob van Son Date: Mon, 5 Dec 2016 14:47:21 +0100 Subject: [PATCH] Test of creaky voice detector --- ToneProt/SGC_ToneProt.praat | 137 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 133 insertions(+), 4 deletions(-) diff --git a/ToneProt/SGC_ToneProt.praat b/ToneProt/SGC_ToneProt.praat index 0d1001b..a44501a 100644 --- a/ToneProt/SGC_ToneProt.praat +++ b/ToneProt/SGC_ToneProt.praat @@ -137,7 +137,7 @@ procedure sgc_ToneProt sgc_ToneProt.currentSound$ sgc_ToneProt.pinyin$ sgc_ToneP # If there is a third tone, replace creaky voice by low pitch # ################################################################ - if 0 and index(sgc_ToneProt.pinyin$, "3") + if index(sgc_ToneProt.pinyin$, "3") .creakCO = 0.030 .delta = 0.0000001 # Reassign creacky voice parts @@ -149,6 +149,11 @@ procedure sgc_ToneProt sgc_ToneProt.currentSound$ sgc_ToneProt.pinyin$ sgc_ToneP .numSamples = Get number of samples .voiceTier = To TextGrid: "voice", "" + call createShimmerContour .sound + .shimmer = selected("Sound") + call createCPPContour .sound + .cpp = selected("Sound") + # Create a tier with creaky voice intervals select .jitterShimmer .prevV = Get value at sample number: 0, 1 @@ -236,8 +241,8 @@ procedure sgc_ToneProt sgc_ToneProt.currentSound$ sgc_ToneProt.pinyin$ sgc_ToneP .newPitch = 0 # Clean up - select .jitterShimmer - plus .origPointProcess + select .origPointProcess + #plus .jitterShimmer plus .vuvTier plus .voiceTier plus .recordedPitchTier @@ -637,7 +642,7 @@ procedure createJitterShimmerContour .sound .pointProc = To PointProcess (periodic, cc): 60, 350 .dT = 0.01 - .w_half = 0.2/2 + .w_half = 0.075/2 .t = 0.0 .sampleNum = 1 while .t < .duration - .dT @@ -665,4 +670,128 @@ procedure createJitterShimmerContour .sound select .jitshimSound endproc +procedure createShimmerCPPcontour .sound + call createCPPContour .sound + .cpp = selected("Sound") + + select .sound + .duration = Get total duration + .shimmerCPPSound = Create Sound: "ShimmerCPP", 0, .duration, 100, "0" + + # Create pointprocess + select .sound + .pointProc = To PointProcess (periodic, cc): 60, 350 + + .dT = 0.01 + .w_half = 0.075/2 + .t = 0.0 + .sampleNum = 1 + while .t < .duration - .dT + select .sound + plus .pointProc + .shimmer = Get shimmer (local): .t-.w_half, .t+.w_half, 0.0001, 0.02, 1.3, 1.6 + if .shimmer = undefined + .shimmer = 0 + endif + select .cpp + .cppValue = Get value at time: 0, .t, "Sinc70" + if .cppValue = undefined or .cppValue < 1 + .cppValue = 1 + endif + select .shimmerCPPSound + Set value at sample number: 0, .sampleNum, 10* .shimmer / .cppValue + + .t += .dT + .sampleNum += 1 + endwhile + + select .pointProc + plus .cpp + Remove + + select .shimmerCPPSound + +endproc + +# Use ~? cutoff +procedure createShimmerContour .sound + select .sound + .duration = Get total duration + .shimmerSound = Create Sound: "Shimmer", 0, .duration, 100, "0" + + # Create pointprocess + select .sound + .pointProc = To PointProcess (periodic, cc): 60, 350 + + .dT = 0.01 + .w_half = 0.075/2 + .t = 0.0 + .sampleNum = 1 + while .t < .duration - .dT + select .sound + plus .pointProc + .shimmer = Get shimmer (local): .t-.w_half, .t+.w_half, 0.0001, 0.02, 1.3, 1.6 + if .shimmer = undefined + .shimmer = 0 + endif + select .shimmerSound + Set value at sample number: 0, .sampleNum, .shimmer + + .t += .dT + .sampleNum += 1 + endwhile + + select .pointProc + Remove + + select .shimmerSound +endproc + + +# Use ~? cutoff +procedure createCPPContour .sound + select .sound + .dT = 0.01 + + # Create pointprocess + select .sound + .duration = Get total duration + .pcg = To PowerCepstrogram: 60, .dT, 5000, 50 + .cppTable = To Table (peak prominence): 60, 330, 0.05, "Parabolic", 0.001, 0, "Exponential decay", "Robust" + .nRows = Get number of rows + .lastTime = Get value: .nRows, "time" + .lastTime += .dT + while .lastTime < .duration - .dT + Append row + .nRows += 1 + Set numeric value: .nRows, "cpp", 0 + .lastTime += .dT + endwhile + .firstTime = Get value: 1, "time" + .firstTime -= .dT + while .firstTime >= .dT/2 + Insert row: 1 + Set numeric value: 1, "cpp", 0 + .firstTime -= .dT + endwhile + Remove column: "quefrency" + Remove column: "f0" + Remove column: "rnr" + Remove column: "time" + .cppTable2 = Transpose + .cppMatrix = Down to Matrix + .cppSound = To Sound (slice): 1 + Override sampling frequency: 1/.dT + Shift times to: "start time", 0 + Rename: "CPP" + + select .pcg + plus .cppTable + plus .cppTable2 + plus .cppMatrix + Remove + + select .cppSound +endproc + -- 2.11.4.GIT