Debian Codegraph @

test/dwtools/KlattSlope.praat

raw
1 # KlattSlope.praat
2 # Paul Boersma, 25 November 2010
3
4 # This script tests whether a sound created with the Klatt synthesizer
5 # is similar to a sound created with "To Sound (phonation)".
6
7 openPhase = 0.7
8 collisionPhase = 0.03;hertzToErb(300)/35;0.03
9 power = 3.0
10 f1 = 250
11 b1 = 100
12 f2 = 3200
13 b2 = 100
14 duration = 0.8
15 f0start = 150
16 f0end = 110
17 ;bandwidthFormula$ = "100"
18 bandwidthFormula$ = "(formant-0.5)*1000/10"
19
20 numberOfFormants = 20
21
22 pitchTier = Create PitchTier... a 0 duration
23 Add point... 0 f0start
24 Add point... duration f0end
25 pulses = To PointProcess
26 sound = To Sound (phonation)... 44100 1.0 0.05 openPhase collisionPhase power power+1.0
27 ;sound = To Sound (pulse train)... 44100 1.0 0.05 2000
28 Filter with one formant (in-line)... f1 b1
29 Filter with one formant (in-line)... f2 b2
30 for formant from 3 to numberOfFormants
31 Filter with one formant (in-line)... (formant-0.5)*1000 'bandwidthFormula$'
32 endfor
33 spectrum = To Spectrum... yes
34 slope1 = Get band density difference... 0 1000 2000 4000
35 echo 'slope1:6' dB
36 removeObject: pitchTier, pulses, sound, spectrum
37
38 klatt = Create KlattGrid... a 0 duration numberOfFormants 0 0 0 0 0 0
39 #klatt = Create KlattGrid: "a", 0, duration, numberOfFormants, 0, 0, 0, 0, 0, 0
40 Add voicing amplitude point... 0 90.0
41 Add pitch point... 0 f0start
42 Add pitch point... duration f0end
43 Add power1 point... 0 power
44 Add power2 point... 0 power+1.0
45 Add open phase point... 0 openPhase
46 Add collision phase point... 0 collisionPhase
47 Add oral formant frequency point... 1 0 f1
48 Add oral formant bandwidth point... 1 0 b1
49 Add oral formant frequency point... 2 0 f2
50 Add oral formant bandwidth point... 2 0 b2
51 for formant from 3 to numberOfFormants
52 Add oral formant frequency point... formant 0 (formant-0.5)*1000
53 Add oral formant bandwidth point... formant 0 'bandwidthFormula$'
54 endfor
55 ;To Sound (special)... 0 0 44100 yes yes yes yes yes yes "Powers in tiers" yes yes yes Cascade 1 numberOfFormants 1 1 0 0 0 0 0 0 0 0 0 0 0 0 yes
56 To Sound
57 To Spectrum... yes
58 slope2 = Get band density difference... 0 1000 2000 4000
59 printline 'slope2:6' dB
60 removeObject: klatt, "Sound a", "Spectrum a"