-
Notifications
You must be signed in to change notification settings - Fork 0
/
eti_ToBI.praat
executable file
·2836 lines (2221 loc) · 91.3 KB
/
eti_ToBI.praat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Eti_ToBI v.8 (2024)
# Cite as: Elvira-García, W., Roseano, P., Fernández-Planas, A. M., & Martínez-Celdrán, E. (2016). A tool for automatic transcription of intonation: Eti_ToBI a ToBI transcriber for Spanish and Catalan. Language Resources and Evaluation, 50, 767-792.
#
# DESCRIPTION
# This is a tool that automatically labels intonational events according to the Sp_ToBI and Cat_ToBI 2015 current systems. T
# The system consist on a Praat script that assigns ToBI labels from lexical data introduced by the researcher and the
# acoustical data that it extracts from sound files. The reliability results for both Cat_ToBI and Sp_ToBI corpora shows
# a level of agreement equal to the one shown by human transcribers among them in the literature.
#
#
#
# INSTRUCTIONS
# 0. Needs
# a) a folder with sounds (a sentence in each wav)
# b) by-syllable textgrid with a mark for the stressed syllables and the same name as the wav (without spaces). You can find wav+textgrid examples at the website
#
#
# Wendy Elvira-García (2013-2024). Eti-ToBI. [praat script] Retrieved from https://github.com/wendyelviragarcia/eti_ToBI
# wendy elvira (at) ub.edu
#
# Laboratori de Fonètica (Universitat de Barcelona)
#
#
# LICENSE
# Copyright (C) 2015 Wendy Elvira-García
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
# 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. See the
# GNU General Public License for more details.
# You can find the terms of the GNU General Public License here
# http://www.gnu.org/licenses/gpl-3.0.en.html
##### FORMULARIO ##########
form Sp_ToBI Cat_ToBI transcriber
#sentence folder /Users/weg/Desktop/test
comment Your folder should be something like
comment C:\Users\someName\Desktop (Windows)
comment or
comment /Users/someName/Desktop (Mac)
sentence folder ./data_for_testing/
# EN EL LAB
word Marca_de_tonica ˈ
comment ¿En que número de tier está la marca de tonicidad?
integer segmentation_tier 1
comment ¿Tienes marcados los break indices?
boolean BI 1
#comment ¿En qué número de tier?
integer Tier_BI 2
comment ¿En qué número de tier quieres hacer la inserción de los tonos?
integer Tier_Tones 3
real umbral_(St) 1.5
real umbral_upstep_(St) 6.0
comment Elige los tipos de etiquetaje:
boolean Etiquetaje_superficial 1
boolean Etiquetaje_profundo 1
boolean Etiquetaje_normalizado 1
#comment Indica la lengua del etiquetaje fonológico:
optionmenu Lengua 2
option General
option Sp_ToBI
option Cat_ToBI
option Fri_ToBI
comment ¿Quieres parar para corregir?
boolean correccion 0
boolean create_picture 1
integer iniciar_en_archivo 1
boolean Verbose 1
endform
if etiquetaje_profundo = 1 or etiquetaje_normalizado = 1
beginPause: "Tipo de etiquetaje"
comment: "¿Cuáles de estas etiquetas quieres que aparexcan en el etiquetaje profundo?"
optionMenu: "Displaced_prenuclear", 1
option: "L+<H*"
option: "L*+H"
optionMenu: "Upstep", 1
option: "L+¡H*"
option: "L+H*"
optionMenu: "Pretonica_upstep", 2
option: "¡H+L*"
option: "H+L*"
optionMenu: "Descenso_tonica", 2
option: "H*+L"
option: "H*"
optionMenu: "Ascenso_tardio", 2
option: "L* LH%"
option: "L* H%"
optionMenu: "Tritonal_Argentina", 2
option: "L+H*+L"
option: "no"
comment ("Cuando acabes, clica Continuar para empezar")
clicked = endPause ("Continuar", 2)
endif
############## VARIABLES ######################
debug = 0
verbose = 1
rango$ = "60-600"
from = iniciar_en_archivo
a = displaced_prenuclear
b= upstep
c= descenso_tonica
d = ascenso_tardio
f = tritonal_Argentina
g= pretonica_upstep
#comment ¿Quieres el etiquetaje en un nuevo tier?
nuevo_tier_Tones = 1
if etiquetaje_normalizado=1 and etiquetaje_profundo =0
pause La estandarización parte del etiquetaje profundo.
endif
if etiquetaje_profundo =1 and etiquetaje_superficial =0
pause El etiquetaje profundo parte del etiquetaje superficial.
endif
f0_max = extractNumber (rango$, "-")
f0_max$ = "'f0_max'"
f0_min$ = "'rango$'" - "'f0_max$'"
f0_min$= "'f0_min$'" - "-"
f0_min = 'f0_min$'
numberOfLetras = 15
umbralnegativo = umbral - (2*umbral)
ultimastressed = 0
etiquetaprofunda$ = "* no"
etiquetatonoprofundo$ = " * aguda"
etiquetafinalprofunda$ = "\% "
# for spanish nucleus is always last lexical stress
nucleus_method$ = "manual"
############## BUCLE GENERAL ######################
# Crea la lista de objetos desde el string
myFileList= Create Strings as file list: "list", folder$ + "/" + "*"
numberOfFiles = Get number of strings
for stri to numberOfFiles
filename$ = Get string: stri
if (right$(filename$, 4) <> ".wav") and (right$(filename$, 4) <> ".WAV")
Remove string: stri
stri= stri-1
numberOfFiles= numberOfFiles-1
endif
endfor
numberOfFiles = Get number of strings
if numberOfFiles = 0
exitScript: "There are no .wav or .WAV files in folder" + folder$
endif
#allTable = Create Table with column names: "allTable", 0, "file interval humanNPA NPA intensity stringInt range stringRange dur stringDur durPre"
nucleusData = Create Table with column names: "nucleus", 0, "file nucleus last difInt nucleusRange range lastRange "
#bucle archivos
for ifile from 'from' to numberOfFiles
stressedstotalesfile= 0
select Strings list
soundFile$ = Get string: ifile
base$ = soundFile$ - ".wav"
base$ = base$ - ".WAV"
writeInfoLine: "Working on file " + string$(ifile) + ": "+ base$
#reads sound
if fileReadable(folder$ +"/" + soundFile$)
mySound = Read from file: folder$ +"/" + soundFile$
else
exitScript: "No file in " + folder$ + " called " + soundFile$ + "."
endif
#reads grid
if fileReadable(folder$ + "/" +base$ + ".TextGrid")
myText = Read from file: folder$ + "/" +base$ + ".TextGrid"
else
exitScript: "There are no TextGrids matching your sound " + base$ + ". Check for spaces in filename"
endif
numberOfIntervals = Get number of intervals: segmentation_tier
soundBegins = Get end point: segmentation_tier, 1
soundEnds = Get start point: segmentation_tier, numberOfIntervals
######### CREA OBJETOS ########
#clean soundwav
selectObject: mySound
filteredSound = Filter (stop Hann band): 2000, 5000, 100
Rename: base$
firstPitch = To Pitch: 0.001, f0_min, f0_max
f0medial = do ("Get mean...", 0, 0, "Hertz")
@printData("fileMean: " + fixed$(f0medial,0)+"Hz")
#cuantiles teoría de Hirst (2011) analysis by synthesis of speach melody
q25 = Get quantile: soundBegins, soundEnds, 0.25, "Hertz"
q75 = Get quantile: soundBegins, soundEnds, 0.75, "Hertz"
if q25 != undefined
minpitch = q25 * 0.75
else
minpitch = f0_min
endif
if q75 != undefined
maxpitch = q75 * 1.5
#set to 2.5 for expressive speech because portuguese range goes over the octave, else 1.5
else
maxpitch= f0_max
endif
selectObject: filteredSound
myPitch = To Pitch: 0.001, minpitch, maxpitch
Kill octave jumps
removeObject: firstPitch, filteredSound
gama = maxpitch - minpitch
terciogama = gama/3
tercio1 = minpitch + terciogama
tercio2 = minpitch + (2*terciogama)
tercio3 = minpitch + (3*terciogama)
@printData("Low range less than: "+ fixed$(tercio2,0) +"Hz. Mid range from: "+ fixed$(tercio1,0) + " Hz. High range more than"+ fixed$(tercio2,0)+ "Hz.")
Interpolate
myPitchTier= Down to PitchTier
selectObject: mySound
intensity = To Intensity: 100, 0, "yes"
intTable = Create Table with column names: "intTable", 0, "interval intensity stringInt range stringRange dur stringDur durPre"
######### EMPIEZA EL SCRIPT #####################
selectObject: myText
numberOfIntervals = Get number of intervals: segmentation_tier
i = 1
### sustitucion de caracteres
marcatonicacompleja$ = "\'1"
if marca_de_tonica$ = marcatonicacompleja$
select TextGrid 'base$'
do ("Replace interval text...", segmentation_tier, i, numberOfIntervals, "\'1", "ˈ", "Regular Expressions")
marca_de_tonica$ = "ˈ"
endif
#####################
if nuevo_tier_Tones = 1
Insert point tier... 'tier_Tones' "Tones"
endif
if etiquetaje_profundo = 1
deep_tier = tier_Tones + 1
Insert point tier... 'deep_tier' "Tones II"
endif
#bucle silabas
if bI =1
numberOfIPs = Count points where: tier_BI, "is equal to", "4"
myPointProcess = Get points: tier_BI, "is equal to", "4"
endIntervalIP =1
else
numberOfIPs = 1
selectObject: "TextGrid " + base$
endOfSound= Get end time
lastInt = Get number of intervals: segmentation_tier
lastBoundary = Get end point: segmentation_tier, lastInt
myPointProcess = Create empty PointProcess: base$, 0, endOfSound
Add point: lastBoundary
endIntervalIP = 1
endif
startIntervalIP = 0
iIP = 1
numberOfsyllablesIP = 0
for iIP from 1 to numberOfIPs
# get la aparicion iIP de las ip
stressedstotalesfrase = 0
stressedInventory = Create Table with column names: "stressedInventory", 0, "n nInterval isNucleus"
selectObject: myPointProcess
timeOf4Boundary = Get time from index: iIP
select TextGrid 'base$'
endIntervalIP = Get interval at time: segmentation_tier, timeOf4Boundary
endIntervalIP =endIntervalIP-1
actualInterval=0
i=1
for i to endIntervalIP-startIntervalIP
actualInterval = startIntervalIP + i
numberOfsyllablesIP =numberOfsyllablesIP
if actualInterval < numberOfIntervals
#for i to numberOfIntervals
numberdesdeelfinal = endIntervalIP - actualInterval
select TextGrid 'base$'
labeli$ = Get label of interval: segmentation_tier, actualInterval
# Hago un array que guarda los caracteres en variables diferentes
for letra from 1 to numberOfLetras
labeltext$[letra] = mid$ ("'labeli$'", letra)
endfor
if labeltext$[1] = marca_de_tonica$
ultimastressed = actualInterval
delayedPeak= 0
stressedstotalesfrase = stressedstotalesfrase + 1
stressedstotalesfile = stressedstotalesfile + 1
selectObject: stressedInventory
Append row
Set numeric value: stressedstotalesfrase, "n", stressedstotalesfrase
Set numeric value: stressedstotalesfrase, "nInterval", actualInterval
if nucleus_method$ = "manual"
if index(labeli$, marca_de_tonica$) != 0
Set string value: stressedstotalesfrase, "isNucleus", "yes"
else
Set string value: stressedstotalesfrase, "isNucleus", "no"
endif
else
Set string value: stressedstotalesfrase, "isNucleus", "no"
endif
if ultimastressed < 1
exitScript: "No stress marks found"
endif
@printData: ""
@printData: "Analysing stress syl in interval:" + fixed$(ultimastressed, 0)
selectObject: myText
startingpointstressed = Get start point... 'segmentation_tier' 'actualInterval'
endingpointstressed = Get end point... 'segmentation_tier' 'actualInterval'
durtonica = endingpointstressed - startingpointstressed
midstressed = startingpointstressed + (durtonica/2)
numberOfIntervalPrestressed = actualInterval - (1)
startingpointprestressed = Get start point... 'segmentation_tier' 'numberOfIntervalPrestressed'
endingpointprestressed = Get end point... 'segmentation_tier' 'numberOfIntervalPrestressed'
durpretonica = endingpointprestressed - startingpointprestressed
midprestressed = startingpointprestressed + (durpretonica/2)
@printData("tónica centro: " + fixed$(midstressed,0))
numberOfIntervalpoststressed = actualInterval + 1
startingpointpoststressed = Get start point... 'segmentation_tier' 'numberOfIntervalpoststressed'
endingpointpoststressed = Get end point... 'segmentation_tier' 'numberOfIntervalpoststressed'
durpoststressed = endingpointpoststressed - startingpointpoststressed
mediopoststressed = startingpointpoststressed + (durpoststressed/2)
@printData("inicio postónica: " + fixed$(startingpointpoststressed,0)+"medio postónica: " + fixed$(mediopoststressed,0)+"final postónica: " + fixed$(endingpointpoststressed,0) )
selectObject: intensity
meanInt = Get mean: startingpointstressed, endingpointpoststressed, "energy"
if meanInt= undefined
meanInt = 0
endif
selectObject: intTable
Append row
Set numeric value: stressedstotalesfile, "interval", actualInterval
Set numeric value: stressedstotalesfile, "intensity", meanInt
stringInt$ = string$(meanInt)
Set string value: stressedstotalesfile, "stringInt", stringInt$
select PitchTier 'base$'
rangeStressed = Get standard deviation (curve): startingpointstressed, endingpointstressed
selectObject: intTable
Set numeric value: stressedstotalesfile, "range", rangeStressed
stringRange$ = string$(rangeStressed)
Set string value: stressedstotalesfile, "stringRange", stringRange$
#obtención de valores pitch
select PitchTier 'base$'
f01pre = Get value at time... 'startingpointprestressed'
f02pre = Get value at time... 'midprestressed'
f03pre = Get value at time... 'endingpointprestressed'
if numberOfIntervalPrestressed = 1
f02pre = Get value at time... 'startingpointstressed'
f01pre = Get value at time... 'startingpointstressed'
f03pre = Get value at time... 'startingpointstressed'
endif
@printData: "Mid pre-stressed value: " + fixed$(midprestressed,0)
f01ton = Get value at time... 'startingpointstressed'
f02ton = Get value at time... 'midstressed'
f03ton = Get value at time... 'endingpointstressed'
f01pos = Get value at time... 'startingpointpoststressed'
f02pos = Get value at time... 'mediopoststressed'
f03pos = Get value at time... 'endingpointpoststressed'
select Pitch 'base$'
f0tonmax = Get maximum: startingpointstressed, endingpointstressed, "Hertz", "Parabolic"
if f0tonmax=undefined
@undefined: f0tonmax, endingpointstressed
f0tonmax = value
endif
f0tonmin = Get minimum: startingpointstressed, endingpointstressed, "Hertz", "Parabolic"
if f0tonmin=undefined
@undefined: f0tonmin, endingpointstressed
f0tonmin = value
endif
f0targetpos = Get maximum: startingpointpoststressed, endingpointpoststressed, "Hertz", "Parabolic"
timeOfPeakPos = Get time of maximum: startingpointpoststressed, endingpointpoststressed, "Hertz", "Parabolic"
if f0targetpos= undefined
@undefined: f0targetpos, endingpointpoststressed
f0targetpos = value
timeOfPeakPos = time
if f0targetpos = undefined
f0targetpos = minpitch
endif
endif
##### DIFERENCIA EN ST ENTRE DOS FRECUENCIAS ###############
difpreton = (12 / log10 (2)) * log10 ('f02ton' / 'f02pre')
diftonpos = (12 / log10 (2)) * log10 ('f02pos' / 'f02ton')
difton2pos3 = (12 / log10 (2)) * log10 ('f03pos' / 'f02ton')
difpremaxton = (12 / log10 (2)) * log10 ('f0tonmax' / 'f02pre')
diftonMidEnd = (12 / log10 (2)) * log10 ('f03ton' / 'f01ton')
diftontargetpos = (12 / log10 (2)) * log10 ('f0targetpos' / 'f0tonmin')
diftonmintonmax = (12 / log10 (2)) * log10 ('f0tonmax' / 'f0tonmin')
@printData: "Prenuclear analysis: Differences between pre/str " + fixed$(difpreton,0) + " str/post "+ fixed$(diftonpos,0)
################ FORMULAS ####################
######### Fórmulas que calculan el pitch accent prenuclear ########################
#En realidad calculan todos los acentos depués el nuclear se rescribirá
etiquetatono$= "prenuclear"
etiquetatonoprofundo$= "prenuclear"
@printData: ""
@printData: "Prenuclear formulae"
############### Tonos a partir de la mediana ##################
if abs (difpreton) < 'umbral' and abs (diftontargetpos) < 'umbral' and f02ton < tercio2
etiquetatono$ = "L*"
etiquetatonoprofundo$ = "L*"
@printData: "L*"
endif
if abs (difpreton) < 'umbral' and abs (diftontargetpos) < 'umbral' and f02ton >= tercio2
etiquetatono$ = "H*"
etiquetatonoprofundo$ = "H*"
@printData: "H*"
endif
#CALCULO DEL TONO EN VEZ DE POR TERCIOS POR DECLINACION
select TextGrid 'base$'
numeropuntosahora = Get number of points: 'tier_Tones'
if numeropuntosahora >=2
labelstressedprevious$ = Get label of point: tier_Tones, numeropuntosahora-1
tpuntoanterior = Get time of point: tier_Tones, numeropuntosahora-1
select PitchTier 'base$'
f0_puntoanterior = Get value at time: tpuntoanterior
select TextGrid 'base$'
intervaloptoanterior = Get interval at time: segmentation_tier, tpuntoanterior
iniciointervaloanterior = Get start point: segmentation_tier, intervaloptoanterior
finintervaloanterior = Get end point: segmentation_tier, intervaloptoanterior
select Pitch 'base$'
f0maxtonicaanterior = Get maximum: iniciointervaloanterior, finintervaloanterior, "Hertz", "Parabolic"
if f0maxtonicaanterior = undefined
@undefined: f0maxtonicaanterior, finintervaloanterior
f0maxtonicaanterior = value
endif
difconlaanterior = (12 / log10 (2)) * log10 (f0maxtonicaanterior / f0_puntoanterior)
@printData: "Diff from last str. syl peak: " + string$(difconlaanterior)
if ('difconlaanterior' > 'umbralnegativo') and ((labelstressedprevious$ = "H*") or (labelstressedprevious$ = "L*+H") or (labelstressedprevious$ = "L+H*") or (labelstressedprevious$ = "(L+H*)+H")or (labelstressedprevious$ = "L+(H*+H)") or (labelstressedprevious$ = "L*+(H+H)") or (labelstressedprevious$ = "(L*+H)+H)") or (labelstressedprevious$ = "(L+H*)+L)"))
pitchaccent$ = "H*"
etiquetatono$ = "H*"
etiquetatonoprofundo$ = "H*"
tonicaH= 1
@printData: "H*, lack declination from previous point"
else
pitchaccent$ = "L*"
etiquetatono$ = "L*"
etiquetatonoprofundo$ = "L*"
tonicaH= 0
@printData: "L*"
endif
endif
####### Desacentuación
if difpreton < 'umbralnegativo' and diftonpos < 'umbralnegativo'
etiquetatono$ = "des"
etiquetatonoprofundo$= "des"
@printData: "L*, has been declination from previous point"
endif
#etiqueta muy simple debería mirar si el target está en la postónica
if diftonMidEnd > umbral
etiquetatono$ = "L+H*"
etiquetatonoprofundo$= "L+H*"
endif
if difpreton > umbral
etiquetatono$ = "L+H*"
etiquetatonoprofundo$ = "L+H*"
endif
if diftontargetpos > umbral
etiquetatono$ = "L*+H"
etiquetatonoprofundo$ = "L*+H"
endif
if diftontargetpos < umbralnegativo
etiquetatono$ = "H*+L"
etiquetatonoprofundo$ = "H*+L"
endif
if difpreton < umbralnegativo
etiquetatono$ = "H+L*"
etiquetatonoprofundo$ = "H+L*"
endif
#fórmula para las preguntas del que solo aplica al catalán. Bajada significativa entre incio tónica y final tónica.
if lengua = 3 and diftonMidEnd < 'umbralnegativo'
etiquetatono$ = "H+L*"
etiquetatonoprofundo$= "H+L*"
@printData: "formula pre H+L* preg que"
endif
#si puedes mira el pto anterior y pon si el plateu es alto o bajo dependiendo del tono anterior
select TextGrid 'base$'
numeropuntosahora = Get number of points: 'tier_Tones'
if abs (difpreton) < umbral and abs (diftonpos) < 'umbral' and (numeropuntosahora >= 1) and (diftonMidEnd > umbralnegativo)
labelstressedprevious$ = Get label of point: tier_Tones, numeropuntosahora
if (labelstressedprevious$ = "H*") or (labelstressedprevious$ = "L*+H") or (labelstressedprevious$ = "L+H*") or (labelstressedprevious$ = "(L+H*)+H")or (labelstressedprevious$ = "L+(H*+H)") or (labelstressedprevious$ = "L*+(H+H)")or (labelstressedprevious$ = "(L*+H)+H)")
#ves a buscar el valor de del punto anterior y si del punto anterior al punto de ahora no pasa el umbral negativo etiquetalo como H*
select TextGrid 'base$'
tpuntoanterior = Get time of point: tier_Tones, numeropuntosahora
select PitchTier 'base$'
f0_puntoanterior = Get value at time: tpuntoanterior
difconlaanterior = (12 / log10 (2)) * log10 ('f02ton' / 'f0_puntoanterior')
if difconlaanterior > 'umbralnegativo'
etiquetatono$ = "H*"
etiquetatonoprofundo$ = "H*"
endif
endif
endif
########################################################
if abs (diftonmintonmax) < 'umbral' and diftontargetpos >= 'umbral'
etiquetatono$ = "L*+H"
etiquetatonoprofundo$ = "L*+H"
@printData: "fórmula prenúcleo L*+H"
endif
if abs (diftonmintonmax) < 'umbral' and diftonpos < 'umbralnegativo'
etiquetatono$ = "H*+L"
if c = 2
etiquetatonoprofundo$ = "H*"
endif
if c = 1
etiquetatonoprofundo$ = "H*+L"
endif
@printData: "fórmula prenúcleo H*+L"
endif
######
# H+L* PUESTO PARA QUE DIGA DESACENTUADO SI VIENE DE OTRO TONO
# hay una diferencia en la tónica que pasa el umbral, esa diferencia es negativa, y de la tónica al target de la postónica no pasa el umbral
if (diftonmintonmax > 'umbral') and (diftonMidEnd < 0) and (abs (diftontargetpos) < 'umbral')
etiquetatono$ = "H+L*"
etiquetatonoprofundo$ = "H+L*"
if lengua = 2 or lengua = 3
select TextGrid 'base$'
numeropuntosahora = Get number of points: 'tier_Tones'
if numeropuntosahora >=1
labelstressedprevious$ = Get label of point: tier_Tones, numeropuntosahora
if labelstressedprevious$ ="L*+H" or labelstressedprevious$ ="H+(L*+H)"
tpuntoanterior = Get time of point: tier_Tones, numeropuntosahora
intervaloultimotono = Get interval at time: segmentation_tier, tpuntoanterior
intervalotarget = intervaloultimotono + 1
inicio_target = Get start point: segmentation_tier, intervaloultimotono
fin_target = Get end point: segmentation_tier, intervaloultimotono+1
select Pitch 'base$'
f0_targetanterior = Get maximum: inicio_target, fin_target, "Hertz", "Parabolic"
if f0_targetanterior=undefined
@undefined: f0_targetanterior, fin_target
f0_targetanterior = value
endif
#select PitchTier 'base$'
#f0_targetanterior = Get value at time: fin_target
difconlaanterior = (12 / log10 (2)) * log10 ('f02pre' / 'f0_targetanterior')
@printData: "difconlaanterior: " + fixed$(difconlaanterior, 0)
if difconlaanterior < umbralnegativo
etiquetatono$ = "H+L*/L*"
etiquetatonoprofundo$ = "L*"
@printData: "fórmula prenúcleo H+L*/L*"
endif
endif
endif
endif
endif
# las replicas sevillans #PARA LAS DE QUE CON PRETÓNICA EXTRALTA DEL CATALAN
if (lengua =3 or lengua = 2) and (difpreton < 'umbralnegativo') and (abs (diftonpos) < 'umbral') and (f02pre>f01pre) and (f02pre>f03pre)
etiquetatono$ = "\!dH+L*"
if g = 1
etiquetatonoprofundo$ = "\!dH+L*"
else
etiquetatonoprofundo$ = "H+L*"
endif
@printData: "fórmula prenúcleo ¡H+L* pretónica extraalta"
endif
#subida entre la pretonica y la tónica y entre la tónica y la postónica. Y los dos movimientos pasan el umbral.
if difpreton >= 'umbral' and diftonpos>= 'umbral'
etiquetatono$ = "L+H*+H"
@printData: "fórmula prenúcleo L+H*+H"
if abs (difpreton) < abs (diftonpos)
etiquetatono$ = "(L+H*)+H"
etiquetatonoprofundo$ = "L*+H"
if a =1
etiquetatonoprofundo$= "L+<H*"
endif
else
etiquetatono$ = "L+(H*+H)"
etiquetatonoprofundo$ = "L*+H"
if a =1
etiquetatonoprofundo$= "L+<H*"
endif
endif
if f = 1
etiquetatonoprofundo$= "L+H*+L"
endif
endif
# subida entre la pretónica y la tónica con el pico al final la postónica o más allá
if difpreton> umbral and f03pos > f01pos
etiquetatono$ = "L*+H"
etiquetatonoprofundo$= "L*+H"
endif
# subida entre la pretónica y la tónica con el pico entre el final de la tónica y el principio de la postónica (L+H* clásico)
if difpreton >= 'umbral' and f01pos >= f03pos
etiquetatono$ = "L+H*"
etiquetatonoprofundo$ = "L+H*"
@printData: "fórmula prenúcleo L*+\!dH*"
endif
# ETIQUETA CUESTIONABLE subida entre la pretónica y la tónica con el pico en el centro de la postónica
if (diftonmintonmax >= 'umbral') and (diftonMidEnd >0) and (f01pos >= f02ton) and (f02pos >= f01pos) and (f02pos >= f03pos)
etiquetatono$ = "L+H*+H"
@printData: "fórmula prenúcleo L+H*+H"
if abs (diftonmintonmax) < abs (diftonpos)
etiquetatono$ = "(L+H*)+H"
etiquetatonoprofundo$ = "L*+H"
if a =1
etiquetatonoprofundo$= "L+<H*"
endif
else
etiquetatono$ = "L+(H*+H)"
etiquetatonoprofundo$ = "L*+H"
if a =1
etiquetatonoprofundo$= "L+<H*"
endif
endif
endif
# Una bajada que pasa el umbral de la pretónica a la tónica y una subida en la postónica que también pasa el umbral
if difpreton < 'umbralnegativo' and diftontargetpos >= 'umbral'
#si el movimiento es mayor de la pretónica a la tónica
if abs (difpreton) >= abs (diftontargetpos)
etiquetatono$ = "H+(L*+H)"
etiquetatonoprofundo$= "H*+L"
#si el movimiento es mayor de la tónica a la postónica
else
etiquetatono$ = "(H+L*)+H"
etiquetatonoprofundo$= "L*+H"
endif
if lengua = 2 or lengua = 3
select TextGrid 'base$'
numeropuntosahora = Get number of points: 'tier_Tones'
if numeropuntosahora >=1
labelstressedprevious$ = Get label of point: tier_Tones, numeropuntosahora
if (labelstressedprevious$ = "L*+H") or (labelstressedprevious$ ="L+(H*+H)") or (labelstressedprevious$ ="(L+H*)+H")
tpuntoanterior = Get time of point: tier_Tones, numeropuntosahora
intervaloultimotono = Get interval at time: segmentation_tier, tpuntoanterior
intervalotarget = intervaloultimotono + 1
inicio_target = Get start point: segmentation_tier, intervaloultimotono
fin_target = Get end point: segmentation_tier, intervaloultimotono+1
select Pitch 'base$'
f0_targetanterior = Get maximum: inicio_target, fin_target, "Hertz", "Parabolic"
if f0_targetanterior = undefined
@undefined: f0_targetanterior, fin_target
f0_targetanterior = value
endif
#select PitchTier 'base$'
#f0_targetanterior = Get value at time: fin_target
difconlaanterior = (12 / log10 (2)) * log10 ('f0tonmin' / 'f0_targetanterior')
if difconlaanterior < umbralnegativo
etiquetatonoprofundo$ = "L*+H"
endif
endif
endif
endif
@printData: "fórmula prenúcleo H+L*+H"
endif
########## ESCRIBE LA ETIQUETA QUE HA SALIDO DE LAS FORMULAS ##################
select TextGrid 'base$'
Insert point... 'tier_Tones' 'midstressed' 'etiquetatono$'
if etiquetaje_profundo = 1
Insert point... 'deep_tier' 'midstressed' 'etiquetatonoprofundo$'
endif
##############
# acaba el if de condición de la sílaba contiene marca de tónica
endif
# acaba el if de si el numero de intervalo es más pequeño que el final
endif
#acaba bucle de todos los intervalos de IP
endfor
##################### ACCIONES PARA LA ULTIMA TÓNICA ##############
#ahora el número de intervalo de la ultima tonica de la frase está almacenada en ultimastressed
@printData: "--"
@printData: "NUCLEAR CONFIGURATION"
if ultimastressed < 1
pause There are not stressed syllables
endif
###
# decide where is the nucleus
##
selectObject: intTable
int1 = Get value: stressedstotalesfile, "intensity"
if stressedstotalesfile > 2
int2 = Get value: 2, "intensity"
else
int2= 0
endif
intFirst= int1
intLast = Get value: stressedstotalesfile, "intensity"
difInt = intLast-intFirst
if difInt< -5
early = 1
selectObject: intTable
nOfRows = Get number of rows
for row to nOfRows
value= Get value: row, "intensity"
if value = undefined
Set numeric value: row, "intensity", 0
endif
endfor
max = Get maximum: "intensity"
if max = undefined
max = 0
endif
strMax$ = string$(max)
row = Search column: "stringInt", strMax$
else
early= 0
row = stressedstotalesfile
endif
### nucleus by range
maxR = Get maximum: "range"
if maxR = undefined
maxR = 0
endif
strMaxR$ = string$(maxR)
rowR = Search column: "stringRange", strMaxR$
if rowR = stressedstotalesfile
early = 0
else
early=1
endif
selectObject: nucleusData
Append row
Set string value: ifile, "file", base$
Set numeric value: ifile, "nucleus", row
Set numeric value: ifile, "difInt", difInt
#by range
Set numeric value: ifile, "nucleusRange", rowR
Set numeric value: ifile, "range", maxR
if row = stressedstotalesfile
Set string value: ifile, "last", "yes"
else
Set string value: ifile, "last", "no"
endif
if rowR = stressedstotalesfile
Set string value: ifile, "lastRange", "yes"
else
Set string value: ifile, "lastRange", "no"
endif
selectObject: stressedInventory
nucl= Search column: "isNucleus", "yes"
select TextGrid 'base$'
startingpointlastton = Get start point: segmentation_tier, ultimastressed
endingpointlastton = Get end point: segmentation_tier, ultimastressed
ultimasilaba = endIntervalIP
endingpointlastsyl = Get end point: segmentation_tier, ultimasilaba
durlastton = endingpointlastton - startingpointlastton
stressType = ultimasilaba - ultimastressed
mediolastton = startingpointlastton + (durlastton/2)
parteslastton= durlastton/6
t4lastton = parteslastton*2
t5lastton = parteslastton*4
# pretónica de la última tonica
pretonlastton = ultimastressed - 1
startingpointprelastton = Get start point... 'segmentation_tier' 'pretonlastton'
endingpointprelastton = Get end point... 'segmentation_tier' 'pretonlastton'
durprelastton = endingpointprelastton - startingpointprelastton
medioprelastton = startingpointprelastton + (durprelastton/2)
# postónica de la última tonica
postonlastton = ultimastressed + 1
startingpointposlastton = Get start point... 'segmentation_tier' 'postonlastton'
endingpointposlastton = Get end point... 'segmentation_tier' 'postonlastton'
durposlastton = endingpointposlastton - startingpointposlastton
medioposlastton = startingpointposlastton + (durposlastton/2)
parteslastpos= durposlastton/6
t4lastpos = parteslastpos*2
t5lastpos = parteslastpos*4
if stressType =0
@printData: "Oxytone"
select TextGrid 'base$'
endingpointlastton = startingpointlastton+ durlastton/2
durlastton = endingpointlastton-startingpointlastton
mediolastton = startingpointlastton + (durlastton/2)
parteslastton= durlastton/6
t4lastton = parteslastton*2
t5lastton = parteslastton*4
startingpointposlastton = endingpointlastton
endingpointposlastton = Get end point: segmentation_tier, ultimastressed
durposlastton = endingpointposlastton - startingpointposlastton
medioposlastton = startingpointposlastton + (durposlastton/2)
parteslastpos= durposlastton/6
t4lastpos = parteslastpos*2
t5lastpos = parteslastpos*4
else
@printData: "Non-oxytone"
select TextGrid 'base$'
mediolastton = startingpointlastton + (durlastton/2)
parteslastton= durlastton/6
t4lastton = parteslastton*2
t5lastton = parteslastton*4
postonlastton = ultimastressed + 1
startingpointposlastton = Get start point... 'segmentation_tier' 'postonlastton'
endingpointposlastton = Get end point... 'segmentation_tier' 'postonlastton'
durposlastton = endingpointposlastton - startingpointposlastton
middleposlastton = startingpointposlastton + (durposlastton/2)
parteslastpos= durposlastton/6
t4lastpos = parteslastpos*2
t5lastpos = parteslastpos*4
endif
# compute F0 differences
select PitchTier 'base$'
if numberOfIntervalPrestressed = 1
startingpointlastton= startingpointlastton+0.05
middleprelastton = startingpointlastton
elsif numberOfIntervalPrestressed = 2
startingpointprelastton = startingpointprelastton+0.05
endif
f01pre = Get value at time... 'startingpointprelastton'
f02pre = Get value at time... 'medioprelastton'
f03pre = Get value at time... 'endingpointprelastton'