praat_Tiers.cpp 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900
  1. /* praat_Tiers.cpp
  2. *
  3. * Copyright (C) 1992-2018 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "Ltas.h"
  19. #include "PitchTier_to_PointProcess.h"
  20. #include "PitchTier_to_Sound.h"
  21. #include "Matrix_and_PointProcess.h"
  22. #include "PointProcess_and_Sound.h"
  23. #include "Sound_PointProcess.h"
  24. #include "SpectrumTier.h"
  25. #include "TextGrid.h"
  26. #include "VoiceAnalysis.h"
  27. #include "praat_Tiers.h"
  28. // MARK: - AMPLITUDETIER
  29. // MARK: New
  30. FORM (NEW1_AmplitudeTier_create, U"Create empty AmplitudeTier", nullptr) {
  31. WORD (name, U"Name", U"empty")
  32. REAL (startTime, U"Start time (s)", U"0.0")
  33. REAL (endTime, U"End time (s)", U"1.0")
  34. OK
  35. DO
  36. Melder_require (endTime > startTime,
  37. U"The end time should be greater than the start time.");
  38. CREATE_ONE
  39. autoAmplitudeTier result = AmplitudeTier_create (startTime, endTime);
  40. CREATE_ONE_END (name)
  41. }
  42. // MARK: Help
  43. DIRECT (HELP_AmplitudeTier_help) {
  44. HELP (U"AmplitudeTier")
  45. }
  46. // MARK: View & Edit
  47. DIRECT (WINDOW_AmplitudeTier_viewAndEdit) {
  48. Melder_require (! theCurrentPraatApplication -> batch,
  49. U"Cannot view or edit an AmplitudeTier from batch.");
  50. FIND_TWO_WITH_IOBJECT (AmplitudeTier, Sound) // Sound may be null
  51. autoAmplitudeTierEditor editor = AmplitudeTierEditor_create (ID_AND_FULL_NAME, me, you, true);
  52. praat_installEditor (editor.get(), IOBJECT);
  53. editor.releaseToUser();
  54. END
  55. }
  56. DIRECT (HINT_AmplitudeTier_Sound_viewAndEdit) {
  57. INFO_NONE
  58. Melder_information (U"To include a copy of a Sound in your AmplitudeTier window:\n"
  59. " select an AmplitudeTier and a Sound, and click \"View & Edit\".");
  60. INFO_NONE_END
  61. }
  62. // MARK: Query
  63. FORM (REAL_AmplitudeTier_getShimmer_local, U"AmplitudeTier: Get shimmer (local)", U"AmplitudeTier: Get shimmer (local)...") {
  64. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  65. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  66. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  67. OK
  68. DO
  69. NUMBER_ONE (AmplitudeTier)
  70. double result = AmplitudeTier_getShimmer_local (me, shortestPeriod, longestPeriod, maximumAmplitudeFactor);
  71. NUMBER_ONE_END (U" (local shimmer)")
  72. }
  73. FORM (REAL_AmplitudeTier_getShimmer_local_dB, U"AmplitudeTier: Get shimmer (local, dB)", U"AmplitudeTier: Get shimmer (local, dB)...") {
  74. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  75. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  76. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  77. OK
  78. DO
  79. NUMBER_ONE (AmplitudeTier)
  80. double result = AmplitudeTier_getShimmer_local_dB (me, shortestPeriod, longestPeriod, maximumAmplitudeFactor);
  81. NUMBER_ONE_END (U" dB (local shimmer)")
  82. }
  83. FORM (REAL_AmplitudeTier_getShimmer_apq3, U"AmplitudeTier: Get shimmer (apq3)", U"AmplitudeTier: Get shimmer (apq3)...") {
  84. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  85. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  86. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  87. OK
  88. DO
  89. NUMBER_ONE (AmplitudeTier)
  90. double result = AmplitudeTier_getShimmer_apq3 (me, shortestPeriod, longestPeriod, maximumAmplitudeFactor);
  91. NUMBER_ONE_END (U" (apq3 shimmer)")
  92. }
  93. FORM (REAL_AmplitudeTier_getShimmer_apq5, U"AmplitudeTier: Get shimmer (apq5)", U"AmplitudeTier: Get shimmer (apq5)...") {
  94. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  95. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  96. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  97. OK
  98. DO
  99. NUMBER_ONE (AmplitudeTier)
  100. double result = AmplitudeTier_getShimmer_apq5 (me, shortestPeriod, longestPeriod, maximumAmplitudeFactor);
  101. NUMBER_ONE_END (U" (apq5 shimmer)")
  102. }
  103. FORM (REAL_AmplitudeTier_getShimmer_apq11, U"AmplitudeTier: Get shimmer (apq11)", U"AmplitudeTier: Get shimmer (apq11)...") {
  104. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  105. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  106. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  107. OK
  108. DO
  109. NUMBER_ONE (AmplitudeTier)
  110. double result = AmplitudeTier_getShimmer_apq11 (me, shortestPeriod, longestPeriod, maximumAmplitudeFactor);
  111. NUMBER_ONE_END (U" (apq11 shimmer)")
  112. }
  113. FORM (REAL_AmplitudeTier_getShimmer_dda, U"AmplitudeTier: Get shimmer (dda)", U"AmplitudeTier: Get shimmer (dda)...") {
  114. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  115. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  116. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  117. OK
  118. DO
  119. NUMBER_ONE (AmplitudeTier)
  120. double result = AmplitudeTier_getShimmer_dda (me, shortestPeriod, longestPeriod, maximumAmplitudeFactor);
  121. NUMBER_ONE_END (U" (dda shimmer)")
  122. }
  123. /*
  124. FORM (REAL_AmplitudeTier_getValueAtTime, U"Get AmplitudeTier value", U"AmplitudeTier: Get value at time...") {
  125. REAL (time, U"Time (s)", U"0.5")
  126. OK
  127. DO
  128. NUMBER_ONE (AmplitudeTier)
  129. double result = RealTier_getValueAtTime (me, time);
  130. NUMBER_ONE_END (U" Pa")
  131. }
  132. FORM (REAL_AmplitudeTier_getValueAtIndex, U"Get AmplitudeTier value", U"AmplitudeTier: Get value at index...") {
  133. INTEGER (pointNumber, U"Point number", U"10")
  134. OK
  135. DO
  136. NUMBER_ONE (AmplitudeTier)
  137. double result = RealTier_getValueAtIndex (me, pointNumber);
  138. NUMBER_ONE_END (U" Pa")
  139. }
  140. */
  141. // MARK: Modify
  142. FORM (MODIFY_AmplitudeTier_addPoint, U"Add one point", U"AmplitudeTier: Add point...") {
  143. REAL (time, U"Time (s)", U"0.5")
  144. REAL (soundPressure, U"Sound pressure (Pa)", U"0.8")
  145. OK
  146. DO
  147. MODIFY_EACH (AmplitudeTier)
  148. RealTier_addPoint (me, time, soundPressure);
  149. MODIFY_EACH_END
  150. }
  151. FORM (MODIFY_AmplitudeTier_formula, U"AmplitudeTier: Formula", U"AmplitudeTier: Formula...") {
  152. LABEL (U"# ncol = the number of points")
  153. LABEL (U"for col from 1 to ncol")
  154. LABEL (U" # x = the time of the colth point, in seconds")
  155. LABEL (U" # self = the value of the colth point, in Pascal")
  156. LABEL (U" self = `formula'")
  157. LABEL (U"endfor")
  158. TEXTFIELD (formula, U"Formula:", U"- self ; upside down")
  159. OK
  160. DO
  161. MODIFY_EACH_WEAK (AmplitudeTier)
  162. RealTier_formula (me, formula, interpreter, nullptr);
  163. MODIFY_EACH_WEAK_END
  164. }
  165. // MARK: Synthesize
  166. FORM (NEW_AmplitudeTier_to_Sound, U"AmplitudeTier: To Sound (pulse train)", U"AmplitudeTier: To Sound (pulse train)...") {
  167. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
  168. NATURAL (interpolationDepth, U"Interpolation depth (samples)", U"2000")
  169. OK
  170. DO
  171. CONVERT_EACH (AmplitudeTier)
  172. autoSound result = AmplitudeTier_to_Sound (me, samplingFrequency, interpolationDepth);
  173. CONVERT_EACH_END (my name.get())
  174. }
  175. // MARK: Convert
  176. DIRECT (NEW_AmplitudeTier_downto_PointProcess) {
  177. CONVERT_EACH (AmplitudeTier)
  178. autoPointProcess result = AnyTier_downto_PointProcess (me->asAnyTier());
  179. CONVERT_EACH_END (my name.get())
  180. }
  181. DIRECT (NEW_AmplitudeTier_downto_TableOfReal) {
  182. CONVERT_EACH (AmplitudeTier)
  183. autoTableOfReal result = AmplitudeTier_downto_TableOfReal (me);
  184. CONVERT_EACH_END (my name.get())
  185. }
  186. FORM (NEW_AmplitudeTier_to_IntensityTier, U"AmplitudeTier: To IntensityTier", U"AmplitudeTier: To IntensityTier...") {
  187. REAL (threshold, U"Threshold (dB)", U"-10000.0")
  188. OK
  189. DO
  190. CONVERT_EACH (AmplitudeTier)
  191. autoIntensityTier result = AmplitudeTier_to_IntensityTier (me, threshold);
  192. CONVERT_EACH_END (my name.get())
  193. }
  194. // MARK: - AMPLITUDETIER & SOUND
  195. DIRECT (NEW1_Sound_AmplitudeTier_multiply) {
  196. CONVERT_TWO (Sound, AmplitudeTier)
  197. autoSound result = Sound_AmplitudeTier_multiply (me, you);
  198. CONVERT_TWO_END (my name.get(), U"_amp")
  199. }
  200. // MARK: - DURATIONTIER
  201. // MARK: New
  202. FORM (NEW1_DurationTier_create, U"Create empty DurationTier", U"Create DurationTier...") {
  203. WORD (name, U"Name", U"empty")
  204. REAL (startTime, U"Start time (s)", U"0.0")
  205. REAL (endTime, U"End time (s)", U"1.0")
  206. OK
  207. DO
  208. Melder_require (endTime > startTime,
  209. U"Your end time should be greater than your start time.");
  210. CREATE_ONE
  211. autoDurationTier result = DurationTier_create (startTime, endTime);
  212. CREATE_ONE_END (name)
  213. }
  214. // MARK: Help
  215. DIRECT (HELP_DurationTier_help) {
  216. HELP (U"DurationTier")
  217. }
  218. // MARK: View & Edit
  219. DIRECT (WINDOW_DurationTier_edit) {
  220. Melder_require (! theCurrentPraatApplication -> batch,
  221. U"Cannot view or edit a DurationTier from batch.");
  222. FIND_TWO_WITH_IOBJECT (DurationTier, Sound) // Sound may be null
  223. autoDurationTierEditor editor = DurationTierEditor_create (ID_AND_FULL_NAME, me, you, true);
  224. praat_installEditor (editor.get(), IOBJECT);
  225. editor.releaseToUser();
  226. END
  227. }
  228. DIRECT (HINT_DurationTier_Sound_edit) {
  229. INFO_NONE
  230. Melder_information (U"To include a copy of a Sound in your DurationTier window:\n"
  231. " select a DurationTier and a Sound, and click \"View & Edit\".");
  232. INFO_NONE_END
  233. }
  234. DIRECT (HINT_DurationTier_Manipulation_replace) {
  235. INFO_NONE
  236. Melder_information (U"To replace the DurationTier in a Manipulation object,\n"
  237. "select a DurationTier object and a Manipulation object\nand choose \"Replace duration\".");
  238. INFO_NONE_END
  239. }
  240. // MARK: Query
  241. FORM (REAL_DurationTier_getTargetDuration, U"Get target duration", nullptr) {
  242. REAL (fromSourceTime, U"left Source time range (s)", U"0.0")
  243. REAL (toSourceTime, U"right Source time range (s)", U"1.0")
  244. OK
  245. DO
  246. NUMBER_ONE (DurationTier)
  247. double result = RealTier_getArea (me, fromSourceTime, toSourceTime);
  248. NUMBER_ONE_END (U" seconds")
  249. }
  250. FORM (REAL_DurationTier_getValueAtTime, U"Get DurationTier value", U"DurationTier: Get value at time...") {
  251. REAL (sourceTime, U"Source time (s)", U"0.5")
  252. OK
  253. DO
  254. NUMBER_ONE (DurationTier)
  255. double result = RealTier_getValueAtTime (me, sourceTime);
  256. NUMBER_ONE_END (U" (relative duration)")
  257. }
  258. FORM (REAL_DurationTier_getValueAtIndex, U"Get DurationTier value", U"Duration: Get value at index...") {
  259. INTEGER (pointNumber, U"Point number", U"10")
  260. OK
  261. DO
  262. NUMBER_ONE (DurationTier)
  263. double result = RealTier_getValueAtIndex (me, pointNumber);
  264. NUMBER_ONE_END (U" (relative duration)")
  265. }
  266. // MARK: Modify
  267. FORM (MODIFY_DurationTier_addPoint, U"Add one point to DurationTier", U"DurationTier: Add point...") {
  268. REAL (time, U"Time (s)", U"0.5")
  269. REAL (relativeDuration, U"Relative duration", U"1.5")
  270. OK
  271. DO
  272. MODIFY_EACH (DurationTier)
  273. RealTier_addPoint (me, time, relativeDuration);
  274. MODIFY_EACH_END
  275. }
  276. FORM (MODIFY_DurationTier_formula, U"DurationTier: Formula", U"DurationTier: Formula...") {
  277. LABEL (U"# ncol = the number of points")
  278. LABEL (U"for col from 1 to ncol")
  279. LABEL (U" # x = the time of the colth point, in seconds")
  280. LABEL (U" # self = the value of the colth point, in relative units")
  281. LABEL (U" self = `formula'")
  282. LABEL (U"endfor")
  283. TEXTFIELD (formula, U"Formula:", U"self * 1.5 ; slow down")
  284. OK
  285. DO
  286. MODIFY_EACH_WEAK (DurationTier)
  287. RealTier_formula (me, formula, interpreter, nullptr);
  288. MODIFY_EACH_WEAK_END
  289. }
  290. // MARK: Convert
  291. DIRECT (NEW_DurationTier_downto_PointProcess) {
  292. CONVERT_EACH (DurationTier)
  293. autoPointProcess result = AnyTier_downto_PointProcess (me->asAnyTier());
  294. CONVERT_EACH_END (my name.get())
  295. }
  296. // MARK: - FORMANTGRID
  297. // MARK: New
  298. FORM (NEW1_FormantGrid_create, U"Create FormantGrid", nullptr) {
  299. WORD (name, U"Name", U"schwa")
  300. REAL (startTime, U"Start time (s)", U"0.0")
  301. REAL (endTime, U"End time (s)", U"1.0")
  302. NATURAL (numberOfFormants, U"Number of formants", U"10")
  303. POSITIVE (initialFirstFormant, U"Initial first formant (Hz)", U"550.0")
  304. POSITIVE (initialFormatSpacing, U"Initial formant spacing (Hz)", U"1100.0")
  305. REAL (initialFirstBandwidth, U"Initial first bandwidth (Hz)", U"60.0")
  306. REAL (initialBandwidthSpacing, U"Initial bandwidth spacing (Hz)", U"50.0")
  307. OK
  308. DO
  309. Melder_require (endTime > startTime,
  310. U"Your end time should be greater than your start time.");
  311. CREATE_ONE
  312. autoFormantGrid result = FormantGrid_create (startTime, endTime, numberOfFormants,
  313. initialFirstFormant, initialFormatSpacing, initialFirstBandwidth, initialBandwidthSpacing);
  314. CREATE_ONE_END (name)
  315. }
  316. // MARK: Help
  317. DIRECT (HELP_FormantGrid_help) {
  318. HELP (U"FormantGrid")
  319. }
  320. // MARK: View & Edit
  321. static void cb_FormantGridEditor_publish (Editor /* me */, autoDaata publish) {
  322. /*
  323. Keep the gate for error handling.
  324. */
  325. try {
  326. praat_new (publish.move(), U"fromFormantGridEditor");
  327. praat_updateSelection ();
  328. } catch (MelderError) {
  329. Melder_flushError ();
  330. }
  331. }
  332. DIRECT (WINDOW_FormantGrid_edit) {
  333. Melder_require (! theCurrentPraatApplication -> batch,
  334. U"Cannot view or edit a FormantGrid from batch.");
  335. FIND_ONE_WITH_IOBJECT (FormantGrid)
  336. autoFormantGridEditor editor = FormantGridEditor_create (ID_AND_FULL_NAME, me);
  337. Editor_setPublicationCallback (editor.get(), cb_FormantGridEditor_publish);
  338. praat_installEditor (editor.get(), IOBJECT);
  339. editor.releaseToUser();
  340. END
  341. }
  342. // MARK: Modify
  343. FORM (MODIFY_FormantGrid_formula_frequencies, U"FormantGrid: Formula (frequencies)", U"Formant: Formula (frequencies)...") {
  344. LABEL (U"row is formant number, col is point number:")
  345. LABEL (U" for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
  346. TEXTFIELD (formula, U"Formula:", U"if row = 2 then self + 200 else self fi")
  347. OK
  348. DO
  349. MODIFY_EACH_WEAK (FormantGrid)
  350. FormantGrid_formula_frequencies (me, formula, interpreter, nullptr);
  351. MODIFY_EACH_WEAK_END
  352. }
  353. FORM (MODIFY_FormantGrid_formula_bandwidths, U"FormantGrid: Formula (bandwidths)", U"Formant: Formula (bandwidths)...") {
  354. LABEL (U"row is formant number, col is point number:")
  355. LABEL (U" for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
  356. LABEL (U"self [] is the FormantGrid itself, so it returns frequencies, not bandwidths!")
  357. TEXTFIELD (formula, U"Formula:", U"self / 10 ; one tenth of the formant frequency")
  358. OK
  359. DO
  360. MODIFY_EACH_WEAK (FormantGrid)
  361. FormantGrid_formula_bandwidths (me, formula, interpreter, nullptr);
  362. praat_dataChanged (me);
  363. MODIFY_EACH_WEAK_END
  364. }
  365. FORM (MODIFY_FormantGrid_addFormantPoint, U"FormantGrid: Add formant point", U"FormantGrid: Add formant point...") {
  366. NATURAL (formantNumber, U"Formant number", U"1")
  367. REAL (time, U"Time (s)", U"0.5")
  368. POSITIVE (frequency, U"Frequency (Hz)", U"550.0")
  369. OK
  370. DO
  371. MODIFY_EACH (FormantGrid)
  372. FormantGrid_addFormantPoint (me, formantNumber, time, frequency);
  373. MODIFY_EACH_END
  374. }
  375. FORM (MODIFY_FormantGrid_addBandwidthPoint, U"FormantGrid: Add bandwidth point", U"FormantGrid: Add bandwidth point...") {
  376. NATURAL (formantNumber, U"Formant number", U"1")
  377. REAL (time, U"Time (s)", U"0.5")
  378. POSITIVE (bandwidth, U"Bandwidth (Hz)", U"100.0")
  379. OK
  380. DO
  381. MODIFY_EACH (FormantGrid)
  382. FormantGrid_addBandwidthPoint (me, formantNumber, time, bandwidth);
  383. MODIFY_EACH_END
  384. }
  385. FORM (MODIFY_FormantGrid_removeBandwidthPointsBetween, U"Remove bandwidth points between", U"FormantGrid: Remove bandwidth points between...") {
  386. NATURAL (formantNumber, U"Formant number", U"1")
  387. REAL (fromTime, U"From time (s)", U"0.3")
  388. REAL (toTime, U"To time (s)", U"0.7")
  389. OK
  390. DO
  391. MODIFY_EACH (FormantGrid)
  392. FormantGrid_removeBandwidthPointsBetween (me, formantNumber, fromTime, toTime);
  393. MODIFY_EACH_END
  394. }
  395. FORM (MODIFY_FormantGrid_removeFormantPointsBetween, U"Remove formant points between", U"FormantGrid: Remove formant points between...") {
  396. NATURAL (formantNumber, U"Formant number", U"1")
  397. REAL (fromTime, U"From time (s)", U"0.3")
  398. REAL (toTime, U"To time (s)", U"0.7")
  399. OK
  400. DO
  401. MODIFY_EACH (FormantGrid)
  402. FormantGrid_removeFormantPointsBetween (me, formantNumber, fromTime, toTime);
  403. MODIFY_EACH_END
  404. }
  405. // MARK: Convert
  406. FORM (NEW_FormantGrid_to_Formant, U"FormantGrid: To Formant", nullptr) {
  407. POSITIVE (timeStep, U"Time step (s)", U"0.01")
  408. REAL (intensity, U"Intensity (Pa\u00B2)", U"0.1")
  409. OK
  410. DO
  411. Melder_require (intensity >= 0.0,
  412. U"The intensity cannot be negative.");
  413. CONVERT_EACH (FormantGrid)
  414. autoFormant result = FormantGrid_to_Formant (me, timeStep, intensity);
  415. CONVERT_EACH_END (my name.get())
  416. }
  417. // MARK: - FORMANTGRID & SOUND
  418. DIRECT (NEW1_Sound_FormantGrid_filter) {
  419. CONVERT_TWO (Sound, FormantGrid)
  420. autoSound result = Sound_FormantGrid_filter (me, you);
  421. CONVERT_TWO_END (my name.get(), U"_filt")
  422. }
  423. DIRECT (NEW1_Sound_FormantGrid_filter_noscale) {
  424. CONVERT_TWO (Sound, FormantGrid)
  425. autoSound result = Sound_FormantGrid_filter_noscale (me, you);
  426. CONVERT_TWO_END (my name.get(), U"_filt")
  427. }
  428. // MARK: - FORMANTTIER
  429. // MARK: New
  430. FORM (NEW1_FormantTier_create, U"Create empty FormantTier", nullptr) {
  431. WORD (name, U"Name", U"empty")
  432. REAL (startTime, U"Start time (s)", U"0.0")
  433. REAL (endTime, U"End time (s)", U"1.0")
  434. OK
  435. DO
  436. Melder_require (endTime > startTime,
  437. U"Your end time should be greater than your start time.");
  438. CREATE_ONE
  439. autoFormantTier result = FormantTier_create (startTime, endTime);
  440. CREATE_ONE_END (name)
  441. }
  442. // MARK: Draw
  443. FORM (GRAPHICS_FormantTier_speckle, U"Draw FormantTier", nullptr) {
  444. praat_TimeFunction_RANGE (fromTime, toTime)
  445. POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5500.0")
  446. BOOLEAN (garnish, U"Garnish", true)
  447. OK
  448. DO
  449. GRAPHICS_EACH (FormantTier)
  450. FormantTier_speckle (me, GRAPHICS, fromTime, toTime, maximumFrequency, garnish);
  451. GRAPHICS_EACH_END
  452. }
  453. // MARK: Query
  454. FORM (REAL_FormantTier_getValueAtTime, U"FormantTier: Get value", U"FormantTier: Get value at time...") {
  455. NATURAL (formantNumber, U"Formant number", U"1")
  456. REAL (time, U"Time (s)", U"0.5")
  457. OK
  458. DO
  459. NUMBER_ONE (FormantTier)
  460. double result = FormantTier_getValueAtTime (me, formantNumber, time);
  461. NUMBER_ONE_END (U" Hz")
  462. }
  463. FORM (REAL_FormantTier_getBandwidthAtTime, U"FormantTier: Get bandwidth", U"FormantTier: Get bandwidth at time...") {
  464. NATURAL (formantNumber, U"Formant number", U"1")
  465. REAL (time, U"Time (s)", U"0.5")
  466. OK
  467. DO
  468. NUMBER_ONE (FormantTier)
  469. double result = FormantTier_getBandwidthAtTime (me, formantNumber, time);
  470. NUMBER_ONE_END (U" Hz")
  471. }
  472. // MARK: Modify
  473. FORM (MODIFY_FormantTier_addPoint, U"Add one point", U"FormantTier: Add point...") {
  474. REAL (time, U"Time (s)", U"0.5")
  475. TEXTFIELD (formantBandwidthPairs, U"Frequencies and bandwidths (Hz):", U"500 50 1500 100 2500 150 3500 200 4500 300")
  476. OK
  477. DO
  478. autoFormantPoint point = FormantPoint_create (time, 10);
  479. double *f = point -> formant.at, *b = point -> bandwidth.at;
  480. conststring8 fbpairs = Melder_peek32to8 (formantBandwidthPairs);
  481. int numberOfFormants = sscanf (fbpairs, "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf",
  482. f+1, b+1, f+2, b+2, f+3, b+3, f+4, b+4, f+5, b+5, f+6, b+6, f+7, b+7, f+8, b+8, f+9, b+9, f+10, b+10) / 2;
  483. Melder_require (numberOfFormants >= 1,
  484. U"The number of formant-bandwidth pairs must be at least 1.");
  485. point -> numberOfFormants = numberOfFormants;
  486. MODIFY_EACH (FormantTier)
  487. autoFormantPoint point2 = Data_copy (point.get());
  488. AnyTier_addPoint_move (me->asAnyTier(), point2.move());
  489. MODIFY_EACH_END
  490. }
  491. // MARK: Convert
  492. FORM (NEW_FormantTier_downto_TableOfReal, U"Down to TableOfReal", nullptr) {
  493. BOOLEAN (includeFormants, U"Include formants", true)
  494. BOOLEAN (includeBandwidths, U"Include bandwidths", false)
  495. OK
  496. DO
  497. CONVERT_EACH (FormantTier)
  498. autoTableOfReal result = FormantTier_downto_TableOfReal (me, includeFormants, includeBandwidths);
  499. CONVERT_EACH_END (my name.get())
  500. }
  501. // MARK: - FORMANTTIER & SOUND
  502. DIRECT (NEW1_Sound_FormantTier_filter) {
  503. CONVERT_TWO (Sound, FormantTier)
  504. autoSound result = Sound_FormantTier_filter (me, you);
  505. CONVERT_TWO_END (my name.get(), U"_filt")
  506. }
  507. DIRECT (NEW1_Sound_FormantTier_filter_noscale) {
  508. CONVERT_TWO (Sound, FormantTier)
  509. autoSound result = Sound_FormantTier_filter_noscale (me, you);
  510. CONVERT_TWO_END (my name.get(), U"_filt")
  511. }
  512. // MARK: - INTENSITYTIER
  513. // MARK: New
  514. FORM (NEW1_IntensityTier_create, U"Create empty IntensityTier", nullptr) {
  515. WORD (name, U"Name", U"empty")
  516. REAL (startTime, U"Start time (s)", U"0.0")
  517. REAL (endTime, U"End time (s)", U"1.0")
  518. OK
  519. DO
  520. Melder_require (endTime > startTime,
  521. U"Your end time should be greater than your start time.");
  522. CREATE_ONE
  523. autoIntensityTier result = IntensityTier_create (startTime, endTime);
  524. CREATE_ONE_END (name)
  525. }
  526. // MARK: Help
  527. DIRECT (HELP_IntensityTier_help) {
  528. HELP (U"IntensityTier")
  529. }
  530. // MARK: View & Edit
  531. DIRECT (WINDOW_IntensityTier_viewAndEdit) {
  532. Melder_require (! theCurrentPraatApplication -> batch,
  533. U"Cannot view or edit an IntensityTier from batch.");
  534. FIND_TWO_WITH_IOBJECT (IntensityTier, Sound) // Sound may be null
  535. autoIntensityTierEditor editor = IntensityTierEditor_create (ID_AND_FULL_NAME, me, you, true);
  536. praat_installEditor (editor.get(), IOBJECT);
  537. editor.releaseToUser();
  538. END
  539. }
  540. DIRECT (HINT_IntensityTier_Sound_viewAndEdit) {
  541. INFO_NONE
  542. Melder_information (U"To include a copy of a Sound in your IntensityTier window:\n"
  543. " select an IntensityTier and a Sound, and click \"View & Edit\".");
  544. INFO_NONE_END
  545. }
  546. // MARK: Query
  547. FORM (REAL_IntensityTier_getValueAtTime, U"Get IntensityTier value", U"IntensityTier: Get value at time...") {
  548. REAL (time, U"Time (s)", U"0.5")
  549. OK
  550. DO
  551. NUMBER_ONE (IntensityTier)
  552. double result = RealTier_getValueAtTime (me, time);
  553. NUMBER_ONE_END (U" dB")
  554. }
  555. FORM (REAL_IntensityTier_getValueAtIndex, U"Get IntensityTier value", U"IntensityTier: Get value at index...") {
  556. INTEGER (pointNumber, U"Point number", U"10")
  557. OK
  558. DO
  559. NUMBER_ONE (IntensityTier)
  560. double result = RealTier_getValueAtIndex (me, pointNumber);
  561. NUMBER_ONE_END (U" dB")
  562. }
  563. // MARK: Modify
  564. FORM (MODIFY_IntensityTier_addPoint, U"Add one point", U"IntensityTier: Add point...") {
  565. REAL (time, U"Time (s)", U"0.5")
  566. REAL (intensity, U"Intensity (dB)", U"75")
  567. OK
  568. DO
  569. MODIFY_EACH (IntensityTier)
  570. RealTier_addPoint (me, time, intensity);
  571. MODIFY_EACH_END
  572. }
  573. FORM (MODIFY_IntensityTier_formula, U"IntensityTier: Formula", U"IntensityTier: Formula...") {
  574. LABEL (U"# ncol = the number of points")
  575. LABEL (U"for col from 1 to ncol")
  576. LABEL (U" # x = the time of the colth point, in seconds")
  577. LABEL (U" # self = the value of the colth point, in dB")
  578. LABEL (U" self = `formula`")
  579. LABEL (U"endfor")
  580. TEXTFIELD (formula, U"Formula:", U"self + 3.0")
  581. OK
  582. DO
  583. MODIFY_EACH_WEAK (IntensityTier)
  584. RealTier_formula (me, formula, interpreter, nullptr);
  585. MODIFY_EACH_WEAK_END
  586. }
  587. // MARK: Convert
  588. DIRECT (NEW_IntensityTier_downto_PointProcess) {
  589. CONVERT_EACH (IntensityTier)
  590. autoPointProcess result = AnyTier_downto_PointProcess (me->asAnyTier());
  591. CONVERT_EACH_END (my name.get())
  592. }
  593. DIRECT (NEW_IntensityTier_downto_TableOfReal) {
  594. CONVERT_EACH (IntensityTier)
  595. autoTableOfReal result = IntensityTier_downto_TableOfReal (me);
  596. CONVERT_EACH_END (my name.get())
  597. }
  598. DIRECT (NEW_IntensityTier_to_AmplitudeTier) {
  599. CONVERT_EACH (IntensityTier)
  600. autoAmplitudeTier result = IntensityTier_to_AmplitudeTier (me);
  601. CONVERT_EACH_END (my name.get())
  602. }
  603. // MARK: - INTENSITYTIER & POINTPROCESS
  604. DIRECT (NEW1_IntensityTier_PointProcess_to_IntensityTier) {
  605. CONVERT_TWO (IntensityTier, PointProcess)
  606. autoIntensityTier result = IntensityTier_PointProcess_to_IntensityTier (me, you);
  607. CONVERT_TWO_END (my name.get())
  608. }
  609. // MARK: - INTENSITYTIER & SOUND
  610. DIRECT (NEW1_Sound_IntensityTier_multiply_old) {
  611. CONVERT_TWO (Sound, IntensityTier)
  612. autoSound result = Sound_IntensityTier_multiply (me, you, true);
  613. CONVERT_TWO_END (my name.get(), U"_int")
  614. }
  615. FORM (NEW1_Sound_IntensityTier_multiply, U"Sound & IntervalTier: Multiply", nullptr) {
  616. BOOLEAN (scaleTo09, U"Scale to 0.9", true)
  617. OK
  618. DO
  619. CONVERT_TWO (Sound, IntensityTier)
  620. autoSound result = Sound_IntensityTier_multiply (me, you, scaleTo09);
  621. CONVERT_TWO_END (my name.get(), U"_int")
  622. }
  623. // MARK: - PITCHTIER
  624. FORM (MODIFY_PitchTier_addPoint, U"PitchTier: Add point", U"PitchTier: Add point...") {
  625. REAL (time, U"Time (s)", U"0.5")
  626. REAL (pitch, U"Pitch (Hz)", U"200.0")
  627. OK
  628. DO
  629. MODIFY_EACH (PitchTier)
  630. RealTier_addPoint (me, time, pitch);
  631. MODIFY_EACH_END
  632. }
  633. FORM (NEW1_PitchTier_create, U"Create empty PitchTier", nullptr) {
  634. WORD (name, U"Name", U"empty")
  635. REAL (startTime, U"Start time (s)", U"0.0")
  636. REAL (endTime, U"End time (s)", U"1.0")
  637. OK
  638. DO
  639. Melder_require (endTime > startTime,
  640. U"Your end time should be greater than your start time.");
  641. CREATE_ONE
  642. autoPitchTier result = PitchTier_create (startTime, endTime);
  643. CREATE_ONE_END (name)
  644. }
  645. DIRECT (NEW_PitchTier_downto_PointProcess) {
  646. CONVERT_EACH (PitchTier)
  647. autoPointProcess result = AnyTier_downto_PointProcess (me->asAnyTier());
  648. CONVERT_EACH_END (my name.get())
  649. }
  650. FORM (NEW_PitchTier_downto_TableOfReal, U"PitchTier: Down to TableOfReal", nullptr) {
  651. RADIOx (unit, U"Unit", 1, 0)
  652. RADIOBUTTON (U"Hertz")
  653. RADIOBUTTON (U"Semitones")
  654. OK
  655. DO
  656. CONVERT_EACH (PitchTier)
  657. autoTableOfReal result = PitchTier_downto_TableOfReal (me, unit);
  658. CONVERT_EACH_END (my name.get())
  659. }
  660. FORM (GRAPHICS_old_PitchTier_draw, U"PitchTier: Draw", nullptr) {
  661. praat_TimeFunction_RANGE (fromTime, toTime)
  662. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  663. POSITIVE (toFrequency, U"right Frequency range (Hz)", U"500.0")
  664. BOOLEAN (garnish, U"Garnish", true)
  665. OK
  666. DO
  667. Melder_require (toFrequency > fromFrequency,
  668. U"Your maximum frequency should be greater than your minimum frequency.");
  669. GRAPHICS_EACH (PitchTier)
  670. PitchTier_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  671. garnish, U"lines and speckles");
  672. GRAPHICS_EACH_END
  673. }
  674. FORM (GRAPHICS_PitchTier_draw, U"PitchTier: Draw", nullptr) {
  675. praat_TimeFunction_RANGE (fromTime, toTime)
  676. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  677. POSITIVE (toFrequency, U"right Frequency range (Hz)", U"500.0")
  678. BOOLEAN (garnish, U"Garnish", true)
  679. LABEL (U"")
  680. OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
  681. OPTION (U"lines")
  682. OPTION (U"speckles")
  683. OPTION (U"lines and speckles")
  684. OK
  685. DO_ALTERNATIVE (GRAPHICS_old_PitchTier_draw)
  686. Melder_require (toFrequency > fromFrequency,
  687. U"Your maximum frequency should be greater than your minimum frequency.");
  688. GRAPHICS_EACH (PitchTier)
  689. PitchTier_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, drawingMethod);
  690. GRAPHICS_EACH_END
  691. }
  692. DIRECT (WINDOW_PitchTier_viewAndEdit) {
  693. Melder_require (! theCurrentPraatApplication -> batch,
  694. U"Cannot view or edit a PitchTier from batch.");
  695. FIND_TWO_WITH_IOBJECT (PitchTier, Sound) // Sound may be null
  696. autoPitchTierEditor editor = PitchTierEditor_create (ID_AND_FULL_NAME, me, you, true);
  697. praat_installEditor (editor.get(), IOBJECT);
  698. editor.releaseToUser();
  699. END
  700. }
  701. FORM (MODIFY_PitchTier_formula, U"PitchTier: Formula", U"PitchTier: Formula...") {
  702. LABEL (U"# ncol = the number of points")
  703. LABEL (U"for col from 1 to ncol")
  704. LABEL (U" # x = the time of the colth point, in seconds")
  705. LABEL (U" # self = the value of the colth point, in hertz")
  706. LABEL (U" self = `formula`")
  707. LABEL (U"endfor")
  708. TEXTFIELD (formula, U"Formula:", U"self * 2 ; one octave up")
  709. OK
  710. DO
  711. MODIFY_EACH_WEAK (PitchTier)
  712. RealTier_formula (me, formula, interpreter, nullptr);
  713. MODIFY_EACH_WEAK_END
  714. }
  715. FORM (REAL_PitchTier_getMean_curve, U"PitchTier: Get mean (curve)", U"PitchTier: Get mean (curve)...") {
  716. praat_TimeFunction_RANGE (fromTime, toTime)
  717. OK
  718. DO
  719. NUMBER_ONE (PitchTier)
  720. double result = RealTier_getMean_curve (me, fromTime, toTime);
  721. NUMBER_ONE_END (U" Hz")
  722. }
  723. FORM (REAL_PitchTier_getMean_points, U"PitchTier: Get mean (points)", U"PitchTier: Get mean (points)...") {
  724. praat_TimeFunction_RANGE (fromTime, toTime)
  725. OK
  726. DO
  727. NUMBER_ONE (PitchTier)
  728. double result = RealTier_getMean_points (me, fromTime, toTime);
  729. NUMBER_ONE_END (U" Hz")
  730. }
  731. FORM (REAL_PitchTier_getStandardDeviation_curve, U"PitchTier: Get standard deviation (curve)", U"PitchTier: Get standard deviation (curve)...") {
  732. praat_TimeFunction_RANGE (fromTime, toTime)
  733. OK
  734. DO
  735. NUMBER_ONE (PitchTier)
  736. double result = RealTier_getStandardDeviation_curve (me, fromTime, toTime);
  737. NUMBER_ONE_END (U" Hz")
  738. }
  739. FORM (REAL_PitchTier_getStandardDeviation_points, U"PitchTier: Get standard deviation (points)", U"PitchTier: Get standard deviation (points)...") {
  740. praat_TimeFunction_RANGE (fromTime, toTime)
  741. OK
  742. DO
  743. NUMBER_ONE (PitchTier)
  744. double result = RealTier_getStandardDeviation_points (me, fromTime, toTime);
  745. NUMBER_ONE_END (U" Hz")
  746. }
  747. FORM (REAL_PitchTier_getValueAtTime, U"PitchTier: Get value at time", U"PitchTier: Get value at time...") {
  748. REAL (time, U"Time (s)", U"0.5")
  749. OK
  750. DO
  751. NUMBER_ONE (PitchTier)
  752. double result = RealTier_getValueAtTime (me, time);
  753. NUMBER_ONE_END (U" Hz")
  754. }
  755. FORM (REAL_PitchTier_getValueAtIndex, U"PitchTier: Get value at index", U"PitchTier: Get value at index...") {
  756. INTEGER (pointNumber, U"Point number", U"10")
  757. OK
  758. DO
  759. NUMBER_ONE (PitchTier)
  760. double result = RealTier_getValueAtIndex (me, pointNumber);
  761. NUMBER_ONE_END (U" Hz")
  762. }
  763. DIRECT (HELP_PitchTier_help) {
  764. HELP (U"PitchTier")
  765. }
  766. DIRECT (PLAY_PitchTier_hum) {
  767. PLAY_EACH (PitchTier)
  768. PitchTier_hum (me);
  769. PLAY_EACH_END
  770. }
  771. FORM (MODIFY_PitchTier_interpolateQuadratically, U"PitchTier: Interpolate quadratically", nullptr) {
  772. NATURAL (numberOfPointsPerParabola, U"Number of points per parabola", U"4")
  773. RADIOx (unit, U"Unit", 2, 0)
  774. RADIOBUTTON (U"Hz")
  775. RADIOBUTTON (U"Semitones")
  776. OK
  777. DO
  778. MODIFY_EACH (PitchTier)
  779. RealTier_interpolateQuadratically (me, numberOfPointsPerParabola, unit);
  780. MODIFY_EACH_END
  781. }
  782. DIRECT (PLAY_PitchTier_play) {
  783. PLAY_EACH (PitchTier)
  784. PitchTier_play (me);
  785. PLAY_EACH_END
  786. }
  787. DIRECT (PLAY_PitchTier_playSine) {
  788. PLAY_EACH (PitchTier)
  789. PitchTier_playPart_sine (me, 0.0, 0.0);
  790. PLAY_EACH_END
  791. }
  792. FORM (MODIFY_PitchTier_shiftFrequencies, U"PitchTier: Shift frequencies", nullptr) {
  793. REAL (fromTime, U"left Time range (s)", U"0.0")
  794. REAL (toTime, U"right Time range (s)", U"1000.0")
  795. REAL (frequencyShift, U"Frequency shift", U"-20.0")
  796. OPTIONMENU (unit_i, U"Unit", 1)
  797. OPTION (U"Hertz")
  798. OPTION (U"mel")
  799. OPTION (U"logHertz")
  800. OPTION (U"semitones")
  801. OPTION (U"ERB")
  802. OK
  803. DO
  804. kPitch_unit unit =
  805. unit_i == 1 ? kPitch_unit::HERTZ :
  806. unit_i == 2 ? kPitch_unit::MEL :
  807. unit_i == 3 ? kPitch_unit::LOG_HERTZ :
  808. unit_i == 4 ? kPitch_unit::SEMITONES_1 :
  809. kPitch_unit::ERB;
  810. MODIFY_EACH_WEAK (PitchTier)
  811. PitchTier_shiftFrequencies (me, fromTime, toTime, frequencyShift, unit);
  812. MODIFY_EACH_WEAK_END
  813. }
  814. FORM (MODIFY_PitchTier_multiplyFrequencies, U"PitchTier: Multiply frequencies", nullptr){
  815. REAL (fromTime, U"left Time range (s)", U"0.0")
  816. REAL (toTime, U"right Time range (s)", U"1000.0")
  817. POSITIVE (factor, U"Factor", U"1.2")
  818. OK
  819. DO
  820. MODIFY_EACH (PitchTier)
  821. PitchTier_multiplyFrequencies (me, fromTime, toTime, factor);
  822. MODIFY_EACH_END
  823. }
  824. FORM (MODIFY_PitchTier_stylize, U"PitchTier: Stylize", U"PitchTier: Stylize...") {
  825. REAL (frequencyResolution, U"Frequency resolution", U"4.0")
  826. RADIOx (unit, U"Unit", 2, 0)
  827. RADIOBUTTON (U"Hz")
  828. RADIOBUTTON (U"Semitones")
  829. OK
  830. DO
  831. MODIFY_EACH (PitchTier)
  832. PitchTier_stylize (me, frequencyResolution, unit);
  833. MODIFY_EACH_END
  834. }
  835. DIRECT (NEW_PitchTier_to_PointProcess) {
  836. CONVERT_EACH (PitchTier)
  837. autoPointProcess result = PitchTier_to_PointProcess (me);
  838. CONVERT_EACH_END (my name.get())
  839. }
  840. FORM (NEW_PitchTier_to_Sound_phonation, U"PitchTier: To Sound (phonation)", nullptr) {
  841. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100")
  842. POSITIVE (adaptationFactor, U"Adaptation factor", U"1.0")
  843. POSITIVE (maximumPeriod, U"Maximum period (s)", U"0.05")
  844. POSITIVE (openPhase, U"Open phase", U"0.7")
  845. REAL (collisionPhase, U"Collision phase", U"0.03")
  846. POSITIVE (power1, U"Power 1", U"3.0")
  847. POSITIVE (power2, U"Power 2", U"4.0")
  848. BOOLEAN (hum, U"Hum", false)
  849. OK
  850. DO
  851. CONVERT_EACH (PitchTier)
  852. autoSound result = PitchTier_to_Sound_phonation (me, samplingFrequency,
  853. adaptationFactor, maximumPeriod, openPhase, collisionPhase, power1, power2, hum);
  854. CONVERT_EACH_END (my name.get())
  855. }
  856. FORM (NEW_PitchTier_to_Sound_pulseTrain, U"PitchTier: To Sound (pulse train)", nullptr) {
  857. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100")
  858. POSITIVE (adaptationFactor, U"Adaptation factor", U"1.0")
  859. POSITIVE (adaptationTime, U"Adaptation time", U"0.05")
  860. NATURAL (interpolationDepth, U"Interpolation depth (samples)", U"2000")
  861. BOOLEAN (hum, U"Hum", false)
  862. OK
  863. DO
  864. CONVERT_EACH (PitchTier)
  865. autoSound result = PitchTier_to_Sound_pulseTrain (me, samplingFrequency,
  866. adaptationFactor, adaptationTime, interpolationDepth, hum);
  867. CONVERT_EACH_END (my name.get())
  868. }
  869. FORM (NEW_PitchTier_to_Sound_sine, U"PitchTier: To Sound (sine)", nullptr) {
  870. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
  871. OK
  872. DO
  873. CONVERT_EACH (PitchTier)
  874. autoSound result = PitchTier_to_Sound_sine (me, 0.0, 0.0, samplingFrequency);
  875. CONVERT_EACH_END (my name.get())
  876. }
  877. DIRECT (HINT_PitchTier_Sound_viewAndEdit) {
  878. Melder_information (U"To include a copy of a Sound in your PitchTier window:\n"
  879. " select a PitchTier and a Sound, and click \"View & Edit\".");
  880. END }
  881. FORM_SAVE (SAVE_PitchTier_writeToPitchTierSpreadsheetFile, U"Save PitchTier as spreadsheet", nullptr, U"PitchTier") {
  882. SAVE_ONE (PitchTier)
  883. PitchTier_writeToPitchTierSpreadsheetFile (me, file);
  884. SAVE_ONE_END
  885. }
  886. FORM_SAVE (SAVE_PitchTier_writeToHeaderlessSpreadsheetFile, U"Save PitchTier as spreadsheet", nullptr, U"txt") {
  887. SAVE_ONE (PitchTier)
  888. PitchTier_writeToHeaderlessSpreadsheetFile (me, file);
  889. SAVE_ONE_END
  890. }
  891. DIRECT (INFO_PitchTier_Manipulation_replace) {
  892. INFO_NONE
  893. Melder_information (U"To replace the PitchTier in a Manipulation object,\n"
  894. "select a PitchTier object and a Manipulation object\nand choose \"Replace pitch\".");
  895. INFO_NONE_END
  896. }
  897. // MARK: - PITCHTIER & POINTPROCESS
  898. DIRECT (NEW1_PitchTier_PointProcess_to_PitchTier) {
  899. CONVERT_TWO (PitchTier, PointProcess)
  900. autoPitchTier result = PitchTier_PointProcess_to_PitchTier (me, you);
  901. CONVERT_TWO_END (my name.get())
  902. }
  903. // MARK: - POINTPROCESS
  904. FORM (MODIFY_PointProcess_addPoint, U"PointProcess: Add point", U"PointProcess: Add point...") {
  905. REAL (time, U"Time (s)", U"0.5")
  906. OK
  907. DO
  908. MODIFY_EACH (PointProcess)
  909. PointProcess_addPoint (me, time);
  910. MODIFY_EACH_END
  911. }
  912. FORM (MODIFY_PointProcess_addPoints, U"PointProcess: Add points", U"PointProcess: Add point...") {
  913. NUMVEC (times, U"Times:", U"{ 0.1, 0.2, 0.5 }")
  914. OK
  915. DO
  916. MODIFY_EACH (PointProcess)
  917. PointProcess_addPoints (me, times);
  918. MODIFY_EACH_END
  919. }
  920. FORM (NEW1_PointProcess_createEmpty, U"Create an empty PointProcess", U"Create empty PointProcess...") {
  921. WORD (name, U"Name", U"empty")
  922. REAL (startTime, U"Start time (s)", U"0.0")
  923. REAL (endTime, U"End time (s)", U"1.0")
  924. OK
  925. DO
  926. Melder_require (endTime >= startTime,
  927. U"Your end time (", endTime, U") should not be less than your start time (", startTime, U").");
  928. CREATE_ONE
  929. autoPointProcess result = PointProcess_create (startTime, endTime, 0);
  930. CREATE_ONE_END (name)
  931. }
  932. FORM (NEW1_PointProcess_createPoissonProcess, U"Create Poisson process", U"Create Poisson process...") {
  933. WORD (name, U"Name", U"poisson")
  934. REAL (startTime, U"Start time (s)", U"0.0")
  935. REAL (endTime, U"End time (s)", U"1.0")
  936. POSITIVE (density, U"Density (/s)", U"100.0")
  937. OK
  938. DO
  939. Melder_require (endTime >= startTime,
  940. U"Your end time (", endTime, U") should not be less than your start time (", startTime, U").");
  941. CREATE_ONE
  942. autoPointProcess result = PointProcess_createPoissonProcess (startTime, endTime, density);
  943. CREATE_ONE_END (name)
  944. }
  945. DIRECT (NEW1_PointProcesses_difference) {
  946. CONVERT_COUPLE (PointProcess)
  947. autoPointProcess result = PointProcesses_difference (me, you);
  948. CONVERT_COUPLE_END (U"difference")
  949. }
  950. FORM (GRAPHICS_PointProcess_draw, U"PointProcess: Draw", nullptr) {
  951. praat_TimeFunction_RANGE (fromTime, toTime)
  952. BOOLEAN (garnish, U"Garnish", true)
  953. OK
  954. DO
  955. GRAPHICS_EACH (PointProcess)
  956. PointProcess_draw (me, GRAPHICS, fromTime, toTime, garnish);
  957. GRAPHICS_EACH_END
  958. }
  959. DIRECT (WINDOW_PointProcess_viewAndEdit) {
  960. Melder_require (! theCurrentPraatApplication -> batch,
  961. U"Cannot view or edit a PointProcess from batch.");
  962. FIND_TWO_WITH_IOBJECT (PointProcess, Sound) // Sound may be null
  963. autoPointEditor editor = PointEditor_create (ID_AND_FULL_NAME, me, you);
  964. praat_installEditor (editor.get(), IOBJECT);
  965. editor.releaseToUser();
  966. END
  967. }
  968. FORM (MODIFY_PointProcess_fill, U"PointProcess: Fill", nullptr) {
  969. praat_TimeFunction_RANGE (fromTime, toTime)
  970. POSITIVE (period, U"Period (s)", U"0.01")
  971. OK
  972. DO
  973. MODIFY_EACH_WEAK (PointProcess)
  974. PointProcess_fill (me, fromTime, toTime, period);
  975. MODIFY_EACH_WEAK_END
  976. }
  977. FORM (REAL_PointProcess_getInterval, U"PointProcess: Get interval", U"PointProcess: Get interval...") {
  978. REAL (time, U"Time (s)", U"0.5")
  979. OK
  980. DO
  981. NUMBER_ONE (PointProcess)
  982. double result = PointProcess_getInterval (me, time);
  983. NUMBER_ONE_END (U" seconds")
  984. }
  985. #define dia_PointProcess_getRangeProperty(fromTime,toTime,shortestPeriod,longestPeriod,maximumPeriodfactor) \
  986. praat_TimeFunction_RANGE (fromTime, toTime) \
  987. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001") \
  988. REAL (longestPeriod, U"Longest period (s)", U"0.02") \
  989. POSITIVE (maximumPeriodFactor, U"Maximum period factor", U"1.3")
  990. FORM (REAL_PointProcess_getJitter_local, U"PointProcess: Get jitter (local)", U"PointProcess: Get jitter (local)...") {
  991. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  992. OK
  993. DO
  994. NUMBER_ONE (PointProcess)
  995. double result = PointProcess_getJitter_local (me, fromTime, toTime,
  996. shortestPeriod, longestPeriod, maximumPeriodFactor);
  997. NUMBER_ONE_END (U" (local jitter)")
  998. }
  999. FORM (REAL_PointProcess_getJitter_local_absolute, U"PointProcess: Get jitter (local, absolute)", U"PointProcess: Get jitter (local, absolute)...") {
  1000. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1001. OK
  1002. DO
  1003. NUMBER_ONE (PointProcess)
  1004. double result = PointProcess_getJitter_local_absolute (me, fromTime, toTime,
  1005. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1006. NUMBER_ONE_END (U" seconds (local absolute jitter)")
  1007. }
  1008. FORM (REAL_PointProcess_getJitter_rap, U"PointProcess: Get jitter (rap)", U"PointProcess: Get jitter (rap)...") {
  1009. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1010. OK
  1011. DO
  1012. NUMBER_ONE (PointProcess)
  1013. double result = PointProcess_getJitter_rap (me, fromTime, toTime,
  1014. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1015. NUMBER_ONE_END (U" (rap jitter)")
  1016. }
  1017. FORM (REAL_PointProcess_getJitter_ppq5, U"PointProcess: Get jitter (ppq5)", U"PointProcess: Get jitter (ppq5)...") {
  1018. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1019. OK
  1020. DO
  1021. NUMBER_ONE (PointProcess)
  1022. double result = PointProcess_getJitter_ppq5 (me, fromTime, toTime,
  1023. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1024. NUMBER_ONE_END (U" (ppq5 jitter)")
  1025. }
  1026. FORM (REAL_PointProcess_getJitter_ddp, U"PointProcess: Get jitter (ddp)", U"PointProcess: Get jitter (ddp)...") {
  1027. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1028. OK
  1029. DO
  1030. NUMBER_ONE (PointProcess)
  1031. double result = PointProcess_getJitter_ddp (me, fromTime, toTime,
  1032. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1033. NUMBER_ONE_END (U" (ddp jitter)")
  1034. }
  1035. FORM (REAL_PointProcess_getMeanPeriod, U"PointProcess: Get mean period", U"PointProcess: Get mean period...") {
  1036. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1037. OK
  1038. DO
  1039. NUMBER_ONE (PointProcess)
  1040. double result = PointProcess_getMeanPeriod (me, fromTime, toTime,
  1041. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1042. NUMBER_ONE_END (U" seconds (mean period)")
  1043. }
  1044. FORM (REAL_PointProcess_getStdevPeriod, U"PointProcess: Get stdev period", U"PointProcess: Get stdev period...") {
  1045. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1046. OK
  1047. DO
  1048. NUMBER_ONE (PointProcess)
  1049. double result = PointProcess_getStdevPeriod (me, fromTime, toTime,
  1050. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1051. NUMBER_ONE_END (U" (stdev period)")
  1052. }
  1053. FORM (INTEGER_PointProcess_getLowIndex, U"PointProcess: Get low index", U"PointProcess: Get low index...") {
  1054. REAL (time, U"Time (s)", U"0.5")
  1055. OK
  1056. DO
  1057. NUMBER_ONE (PointProcess)
  1058. integer result = PointProcess_getLowIndex (me, time);
  1059. NUMBER_ONE_END (U" (low index)")
  1060. }
  1061. FORM (INTEGER_PointProcess_getHighIndex, U"PointProcess: Get high index", U"PointProcess: Get high index...") {
  1062. REAL (time, U"Time (s)", U"0.5")
  1063. OK
  1064. DO
  1065. NUMBER_ONE (PointProcess)
  1066. integer result = PointProcess_getHighIndex (me, time);
  1067. NUMBER_ONE_END (U" (high index)")
  1068. }
  1069. FORM (INTEGER_PointProcess_getNearestIndex, U"PointProcess: Get nearest index", U"PointProcess: Get nearest index...") {
  1070. REAL (time, U"Time (s)", U"0.5")
  1071. OK
  1072. DO
  1073. NUMBER_ONE (PointProcess)
  1074. integer result = PointProcess_getNearestIndex (me, time);
  1075. NUMBER_ONE_END (U" (nearest index)")
  1076. }
  1077. DIRECT (INTEGER_PointProcess_getNumberOfPoints) {
  1078. NUMBER_ONE (PointProcess)
  1079. integer result = my nt;
  1080. NUMBER_ONE_END (U" points")
  1081. }
  1082. FORM (INTEGER_PointProcess_getNumberOfPeriods, U"PointProcess: Get number of periods", U"PointProcess: Get number of periods...") {
  1083. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1084. OK
  1085. DO
  1086. NUMBER_ONE (PointProcess)
  1087. integer result = PointProcess_getNumberOfPeriods (me, fromTime, toTime,
  1088. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1089. NUMBER_ONE_END (U" periods")
  1090. }
  1091. FORM (REAL_PointProcess_getTimeFromIndex, U"Get time", 0 /*"PointProcess: Get time from index..."*/) {
  1092. NATURAL (pointNumber, U"Point number", U"10")
  1093. OK
  1094. DO
  1095. NUMBER_ONE (PointProcess)
  1096. double result =
  1097. pointNumber > my nt ? undefined : my t [pointNumber];
  1098. NUMBER_ONE_END (U" seconds")
  1099. }
  1100. DIRECT (HELP_PointProcess_help) {
  1101. HELP (U"PointProcess")
  1102. }
  1103. DIRECT (PLAY_PointProcess_hum) {
  1104. PLAY_EACH (PointProcess)
  1105. PointProcess_hum (me, my xmin, my xmax);
  1106. PLAY_EACH_END
  1107. }
  1108. DIRECT (NEW1_PointProcesses_intersection) {
  1109. CONVERT_COUPLE (PointProcess)
  1110. autoPointProcess result = PointProcesses_intersection (me, you);
  1111. CONVERT_COUPLE_END (U"intersection")
  1112. }
  1113. DIRECT (PLAY_PointProcess_play) {
  1114. PLAY_EACH (PointProcess)
  1115. PointProcess_play (me);
  1116. PLAY_EACH_END
  1117. }
  1118. FORM (MODIFY_PointProcess_removePoint, U"PointProcess: Remove point", U"PointProcess: Remove point...") {
  1119. NATURAL (pointNumber, U"Point number", U"1")
  1120. OK
  1121. DO
  1122. MODIFY_EACH (PointProcess)
  1123. PointProcess_removePoint (me, pointNumber);
  1124. MODIFY_EACH_END
  1125. }
  1126. FORM (MODIFY_PointProcess_removePointNear, U"PointProcess: Remove point near", U"PointProcess: Remove point near...") {
  1127. REAL (time, U"Time (s)", U"0.5")
  1128. OK
  1129. DO
  1130. MODIFY_EACH (PointProcess)
  1131. PointProcess_removePointNear (me, time);
  1132. MODIFY_EACH_END
  1133. }
  1134. FORM (MODIFY_PointProcess_removePoints, U"PointProcess: Remove points", U"PointProcess: Remove points...") {
  1135. NATURAL (fromPointNumber, U"From point number", U"1")
  1136. NATURAL (toPointNumber, U"To point number", U"10")
  1137. OK
  1138. DO
  1139. MODIFY_EACH (PointProcess)
  1140. PointProcess_removePoints (me, fromPointNumber, toPointNumber);
  1141. MODIFY_EACH_END
  1142. }
  1143. FORM (MODIFY_PointProcess_removePointsBetween, U"PointProcess: Remove points between", U"PointProcess: Remove points between...") {
  1144. REAL (fromTime, U"left Time range (s)", U"0.3")
  1145. REAL (toTime, U"right Time range (s)", U"0.7")
  1146. OK
  1147. DO
  1148. MODIFY_EACH (PointProcess)
  1149. PointProcess_removePointsBetween (me, fromTime, toTime);
  1150. MODIFY_EACH_END
  1151. }
  1152. DIRECT (NEW_PointProcess_to_IntervalTier) {
  1153. CONVERT_EACH (PointProcess)
  1154. autoIntervalTier result = IntervalTier_create (my xmin, my xmax);
  1155. CONVERT_EACH_END (my name.get())
  1156. }
  1157. DIRECT (NEW_PointProcess_to_Matrix) {
  1158. CONVERT_EACH (PointProcess)
  1159. autoMatrix result = PointProcess_to_Matrix (me);
  1160. CONVERT_EACH_END (my name.get())
  1161. }
  1162. FORM (NEW_PointProcess_to_PitchTier, U"PointProcess: To PitchTier", U"PointProcess: To PitchTier...") {
  1163. POSITIVE (maximumInterval, U"Maximum interval (s)", U"0.02")
  1164. OK
  1165. DO
  1166. CONVERT_EACH (PointProcess)
  1167. autoPitchTier result = PointProcess_to_PitchTier (me, maximumInterval);
  1168. CONVERT_EACH_END (my name.get())
  1169. }
  1170. FORM (NEW_PointProcess_to_TextGrid, U"PointProcess: To TextGrid...", U"PointProcess: To TextGrid...") {
  1171. SENTENCE (tierNames, U"Tier names", U"Mary John bell")
  1172. SENTENCE (pointTiers, U"Point tiers", U"bell")
  1173. OK
  1174. DO
  1175. CONVERT_EACH (PointProcess)
  1176. autoTextGrid result = TextGrid_create (my xmin, my xmax, tierNames, pointTiers);
  1177. CONVERT_EACH_END (my name.get())
  1178. }
  1179. FORM (NEW_PointProcess_to_TextGrid_vuv, U"PointProcess: To TextGrid (vuv)...", U"PointProcess: To TextGrid (vuv)...") {
  1180. POSITIVE (maximumPeriod, U"Maximum period (s)", U"0.02")
  1181. REAL (meanPeriod, U"Mean period (s)", U"0.01")
  1182. OK
  1183. DO
  1184. CONVERT_EACH (PointProcess)
  1185. autoTextGrid result = PointProcess_to_TextGrid_vuv (me, maximumPeriod, meanPeriod);
  1186. CONVERT_EACH_END (my name.get())
  1187. }
  1188. DIRECT (NEW_PointProcess_to_TextTier) {
  1189. CONVERT_EACH (PointProcess)
  1190. autoTextTier result = TextTier_create (my xmin, my xmax);
  1191. CONVERT_EACH_END (my name.get())
  1192. }
  1193. FORM (NEW_PointProcess_to_Sound_phonation, U"PointProcess: To Sound (phonation)", U"PointProcess: To Sound (phonation)...") {
  1194. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
  1195. POSITIVE (adaptationFactor, U"Adaptation factor", U"1.0")
  1196. POSITIVE (maximumPeriod, U"Maximum period (s)", U"0.05")
  1197. POSITIVE (openPhase, U"Open phase", U"0.7")
  1198. REAL (collisionPhase, U"Collision phase", U"0.03")
  1199. POSITIVE (power1, U"Power 1", U"3.0")
  1200. POSITIVE (power2, U"Power 2", U"4.0")
  1201. OK
  1202. DO
  1203. CONVERT_EACH (PointProcess)
  1204. autoSound result = PointProcess_to_Sound_phonation (me, samplingFrequency,
  1205. adaptationFactor, maximumPeriod, openPhase, collisionPhase, power1, power2);
  1206. CONVERT_EACH_END (my name.get())
  1207. }
  1208. FORM (NEW_PointProcess_to_Sound_pulseTrain, U"PointProcess: To Sound (pulse train)", U"PointProcess: To Sound (pulse train)...") {
  1209. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
  1210. POSITIVE (adaptationFactor, U"Adaptation factor", U"1.0")
  1211. POSITIVE (adaptationTime, U"Adaptation time (s)", U"0.05")
  1212. NATURAL (interpolationDepth, U"Interpolation depth (samples)", U"2000")
  1213. OK
  1214. DO
  1215. CONVERT_EACH (PointProcess)
  1216. autoSound result = PointProcess_to_Sound_pulseTrain (me, samplingFrequency,
  1217. adaptationFactor, adaptationTime, interpolationDepth);
  1218. CONVERT_EACH_END (my name.get())
  1219. }
  1220. DIRECT (NEW_PointProcess_to_Sound_hum) {
  1221. CONVERT_EACH (PointProcess)
  1222. autoSound result = PointProcess_to_Sound_hum (me);
  1223. CONVERT_EACH_END (my name.get())
  1224. }
  1225. DIRECT (NEW1_PointProcesses_union) {
  1226. CONVERT_COUPLE (PointProcess)
  1227. autoPointProcess result = PointProcesses_union (me, you);
  1228. CONVERT_COUPLE_END (U"union")
  1229. }
  1230. FORM (NEW_PointProcess_upto_IntensityTier, U"PointProcess: Up to IntensityTier", U"PointProcess: Up to IntensityTier...") {
  1231. POSITIVE (intensity, U"Intensity (dB)", U"70.0")
  1232. OK
  1233. DO
  1234. CONVERT_EACH (PointProcess)
  1235. autoIntensityTier result = PointProcess_upto_IntensityTier (me, intensity);
  1236. CONVERT_EACH_END (my name.get())
  1237. }
  1238. FORM (NEW_PointProcess_upto_PitchTier, U"PointProcess: Up to PitchTier", U"PointProcess: Up to PitchTier...") {
  1239. POSITIVE (frequency, U"Frequency (Hz)", U"190.0")
  1240. OK
  1241. DO
  1242. CONVERT_EACH (PointProcess)
  1243. autoPitchTier result = PointProcess_upto_PitchTier (me, frequency);
  1244. CONVERT_EACH_END (my name.get())
  1245. }
  1246. FORM (NEW_PointProcess_upto_TextTier, U"PointProcess: Up to TextTier", U"PointProcess: Up to TextTier...") {
  1247. SENTENCE (text, U"Text", U"")
  1248. OK
  1249. DO
  1250. CONVERT_EACH (PointProcess)
  1251. autoTextTier result = PointProcess_upto_TextTier (me, text);
  1252. CONVERT_EACH_END (my name.get())
  1253. }
  1254. FORM (MODIFY_PointProcess_voice, U"PointProcess: Fill unvoiced parts", nullptr) {
  1255. POSITIVE (period, U"Period (s)", U"0.01")
  1256. POSITIVE (maximumVoicedPeriod, U"Maximum voiced period (s)", U"0.02000000001")
  1257. OK
  1258. DO
  1259. MODIFY_EACH_WEAK (PointProcess)
  1260. PointProcess_voice (me, period, maximumVoicedPeriod);
  1261. MODIFY_EACH_WEAK_END
  1262. }
  1263. DIRECT (HINT_PointProcess_Sound_viewAndEdit) {
  1264. INFO_NONE
  1265. Melder_information (U"To include a copy of a Sound in your PointProcess window:\n"
  1266. " select a PointProcess and a Sound, and click \"View & Edit\".");
  1267. INFO_NONE_END
  1268. }
  1269. // MARK: - POINTPROCESS & SOUND
  1270. DIRECT (MODIFY_Point_Sound_transplantDomain) {
  1271. MODIFY_FIRST_OF_TWO (PointProcess, Sound)
  1272. my xmin = your xmin;
  1273. my xmax = your xmax;
  1274. MODIFY_FIRST_OF_TWO_END
  1275. }
  1276. FORM (REAL_Point_Sound_getShimmer_local, U"PointProcess & Sound: Get shimmer (local)", U"PointProcess & Sound: Get shimmer (local)...") {
  1277. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1278. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1279. OK
  1280. DO
  1281. NUMBER_TWO (PointProcess, Sound)
  1282. double result = PointProcess_Sound_getShimmer_local (me, you, fromTime, toTime,
  1283. shortestPeriod, longestPeriod, maximumPeriodFactor, maximumAmplitudeFactor);
  1284. NUMBER_TWO_END (U" (local shimmer)");
  1285. }
  1286. FORM (REAL_Point_Sound_getShimmer_local_dB, U"PointProcess & Sound: Get shimmer (local, dB)", U"PointProcess & Sound: Get shimmer (local, dB)...") {
  1287. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1288. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1289. OK
  1290. DO
  1291. NUMBER_TWO (PointProcess, Sound)
  1292. double result = PointProcess_Sound_getShimmer_local_dB (me, you, fromTime, toTime,
  1293. shortestPeriod, longestPeriod, maximumPeriodFactor, maximumAmplitudeFactor);
  1294. NUMBER_TWO_END (U" dB (local shimmer)");
  1295. }
  1296. FORM (REAL_Point_Sound_getShimmer_apq3, U"PointProcess & Sound: Get shimmer (apq3)", U"PointProcess & Sound: Get shimmer (apq3)...") {
  1297. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1298. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1299. OK
  1300. DO
  1301. NUMBER_TWO (PointProcess, Sound)
  1302. double result = PointProcess_Sound_getShimmer_apq3 (me, you, fromTime, toTime,
  1303. shortestPeriod, longestPeriod, maximumPeriodFactor, maximumAmplitudeFactor);
  1304. NUMBER_TWO_END (U" (apq3 shimmer)");
  1305. }
  1306. FORM (REAL_Point_Sound_getShimmer_apq5, U"PointProcess & Sound: Get shimmer (apq)", U"PointProcess & Sound: Get shimmer (apq5)...") {
  1307. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1308. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1309. OK
  1310. DO
  1311. NUMBER_TWO (PointProcess, Sound)
  1312. double result = PointProcess_Sound_getShimmer_apq5 (me, you, fromTime, toTime,
  1313. shortestPeriod, longestPeriod, maximumPeriodFactor, maximumAmplitudeFactor);
  1314. NUMBER_TWO_END (U" (apq5 shimmer)");
  1315. }
  1316. FORM (REAL_Point_Sound_getShimmer_apq11, U"PointProcess & Sound: Get shimmer (apq11)", U"PointProcess & Sound: Get shimmer (apq11)...") {
  1317. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1318. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1319. OK
  1320. DO
  1321. NUMBER_TWO (PointProcess, Sound)
  1322. double result = PointProcess_Sound_getShimmer_apq11 (me, you, fromTime, toTime,
  1323. shortestPeriod, longestPeriod, maximumPeriodFactor, maximumAmplitudeFactor);
  1324. NUMBER_TWO_END (U" (apq11 shimmer)");
  1325. }
  1326. FORM (REAL_Point_Sound_getShimmer_dda, U"PointProcess & Sound: Get shimmer (dda)", U"PointProcess & Sound: Get shimmer (dda)...") {
  1327. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1328. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1329. OK
  1330. DO
  1331. NUMBER_TWO (PointProcess, Sound)
  1332. double result = PointProcess_Sound_getShimmer_dda (me, you, fromTime, toTime,
  1333. shortestPeriod, longestPeriod, maximumPeriodFactor, maximumAmplitudeFactor);
  1334. NUMBER_TWO_END (U" (dda shimmer)");
  1335. }
  1336. FORM (NEW1_PointProcess_Sound_to_AmplitudeTier_period, U"PointProcess & Sound: To AmplitudeTier (period)", nullptr) {
  1337. dia_PointProcess_getRangeProperty (fromTime, toTime, shortestPeriod, longestPeriod, maximumPeriodfactor)
  1338. OK
  1339. DO
  1340. CONVERT_TWO (PointProcess, Sound)
  1341. autoAmplitudeTier result = PointProcess_Sound_to_AmplitudeTier_period (me, you, fromTime, toTime,
  1342. shortestPeriod, longestPeriod, maximumPeriodFactor);
  1343. CONVERT_TWO_END (your name.get(), U"_", my name.get())
  1344. }
  1345. DIRECT (NEW1_PointProcess_Sound_to_AmplitudeTier_point) {
  1346. CONVERT_TWO (PointProcess, Sound)
  1347. autoAmplitudeTier result = PointProcess_Sound_to_AmplitudeTier_point (me, you);
  1348. CONVERT_TWO_END (your name.get(), U"_", my name.get());
  1349. }
  1350. FORM (NEW1_PointProcess_Sound_to_Ltas, U"PointProcess & Sound: To Ltas", nullptr) {
  1351. POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5000.0")
  1352. POSITIVE (bandwidth, U"Band width (Hz)", U"100.0")
  1353. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  1354. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  1355. POSITIVE (maximumPeriodFactor, U"Maximum period factor", U"1.3")
  1356. OK
  1357. DO
  1358. CONVERT_TWO (PointProcess, Sound)
  1359. autoLtas result = PointProcess_Sound_to_Ltas (me, you,
  1360. maximumFrequency, bandwidth, shortestPeriod, longestPeriod, maximumPeriodFactor);
  1361. CONVERT_TWO_END (your name.get())
  1362. }
  1363. FORM (NEW1_PointProcess_Sound_to_Ltas_harmonics, U"PointProcess & Sound: To Ltas (harmonics", nullptr) {
  1364. NATURAL (maximumHarmonic, U"Maximum harmonic", U"20")
  1365. REAL (shortestPeriod, U"Shortest period (s)", U"0.0001")
  1366. REAL (longestPeriod, U"Longest period (s)", U"0.02")
  1367. POSITIVE (maximumPeriodFactor, U"Maximum period factor", U"1.3")
  1368. OK
  1369. DO
  1370. CONVERT_TWO (PointProcess, Sound)
  1371. autoLtas result = PointProcess_Sound_to_Ltas_harmonics (me, you,
  1372. maximumHarmonic, shortestPeriod, longestPeriod, maximumPeriodFactor);
  1373. CONVERT_TWO_END (your name.get())
  1374. }
  1375. FORM (NEW1_Sound_PointProcess_to_SoundEnsemble_correlate, U"Sound & PointProcess: To SoundEnsemble (correlate)", nullptr) {
  1376. REAL (fromTime, U"From time (s)", U"-0.1")
  1377. REAL (toTime, U"To time (s)", U"1.0")
  1378. OK
  1379. DO
  1380. CONVERT_TWO (Sound, PointProcess)
  1381. autoSound result = Sound_PointProcess_to_SoundEnsemble_correlate (me, you, fromTime, toTime);
  1382. CONVERT_TWO_END (your name.get())
  1383. }
  1384. // MARK: - SPECTRUMTIER
  1385. DIRECT (NEW_SpectrumTier_downto_Table) {
  1386. CONVERT_EACH (SpectrumTier)
  1387. autoTable result = SpectrumTier_downto_Table (me, true, true, true);
  1388. CONVERT_EACH_END (my name.get())
  1389. }
  1390. FORM (GRAPHICS_old_SpectrumTier_draw, U"SpectrumTier: Draw", nullptr) { // 2010-10-19
  1391. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  1392. REAL (toFrequency, U"right Frequency range (Hz)", U"10000.0")
  1393. REAL (fromPower, U"left Power range (dB)", U"20.0")
  1394. REAL (toPower, U"right Power range (dB)", U"80.0")
  1395. BOOLEAN (garnish, U"Garnish", true)
  1396. OK
  1397. DO
  1398. GRAPHICS_EACH (SpectrumTier)
  1399. SpectrumTier_draw (me, GRAPHICS, fromFrequency, toFrequency,
  1400. fromPower, toPower, garnish, U"lines and speckles");
  1401. GRAPHICS_EACH_END
  1402. }
  1403. FORM (GRAPHICS_SpectrumTier_draw, U"SpectrumTier: Draw", nullptr) {
  1404. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  1405. REAL (toFrequency, U"right Frequency range (Hz)", U"10000.0")
  1406. REAL (fromPower, U"left Power range (dB)", U"20.0")
  1407. REAL (toPower, U"right Power range (dB)", U"80.0")
  1408. BOOLEAN (garnish, U"Garnish", true)
  1409. LABEL (U"")
  1410. OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
  1411. OPTION (U"lines")
  1412. OPTION (U"speckles")
  1413. OPTION (U"lines and speckles")
  1414. OK
  1415. DO_ALTERNATIVE (GRAPHICS_old_SpectrumTier_draw)
  1416. GRAPHICS_EACH (SpectrumTier)
  1417. SpectrumTier_draw (me, GRAPHICS, fromFrequency, toFrequency,
  1418. fromPower, toPower, garnish, drawingMethod);
  1419. GRAPHICS_EACH_END
  1420. }
  1421. FORM (LIST_SpectrumTier_list, U"SpectrumTier: List", nullptr) {
  1422. BOOLEAN (includeIndexes, U"Include indexes", true)
  1423. BOOLEAN (includeFrequency, U"Include frequency", true)
  1424. BOOLEAN (includePowerDensity, U"Include power density", true)
  1425. OK
  1426. DO
  1427. INFO_ONE (SpectrumTier)
  1428. SpectrumTier_list (me, includeIndexes, includeFrequency, includePowerDensity);
  1429. INFO_ONE_END
  1430. }
  1431. FORM (MODIFY_SpectrumTier_removePointsBelow, U"SpectrumTier: Remove points below", nullptr) {
  1432. REAL (removeAllPointsBelow, U"Remove all points below (dB)", U"40.0")
  1433. OK
  1434. DO
  1435. MODIFY_EACH (SpectrumTier)
  1436. RealTier_removePointsBelow (me, removeAllPointsBelow);
  1437. MODIFY_EACH_END
  1438. }
  1439. // MARK: - buttons
  1440. void praat_Tiers_init () {
  1441. Thing_recognizeClassesByName (classPointProcess,
  1442. classRealPoint, classRealTier,
  1443. classPitchTier, classIntensityTier, classDurationTier, classAmplitudeTier,
  1444. classSpectrumTier,
  1445. classFormantPoint, classFormantTier, classFormantGrid,
  1446. nullptr);
  1447. praat_addMenuCommand (U"Objects", U"New", U"Tiers", nullptr, 0, nullptr);
  1448. praat_addMenuCommand (U"Objects", U"New", U"Create empty PointProcess...", nullptr, 1, NEW1_PointProcess_createEmpty);
  1449. praat_addMenuCommand (U"Objects", U"New", U"Create Poisson process...", nullptr, 1, NEW1_PointProcess_createPoissonProcess);
  1450. praat_addMenuCommand (U"Objects", U"New", U"-- new tiers ---", nullptr, 1, nullptr);
  1451. praat_addMenuCommand (U"Objects", U"New", U"Create PitchTier...", nullptr, 1, NEW1_PitchTier_create);
  1452. praat_addMenuCommand (U"Objects", U"New", U"Create FormantGrid...", nullptr, 1, NEW1_FormantGrid_create);
  1453. praat_addMenuCommand (U"Objects", U"New", U"Create FormantTier...", nullptr, praat_HIDDEN | praat_DEPTH_1, NEW1_FormantTier_create);
  1454. praat_addMenuCommand (U"Objects", U"New", U"Create IntensityTier...", nullptr, 1, NEW1_IntensityTier_create);
  1455. praat_addMenuCommand (U"Objects", U"New", U"Create DurationTier...", nullptr, 1, NEW1_DurationTier_create);
  1456. praat_addMenuCommand (U"Objects", U"New", U"Create AmplitudeTier...", nullptr, 1, NEW1_AmplitudeTier_create);
  1457. praat_addAction1 (classAmplitudeTier, 0, U"AmplitudeTier help", nullptr, 0, HELP_AmplitudeTier_help);
  1458. praat_addAction1 (classAmplitudeTier, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_AmplitudeTier_viewAndEdit);
  1459. praat_addAction1 (classAmplitudeTier, 1, U"Edit", nullptr, praat_DEPRECATED_2011, WINDOW_AmplitudeTier_viewAndEdit);
  1460. praat_addAction1 (classAmplitudeTier, 0, U"View & Edit with Sound?", nullptr, 0, HINT_AmplitudeTier_Sound_viewAndEdit);
  1461. praat_addAction1 (classAmplitudeTier, 0, U"Query -", nullptr, 0, nullptr);
  1462. praat_TimeTier_query_init (classAmplitudeTier);
  1463. praat_addAction1 (classAmplitudeTier, 1, U"Get shimmer (local)...", nullptr, 1, REAL_AmplitudeTier_getShimmer_local);
  1464. praat_addAction1 (classAmplitudeTier, 1, U"Get shimmer (local_dB)...", nullptr, 1, REAL_AmplitudeTier_getShimmer_local_dB);
  1465. praat_addAction1 (classAmplitudeTier, 1, U"Get shimmer (apq3)...", nullptr, 1, REAL_AmplitudeTier_getShimmer_apq3);
  1466. praat_addAction1 (classAmplitudeTier, 1, U"Get shimmer (apq5)...", nullptr, 1, REAL_AmplitudeTier_getShimmer_apq5);
  1467. praat_addAction1 (classAmplitudeTier, 1, U"Get shimmer (apq11)...", nullptr, 1, REAL_AmplitudeTier_getShimmer_apq11);
  1468. praat_addAction1 (classAmplitudeTier, 1, U"Get shimmer (dda)...", nullptr, 1, REAL_AmplitudeTier_getShimmer_dda);
  1469. praat_addAction1 (classAmplitudeTier, 0, U"Modify -", nullptr, 0, nullptr);
  1470. praat_TimeTier_modify_init (classAmplitudeTier);
  1471. praat_addAction1 (classAmplitudeTier, 0, U"Add point...", nullptr, 1, MODIFY_AmplitudeTier_addPoint);
  1472. praat_addAction1 (classAmplitudeTier, 0, U"Formula...", nullptr, 1, MODIFY_AmplitudeTier_formula);
  1473. praat_addAction1 (classAmplitudeTier, 0, U"Synthesize", nullptr, 0, nullptr);
  1474. praat_addAction1 (classAmplitudeTier, 0, U"To Sound (pulse train)...", nullptr, 0, NEW_AmplitudeTier_to_Sound);
  1475. praat_addAction1 (classAmplitudeTier, 0, U"Convert", nullptr, 0, nullptr);
  1476. praat_addAction1 (classAmplitudeTier, 0, U"To IntensityTier...", nullptr, 0, NEW_AmplitudeTier_to_IntensityTier);
  1477. praat_addAction1 (classAmplitudeTier, 0, U"Down to PointProcess", nullptr, 0, NEW_AmplitudeTier_downto_PointProcess);
  1478. praat_addAction1 (classAmplitudeTier, 0, U"Down to TableOfReal", nullptr, 0, NEW_AmplitudeTier_downto_TableOfReal);
  1479. praat_addAction1 (classDurationTier, 0, U"DurationTier help", nullptr, 0, HELP_DurationTier_help);
  1480. praat_addAction1 (classDurationTier, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_DurationTier_edit);
  1481. praat_addAction1 (classDurationTier, 1, U"Edit", nullptr, praat_DEPRECATED_2011, WINDOW_DurationTier_edit);
  1482. praat_addAction1 (classDurationTier, 0, U"View & Edit with Sound?", nullptr, 0, HINT_DurationTier_Sound_edit);
  1483. praat_addAction1 (classDurationTier, 0, U"& Manipulation: Replace?", nullptr, 0, HINT_DurationTier_Manipulation_replace);
  1484. praat_addAction1 (classDurationTier, 0, U"Query -", nullptr, 0, nullptr);
  1485. praat_TimeTier_query_init (classDurationTier);
  1486. praat_addAction1 (classDurationTier, 1, U"-- get content --", nullptr, 1, nullptr);
  1487. praat_addAction1 (classDurationTier, 1, U"Get value at time...", nullptr, 1, REAL_DurationTier_getValueAtTime);
  1488. praat_addAction1 (classDurationTier, 1, U"Get value at index...", nullptr, 1, REAL_DurationTier_getValueAtIndex);
  1489. praat_addAction1 (classDurationTier, 1, U"Get target duration...", nullptr, 1, REAL_DurationTier_getTargetDuration);
  1490. praat_addAction1 (classDurationTier, 0, U"Modify -", nullptr, 0, nullptr);
  1491. praat_TimeTier_modify_init (classDurationTier);
  1492. praat_addAction1 (classDurationTier, 0, U"Add point...", nullptr, 1, MODIFY_DurationTier_addPoint);
  1493. praat_addAction1 (classDurationTier, 0, U"Formula...", nullptr, 1, MODIFY_DurationTier_formula);
  1494. praat_addAction1 (classDurationTier, 0, U"Convert", nullptr, 0, nullptr);
  1495. praat_addAction1 (classDurationTier, 0, U"Down to PointProcess", nullptr, 0, NEW_DurationTier_downto_PointProcess);
  1496. praat_addAction1 (classFormantGrid, 0, U"FormantGrid help", nullptr, 0, HELP_FormantGrid_help);
  1497. praat_addAction1 (classFormantGrid, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_FormantGrid_edit);
  1498. praat_addAction1 (classFormantGrid, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_FormantGrid_edit);
  1499. praat_addAction1 (classFormantGrid, 0, U"Modify -", nullptr, 0, nullptr);
  1500. praat_TimeFunction_modify_init (classFormantGrid);
  1501. praat_addAction1 (classFormantGrid, 0, U"Formula (frequencies)...", nullptr, 1, MODIFY_FormantGrid_formula_frequencies);
  1502. //praat_addAction1 (classFormantGrid, 0, U"Formula (bandwidths)...", nullptr, 1, MODIFY_FormantGrid_formula_bandwidths);
  1503. praat_addAction1 (classFormantGrid, 0, U"Add formant point...", nullptr, 1, MODIFY_FormantGrid_addFormantPoint);
  1504. praat_addAction1 (classFormantGrid, 0, U"Add bandwidth point...", nullptr, 1, MODIFY_FormantGrid_addBandwidthPoint);
  1505. praat_addAction1 (classFormantGrid, 0, U"Remove formant points between...", nullptr, 1, MODIFY_FormantGrid_removeFormantPointsBetween);
  1506. praat_addAction1 (classFormantGrid, 0, U"Remove bandwidth points between...", nullptr, 1, MODIFY_FormantGrid_removeBandwidthPointsBetween);
  1507. praat_addAction1 (classFormantGrid, 0, U"Convert -", nullptr, 0, nullptr);
  1508. praat_addAction1 (classFormantGrid, 0, U"To Formant...", nullptr, 1, NEW_FormantGrid_to_Formant);
  1509. praat_addAction1 (classFormantTier, 0, U"Draw -", nullptr, 0, nullptr);
  1510. praat_addAction1 (classFormantTier, 0, U"Speckle...", nullptr, 1, GRAPHICS_FormantTier_speckle);
  1511. praat_addAction1 (classFormantTier, 0, U"Query -", nullptr, 0, nullptr);
  1512. praat_TimeTier_query_init (classFormantTier);
  1513. praat_addAction1 (classFormantTier, 1, U"-- get value --", nullptr, 1, nullptr);
  1514. praat_addAction1 (classFormantTier, 1, U"Get value at time...", nullptr, 1, REAL_FormantTier_getValueAtTime);
  1515. praat_addAction1 (classFormantTier, 1, U"Get bandwidth at time...", nullptr, 1, REAL_FormantTier_getBandwidthAtTime);
  1516. praat_addAction1 (classFormantTier, 0, U"Modify -", nullptr, 0, nullptr);
  1517. praat_TimeTier_modify_init (classFormantTier);
  1518. praat_addAction1 (classFormantTier, 0, U"Add point...", nullptr, 1, MODIFY_FormantTier_addPoint);
  1519. praat_addAction1 (classFormantTier, 0, U"Down", nullptr, 0, nullptr);
  1520. praat_addAction1 (classFormantTier, 0, U"Down to TableOfReal...", nullptr, 0, NEW_FormantTier_downto_TableOfReal);
  1521. praat_addAction1 (classIntensityTier, 0, U"IntensityTier help", nullptr, 0, HELP_IntensityTier_help);
  1522. praat_addAction1 (classIntensityTier, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_IntensityTier_viewAndEdit);
  1523. praat_addAction1 (classIntensityTier, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_IntensityTier_viewAndEdit);
  1524. praat_addAction1 (classIntensityTier, 0, U"View & Edit with Sound?", nullptr, 0, HINT_IntensityTier_Sound_viewAndEdit);
  1525. praat_addAction1 (classIntensityTier, 0, U"Query -", nullptr, 0, nullptr);
  1526. praat_TimeTier_query_init (classIntensityTier);
  1527. praat_addAction1 (classIntensityTier, 1, U"-- get content --", nullptr, 1, nullptr);
  1528. praat_addAction1 (classIntensityTier, 1, U"Get value at time...", nullptr, 1, REAL_IntensityTier_getValueAtTime);
  1529. praat_addAction1 (classIntensityTier, 1, U"Get value at index...", nullptr, 1, REAL_IntensityTier_getValueAtIndex);
  1530. praat_addAction1 (classIntensityTier, 0, U"Modify -", nullptr, 0, nullptr);
  1531. praat_TimeTier_modify_init (classIntensityTier);
  1532. praat_addAction1 (classIntensityTier, 0, U"Add point...", nullptr, 1, MODIFY_IntensityTier_addPoint);
  1533. praat_addAction1 (classIntensityTier, 0, U"Formula...", nullptr, 1, MODIFY_IntensityTier_formula);
  1534. praat_addAction1 (classIntensityTier, 0, U"Convert", nullptr, 0, nullptr);
  1535. praat_addAction1 (classIntensityTier, 0, U"To AmplitudeTier", nullptr, 0, NEW_IntensityTier_to_AmplitudeTier);
  1536. praat_addAction1 (classIntensityTier, 0, U"Down to PointProcess", nullptr, 0, NEW_IntensityTier_downto_PointProcess);
  1537. praat_addAction1 (classIntensityTier, 0, U"Down to TableOfReal", nullptr, 0, NEW_IntensityTier_downto_TableOfReal);
  1538. praat_addAction1 (classPitchTier, 1, U"Save as PitchTier spreadsheet file...", nullptr, 0, SAVE_PitchTier_writeToPitchTierSpreadsheetFile);
  1539. praat_addAction1 (classPitchTier, 1, U"Write to PitchTier spreadsheet file...", U"*Save as PitchTier spreadsheet file...", praat_DEPRECATED_2011, SAVE_PitchTier_writeToPitchTierSpreadsheetFile);
  1540. praat_addAction1 (classPitchTier, 1, U"Save as headerless spreadsheet file...", nullptr, 0, SAVE_PitchTier_writeToHeaderlessSpreadsheetFile);
  1541. praat_addAction1 (classPitchTier, 1, U"Write to headerless spreadsheet file...", U"*Save as headerless spreadsheet file...", praat_DEPRECATED_2011, SAVE_PitchTier_writeToHeaderlessSpreadsheetFile);
  1542. praat_addAction1 (classPitchTier, 0, U"PitchTier help", nullptr, 0, HELP_PitchTier_help);
  1543. praat_addAction1 (classPitchTier, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_PitchTier_viewAndEdit);
  1544. praat_addAction1 (classPitchTier, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_PitchTier_viewAndEdit);
  1545. praat_addAction1 (classPitchTier, 0, U"View & Edit with Sound?", nullptr, 0, HINT_PitchTier_Sound_viewAndEdit);
  1546. praat_addAction1 (classPitchTier, 0, U"Play -", nullptr, 0, nullptr);
  1547. praat_addAction1 (classPitchTier, 0, U"Play pulses", nullptr, 1, PLAY_PitchTier_play);
  1548. praat_addAction1 (classPitchTier, 0, U"Hum", nullptr, 1, PLAY_PitchTier_hum);
  1549. praat_addAction1 (classPitchTier, 0, U"Play sine", nullptr, 1, PLAY_PitchTier_playSine);
  1550. praat_addAction1 (classPitchTier, 0, U"Draw...", nullptr, 0, GRAPHICS_PitchTier_draw);
  1551. praat_addAction1 (classPitchTier, 0, U"& Manipulation: Replace?", nullptr, 0, INFO_PitchTier_Manipulation_replace);
  1552. praat_addAction1 (classPitchTier, 0, U"Query -", nullptr, 0, nullptr);
  1553. praat_TimeTier_query_init (classPitchTier);
  1554. praat_addAction1 (classPitchTier, 1, U"-- get content --", nullptr, 1, nullptr);
  1555. praat_addAction1 (classPitchTier, 1, U"Get value at time...", nullptr, 1, REAL_PitchTier_getValueAtTime);
  1556. praat_addAction1 (classPitchTier, 1, U"Get value at index...", nullptr, 1, REAL_PitchTier_getValueAtIndex);
  1557. praat_addAction1 (classPitchTier, 1, U"-- get statistics --", nullptr, 1, nullptr);
  1558. praat_addAction1 (classPitchTier, 1, U"Get mean (curve)...", nullptr, 1, REAL_PitchTier_getMean_curve);
  1559. praat_addAction1 (classPitchTier, 1, U"Get mean (points)...", nullptr, 1, REAL_PitchTier_getMean_points);
  1560. praat_addAction1 (classPitchTier, 1, U"Get standard deviation (curve)...", nullptr, 1, REAL_PitchTier_getStandardDeviation_curve);
  1561. praat_addAction1 (classPitchTier, 1, U"Get standard deviation (points)...", nullptr, 1, REAL_PitchTier_getStandardDeviation_points);
  1562. praat_addAction1 (classPitchTier, 0, U"Modify -", nullptr, 0, nullptr);
  1563. praat_TimeTier_modify_init (classPitchTier);
  1564. praat_addAction1 (classPitchTier, 0, U"Add point...", nullptr, 1, MODIFY_PitchTier_addPoint);
  1565. praat_addAction1 (classPitchTier, 0, U"Formula...", nullptr, 1, MODIFY_PitchTier_formula);
  1566. praat_addAction1 (classPitchTier, 0, U"-- stylize --", nullptr, 1, nullptr);
  1567. praat_addAction1 (classPitchTier, 0, U"Stylize...", nullptr, 1, MODIFY_PitchTier_stylize);
  1568. praat_addAction1 (classPitchTier, 0, U"Interpolate quadratically...", nullptr, 1, MODIFY_PitchTier_interpolateQuadratically);
  1569. praat_addAction1 (classPitchTier, 0, U"-- modify frequencies --", nullptr, 1, nullptr);
  1570. praat_addAction1 (classPitchTier, 0, U"Shift frequencies...", nullptr, 1, MODIFY_PitchTier_shiftFrequencies);
  1571. praat_addAction1 (classPitchTier, 0, U"Multiply frequencies...", nullptr, 1, MODIFY_PitchTier_multiplyFrequencies);
  1572. praat_addAction1 (classPitchTier, 0, U"Synthesize -", nullptr, 0, nullptr);
  1573. praat_addAction1 (classPitchTier, 0, U"To PointProcess", nullptr, 1, NEW_PitchTier_to_PointProcess);
  1574. praat_addAction1 (classPitchTier, 0, U"To Sound (pulse train)...", nullptr, 1, NEW_PitchTier_to_Sound_pulseTrain);
  1575. praat_addAction1 (classPitchTier, 0, U"To Sound (phonation)...", nullptr, 1, NEW_PitchTier_to_Sound_phonation);
  1576. praat_addAction1 (classPitchTier, 0, U"To Sound (sine)...", nullptr, 1, NEW_PitchTier_to_Sound_sine);
  1577. praat_addAction1 (classPitchTier, 0, U"Convert -", nullptr, 0, nullptr);
  1578. praat_addAction1 (classPitchTier, 0, U"Down to PointProcess", nullptr, 1, NEW_PitchTier_downto_PointProcess);
  1579. praat_addAction1 (classPitchTier, 0, U"Down to TableOfReal...", nullptr, 1, NEW_PitchTier_downto_TableOfReal);
  1580. praat_addAction1 (classPointProcess, 0, U"PointProcess help", nullptr, 0, HELP_PointProcess_help);
  1581. praat_addAction1 (classPointProcess, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_PointProcess_viewAndEdit);
  1582. praat_addAction1 (classPointProcess, 1, U"View & Edit alone", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_PointProcess_viewAndEdit);
  1583. praat_addAction1 (classPointProcess, 1, U"Edit alone", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_PointProcess_viewAndEdit);
  1584. praat_addAction1 (classPointProcess, 0, U"View & Edit with Sound?", nullptr, praat_NO_API, HINT_PointProcess_Sound_viewAndEdit);
  1585. praat_addAction1 (classPointProcess, 0, U"Play -", nullptr, 0, nullptr);
  1586. praat_addAction1 (classPointProcess, 0, U"Play as pulse train", nullptr, 1, PLAY_PointProcess_play);
  1587. praat_addAction1 (classPointProcess, 0, U"Hum", nullptr, 1, PLAY_PointProcess_hum);
  1588. praat_addAction1 (classPointProcess, 0, U"Draw...", nullptr, 0, GRAPHICS_PointProcess_draw);
  1589. praat_addAction1 (classPointProcess, 0, U"Query -", nullptr, 0, nullptr);
  1590. praat_TimeFunction_query_init (classPointProcess);
  1591. praat_addAction1 (classPointProcess, 1, U"-- script get --", nullptr, 1, nullptr);
  1592. praat_addAction1 (classPointProcess, 1, U"Get number of points", nullptr, 1, INTEGER_PointProcess_getNumberOfPoints);
  1593. praat_addAction1 (classPointProcess, 1, U"Get low index...", nullptr, 1, INTEGER_PointProcess_getLowIndex);
  1594. praat_addAction1 (classPointProcess, 1, U"Get high index...", nullptr, 1, INTEGER_PointProcess_getHighIndex);
  1595. praat_addAction1 (classPointProcess, 1, U"Get nearest index...", nullptr, 1, INTEGER_PointProcess_getNearestIndex);
  1596. praat_addAction1 (classPointProcess, 1, U"Get time from index...", nullptr, 1, REAL_PointProcess_getTimeFromIndex);
  1597. praat_addAction1 (classPointProcess, 1, U"Get interval...", nullptr, 1, REAL_PointProcess_getInterval);
  1598. praat_addAction1 (classPointProcess, 1, U"-- periods --", nullptr, 1, nullptr);
  1599. praat_addAction1 (classPointProcess, 1, U"Get number of periods...", nullptr, 1, INTEGER_PointProcess_getNumberOfPeriods);
  1600. praat_addAction1 (classPointProcess, 1, U"Get mean period...", nullptr, 1, REAL_PointProcess_getMeanPeriod);
  1601. praat_addAction1 (classPointProcess, 1, U"Get stdev period...", nullptr, 1, REAL_PointProcess_getStdevPeriod);
  1602. praat_addAction1 (classPointProcess, 1, U"Get jitter (local)...", nullptr, 1, REAL_PointProcess_getJitter_local);
  1603. praat_addAction1 (classPointProcess, 1, U"Get jitter (local, absolute)...", nullptr, 1, REAL_PointProcess_getJitter_local_absolute);
  1604. praat_addAction1 (classPointProcess, 1, U"Get jitter (rap)...", nullptr, 1, REAL_PointProcess_getJitter_rap);
  1605. praat_addAction1 (classPointProcess, 1, U"Get jitter (ppq5)...", nullptr, 1, REAL_PointProcess_getJitter_ppq5);
  1606. praat_addAction1 (classPointProcess, 1, U"Get jitter (ddp)...", nullptr, 1, REAL_PointProcess_getJitter_ddp);
  1607. praat_addAction1 (classPointProcess, 0, U"Modify -", nullptr, 0, nullptr);
  1608. praat_TimeFunction_modify_init (classPointProcess);
  1609. praat_addAction1 (classPointProcess, 0, U"Add point...", nullptr, 1, MODIFY_PointProcess_addPoint);
  1610. praat_addAction1 (classPointProcess, 0, U"Add points...", nullptr, 1, MODIFY_PointProcess_addPoints);
  1611. praat_addAction1 (classPointProcess, 0, U"Remove point...", nullptr, 1, MODIFY_PointProcess_removePoint);
  1612. praat_addAction1 (classPointProcess, 0, U"Remove point near...", nullptr, 1, MODIFY_PointProcess_removePointNear);
  1613. praat_addAction1 (classPointProcess, 0, U"Remove points...", nullptr, 1, MODIFY_PointProcess_removePoints);
  1614. praat_addAction1 (classPointProcess, 0, U"Remove points between...", nullptr, 1, MODIFY_PointProcess_removePointsBetween);
  1615. praat_addAction1 (classPointProcess, 0, U"-- voice --", nullptr, 1, nullptr);
  1616. praat_addAction1 (classPointProcess, 0, U"Fill...", nullptr, 1, MODIFY_PointProcess_fill);
  1617. praat_addAction1 (classPointProcess, 0, U"Voice...", nullptr, 1, MODIFY_PointProcess_voice);
  1618. praat_addAction1 (classPointProcess, 0, U"Annotate -", nullptr, 0, nullptr);
  1619. praat_addAction1 (classPointProcess, 0, U"To TextGrid...", nullptr, 1, NEW_PointProcess_to_TextGrid);
  1620. praat_addAction1 (classPointProcess, 0, U"-- to single tier --", nullptr, 1, nullptr);
  1621. praat_addAction1 (classPointProcess, 0, U"To TextTier", nullptr, 1, NEW_PointProcess_to_TextTier);
  1622. praat_addAction1 (classPointProcess, 0, U"To IntervalTier", nullptr, 1, NEW_PointProcess_to_IntervalTier);
  1623. praat_addAction1 (classPointProcess, 0, U"Analyse -", nullptr, 0, nullptr);
  1624. praat_addAction1 (classPointProcess, 0, U"To PitchTier...", nullptr, 1, NEW_PointProcess_to_PitchTier);
  1625. praat_addAction1 (classPointProcess, 0, U"To TextGrid (vuv)...", nullptr, 1, NEW_PointProcess_to_TextGrid_vuv);
  1626. praat_addAction1 (classPointProcess, 0, U"Synthesize -", nullptr, 0, nullptr);
  1627. praat_addAction1 (classPointProcess, 0, U"To Sound (pulse train)...", nullptr, 1, NEW_PointProcess_to_Sound_pulseTrain);
  1628. praat_addAction1 (classPointProcess, 0, U"To Sound (phonation)...", nullptr, 1, NEW_PointProcess_to_Sound_phonation);
  1629. praat_addAction1 (classPointProcess, 0, U"To Sound (hum)", nullptr, 1, NEW_PointProcess_to_Sound_hum);
  1630. praat_addAction1 (classPointProcess, 0, U"Convert -", nullptr, 0, nullptr);
  1631. praat_addAction1 (classPointProcess, 0, U"Hack", nullptr, 1, nullptr);
  1632. praat_addAction1 (classPointProcess, 0, U"To Matrix", nullptr, 2, NEW_PointProcess_to_Matrix);
  1633. praat_addAction1 (classPointProcess, 0, U"Up to TextTier...", nullptr, 2, NEW_PointProcess_upto_TextTier);
  1634. praat_addAction1 (classPointProcess, 0, U"Up to PitchTier...", nullptr, 2, NEW_PointProcess_upto_PitchTier);
  1635. praat_addAction1 (classPointProcess, 0, U"Up to IntensityTier...", nullptr, 2, NEW_PointProcess_upto_IntensityTier);
  1636. praat_addAction1 (classPointProcess, 0, U"Combine -", nullptr, 0, nullptr);
  1637. praat_addAction1 (classPointProcess, 2, U"Union", nullptr, 1, NEW1_PointProcesses_union);
  1638. praat_addAction1 (classPointProcess, 2, U"Intersection", nullptr, 1, NEW1_PointProcesses_intersection);
  1639. praat_addAction1 (classPointProcess, 2, U"Difference", nullptr, 1, NEW1_PointProcesses_difference);
  1640. praat_addAction1 (classSpectrumTier, 0, U"Draw...", nullptr, 0, GRAPHICS_SpectrumTier_draw);
  1641. praat_addAction1 (classSpectrumTier, 0, U"Tabulate -", nullptr, 0, nullptr);
  1642. praat_addAction1 (classSpectrumTier, 1, U"List...", nullptr, 1, LIST_SpectrumTier_list);
  1643. praat_addAction1 (classSpectrumTier, 0, U"Down to Table", nullptr, 1, NEW_SpectrumTier_downto_Table);
  1644. praat_addAction1 (classSpectrumTier, 0, U"Remove points below...", nullptr, 0, MODIFY_SpectrumTier_removePointsBelow);
  1645. praat_addAction2 (classAmplitudeTier, 1, classSound, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_AmplitudeTier_viewAndEdit);
  1646. praat_addAction2 (classAmplitudeTier, 1, classSound, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_AmplitudeTier_viewAndEdit);
  1647. praat_addAction2 (classAmplitudeTier, 1, classSound, 1, U"Multiply", nullptr, 0, NEW1_Sound_AmplitudeTier_multiply);
  1648. praat_addAction2 (classDurationTier, 1, classSound, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_DurationTier_edit);
  1649. praat_addAction2 (classDurationTier, 1, classSound, 1, U"Edit", nullptr, praat_DEPRECATED_2011, WINDOW_DurationTier_edit);
  1650. praat_addAction2 (classFormantGrid, 1, classSound, 1, U"Filter", nullptr, 0, NEW1_Sound_FormantGrid_filter);
  1651. praat_addAction2 (classFormantGrid, 1, classSound, 1, U"Filter (no scale)", nullptr, 0, NEW1_Sound_FormantGrid_filter_noscale);
  1652. praat_addAction2 (classFormantTier, 1, classSound, 1, U"Filter", nullptr, 0, NEW1_Sound_FormantTier_filter);
  1653. praat_addAction2 (classFormantTier, 1, classSound, 1, U"Filter (no scale)", nullptr, 0, NEW1_Sound_FormantTier_filter_noscale);
  1654. praat_addAction2 (classIntensityTier, 1, classPointProcess, 1, U"To IntensityTier", nullptr, 0, NEW1_IntensityTier_PointProcess_to_IntensityTier);
  1655. praat_addAction2 (classIntensityTier, 1, classSound, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_IntensityTier_viewAndEdit);
  1656. praat_addAction2 (classIntensityTier, 1, classSound, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_IntensityTier_viewAndEdit);
  1657. praat_addAction2 (classIntensityTier, 1, classSound, 1, U"Multiply...", nullptr, 0, NEW1_Sound_IntensityTier_multiply);
  1658. praat_addAction2 (classIntensityTier, 1, classSound, 1, U"Multiply", U"*Multiply...", praat_DEPRECATED_2005, NEW1_Sound_IntensityTier_multiply_old);
  1659. praat_addAction2 (classPitchTier, 1, classPointProcess, 1, U"To PitchTier", nullptr, 0, NEW1_PitchTier_PointProcess_to_PitchTier);
  1660. praat_addAction2 (classPitchTier, 1, classSound, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_PitchTier_viewAndEdit);
  1661. praat_addAction2 (classPitchTier, 1, classSound, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_PitchTier_viewAndEdit);
  1662. praat_addAction2 (classPointProcess, 1, classSound, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_PointProcess_viewAndEdit);
  1663. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_PointProcess_viewAndEdit);
  1664. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Query", nullptr, 0, nullptr);
  1665. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Get shimmer (local)...", nullptr, 0, REAL_Point_Sound_getShimmer_local);
  1666. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Get shimmer (local_dB)...", nullptr, 0, REAL_Point_Sound_getShimmer_local_dB);
  1667. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Get shimmer (apq3)...", nullptr, 0, REAL_Point_Sound_getShimmer_apq3);
  1668. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Get shimmer (apq5)...", nullptr, 0, REAL_Point_Sound_getShimmer_apq5);
  1669. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Get shimmer (apq11)...", nullptr, 0, REAL_Point_Sound_getShimmer_apq11);
  1670. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Get shimmer (dda)...", nullptr, 0, REAL_Point_Sound_getShimmer_dda);
  1671. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Modify", nullptr, 0, nullptr);
  1672. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Transplant time domain", nullptr, 0, MODIFY_Point_Sound_transplantDomain);
  1673. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Analyse", nullptr, 0, nullptr);
  1674. /*praat_addAction2 (classPointProcess, 1, classSound, 1, U"To Manipulation", nullptr, 0, NEW1_Sound_PointProcess_to_Manipulation);*/
  1675. praat_addAction2 (classPointProcess, 1, classSound, 1, U"To AmplitudeTier (point)", nullptr, 0, NEW1_PointProcess_Sound_to_AmplitudeTier_point);
  1676. praat_addAction2 (classPointProcess, 1, classSound, 1, U"To AmplitudeTier (period)...", nullptr, 0, NEW1_PointProcess_Sound_to_AmplitudeTier_period);
  1677. praat_addAction2 (classPointProcess, 1, classSound, 1, U"To Ltas...", nullptr, 0, NEW1_PointProcess_Sound_to_Ltas);
  1678. praat_addAction2 (classPointProcess, 1, classSound, 1, U"To Ltas (only harmonics)...", nullptr, 0, NEW1_PointProcess_Sound_to_Ltas_harmonics);
  1679. praat_addAction2 (classPointProcess, 1, classSound, 1, U"Synthesize", nullptr, 0, nullptr);
  1680. praat_addAction2 (classPointProcess, 1, classSound, 1, U"To Sound ensemble...", nullptr, 0, NEW1_Sound_PointProcess_to_SoundEnsemble_correlate);
  1681. }
  1682. /* End of file praat_Tiers.cpp */