praat_Fon.cpp 132 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405
  1. /* praat_Fon.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 "AmplitudeTier.h"
  19. #include "AmplitudeTierEditor.h"
  20. #include "Cochleagram_and_Excitation.h"
  21. #include "Corpus.h"
  22. #include "Distributions_and_Strings.h"
  23. #include "Distributions_and_Transition.h"
  24. #include "DurationTierEditor.h"
  25. #include "Excitation_to_Formant.h"
  26. #include "FormantGrid.h"
  27. #include "FormantGridEditor.h"
  28. #include "FormantTier.h"
  29. #include "Harmonicity.h"
  30. #include "IntensityTier.h"
  31. #include "IntensityTierEditor.h"
  32. #include "LongSound.h"
  33. #include "Ltas_to_SpectrumTier.h"
  34. #include "ManipulationEditor.h"
  35. #include "Matrix_and_Pitch.h"
  36. #include "Matrix_and_PointProcess.h"
  37. #include "Matrix_and_Polygon.h"
  38. #include "Matrix_extensions.h"
  39. #include "Movie.h"
  40. #include "ParamCurve.h"
  41. #include "Pitch_Intensity.h"
  42. #include "Pitch_to_PitchTier.h"
  43. #include "Pitch_to_PointProcess.h"
  44. #include "Pitch_to_Sound.h"
  45. #include "PitchEditor.h"
  46. #include "PitchTier_to_PointProcess.h"
  47. #include "PitchTier_to_Sound.h"
  48. #include "PitchTierEditor.h"
  49. #include "PointEditor.h"
  50. #include "PointProcess_and_Sound.h"
  51. #include "Praat_tests.h"
  52. #include "Sound_and_Spectrogram.h"
  53. #include "Sound_and_Spectrum.h"
  54. #include "Sound_PointProcess.h"
  55. #include "SpectrogramEditor.h"
  56. #include "Spectrum_and_Spectrogram.h"
  57. #include "Spectrum_to_Excitation.h"
  58. #include "Spectrum_to_Formant.h"
  59. #include "SpectrumEditor.h"
  60. #include "SpellingChecker.h"
  61. #include "Strings_extensions.h"
  62. #include "StringsEditor.h"
  63. #include "TableEditor.h"
  64. #include "TextGrid.h"
  65. #include "VocalTract.h"
  66. #include "VoiceAnalysis.h"
  67. #include "WordList.h"
  68. #include "praat_TimeTier.h"
  69. #include "praat_TimeFrameSampled.h"
  70. #include "praat_TimeVector.h"
  71. #include "praat_Sound.h"
  72. #include "praat_Matrix.h"
  73. #include "praat_Tiers.h"
  74. #include "praat_ExperimentMFC.h"
  75. #include "praat_uvafon.h"
  76. #undef iam
  77. #define iam iam_LOOP
  78. static const conststring32 STRING_FROM_FREQUENCY_HZ = U"left Frequency range (Hz)";
  79. static const conststring32 STRING_TO_FREQUENCY_HZ = U"right Frequency range (Hz)";
  80. // MARK: - COCHLEAGRAM
  81. // MARK: Help
  82. DIRECT (HELP_Cochleagram_help) {
  83. HELP (U"Cochleagram")
  84. }
  85. // MARK: Movie
  86. DIRECT (MOVIE_Cochleagram_movie) {
  87. MOVIE_ONE (Cochleagram, U"Cochleagram movie", 300, 300)
  88. Matrix_movie (me, graphics);
  89. MOVIE_ONE_END
  90. }
  91. // MARK: Info
  92. FORM (REAL_Cochleagram_difference, U"Cochleagram difference", nullptr) {
  93. praat_TimeFunction_RANGE (fromTime, toTime)
  94. OK
  95. DO
  96. NUMBER_COUPLE (Cochleagram)
  97. double result = Cochleagram_difference (me, you, fromTime, toTime);
  98. NUMBER_COUPLE_END (U" hertz (root-mean-square)")
  99. }
  100. // MARK: Draw
  101. FORM (GRAPHICS_Cochleagram_paint, U"Paint Cochleagram", nullptr) {
  102. praat_TimeFunction_RANGE (fromTime, toTime)
  103. BOOLEAN (garnish, U"Garnish", true)
  104. OK
  105. DO
  106. GRAPHICS_EACH (Cochleagram)
  107. Cochleagram_paint (me, GRAPHICS, fromTime, toTime, garnish);
  108. GRAPHICS_EACH_END
  109. }
  110. // MARK: Modify
  111. FORM (MODIFY_Cochleagram_formula, U"Cochleagram Formula", U"Cochleagram: Formula...") {
  112. LABEL (U"`x` is time in seconds, `y` is place in Bark")
  113. LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
  114. "for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
  115. TEXTFIELD (formula, U"Formula:", U"self")
  116. OK
  117. DO
  118. MODIFY_EACH_WEAK (Cochleagram)
  119. Matrix_formula (me, formula, interpreter, NULL);
  120. MODIFY_EACH_WEAK_END
  121. }
  122. // MARK: Analyse
  123. FORM (NEW_Cochleagram_to_Excitation, U"From Cochleagram to Excitation", nullptr) {
  124. REAL (time, U"Time (s)", U"0.0")
  125. OK
  126. DO
  127. CONVERT_EACH (Cochleagram)
  128. autoExcitation result = Cochleagram_to_Excitation (me, time);
  129. CONVERT_EACH_END (my name.get())
  130. }
  131. // MARK: Hack
  132. DIRECT (NEW_Cochleagram_to_Matrix) {
  133. CONVERT_EACH (Cochleagram)
  134. autoMatrix result = Cochleagram_to_Matrix (me);
  135. CONVERT_EACH_END (my name.get())
  136. }
  137. // MARK: - CORPUS
  138. // MARK: New
  139. FORM (NEW1_Corpus_create, U"Create Corpus", U"Create Corpus...") {
  140. WORD (name, U"Name", U"myCorpus")
  141. TEXTFIELD (folderWithSoundFiles, U"Folder with sound files:", U"")
  142. WORD (soundFileExtension, U"Sound file extension", U"wav")
  143. TEXTFIELD (folderWithAnnotationFiles, U"Folder with annotation files:", U"")
  144. WORD (annotationFileExtension, U"Annotation file extension", U"TextGrid")
  145. OK
  146. DO
  147. CREATE_ONE
  148. autoCorpus result = Corpus_create (folderWithSoundFiles, soundFileExtension, folderWithAnnotationFiles, annotationFileExtension);
  149. CREATE_ONE_END (name)
  150. }
  151. // MARK: View & Edit
  152. DIRECT (WINDOW_Corpus_edit) {
  153. if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot edit a Corpus from batch.");
  154. FIND_ONE_WITH_IOBJECT (Corpus)
  155. autoTableEditor editor = TableEditor_create (ID_AND_FULL_NAME, me);
  156. praat_installEditor (editor.get(), IOBJECT);
  157. editor.releaseToUser();
  158. END
  159. }
  160. // MARK: - DISTRIBUTIONS
  161. FORM (NEW_Distributions_to_Transition, U"To Transition", nullptr) {
  162. NATURAL (environment, U"Environment", U"1")
  163. BOOLEAN (greedy, U"Greedy", true)
  164. OK
  165. DO
  166. CONVERT_EACH (Distributions)
  167. autoTransition result = Distributions_to_Transition (me, nullptr, environment, nullptr, greedy);
  168. CONVERT_EACH_END (my name.get())
  169. }
  170. FORM (NEW1_Distributions_to_Transition_adj, U"To Transition", nullptr) {
  171. NATURAL (environment, U"Environment", U"1")
  172. BOOLEAN (greedy, U"Greedy", true)
  173. OK
  174. DO
  175. CONVERT_TWO (Distributions, Transition)
  176. autoTransition result = Distributions_to_Transition (me, nullptr, environment, you, greedy);
  177. CONVERT_TWO_END (my name.get())
  178. }
  179. FORM (NEW1_Distributions_to_Transition_noise, U"To Transition (noise)", nullptr) {
  180. NATURAL (environment, U"Environment", U"1")
  181. BOOLEAN (greedy, U"Greedy", true)
  182. OK
  183. DO
  184. CONVERT_COUPLE (Distributions)
  185. autoTransition result = Distributions_to_Transition (me, you, environment, nullptr, greedy);
  186. CONVERT_COUPLE_END (my name.get())
  187. }
  188. FORM (NEW1_Distributions_to_Transition_noise_adj, U"To Transition (noise)", nullptr) {
  189. NATURAL (environment, U"Environment", U"1")
  190. BOOLEAN (greedy, U"Greedy", true)
  191. OK
  192. DO
  193. CONVERT_COUPLE_AND_ONE (Distributions, Transition)
  194. autoTransition result = Distributions_to_Transition (me, you, environment, him, greedy);
  195. CONVERT_COUPLE_AND_ONE_END (my name.get())
  196. }
  197. // MARK: - DISTRIBUTIONS & TRANSITION
  198. DIRECT (NEW1_Distributions_Transition_map) {
  199. CONVERT_TWO (Distributions, Transition)
  200. autoDistributions result = Distributions_Transition_map (me, you);
  201. CONVERT_TWO_END (U"surface")
  202. }
  203. // MARK: - EXCITATION
  204. // MARK: Help
  205. DIRECT (HELP_Excitation_help) {
  206. HELP (U"Excitation")
  207. }
  208. // MARK: Draw
  209. FORM (GRAPHICS_Excitation_draw, U"Draw Excitation", nullptr) {
  210. REAL (fromFrequency, U"From frequency (Bark)", U"0.0")
  211. REAL (toFrequency, U"To frequency (Bark)", U"25.6")
  212. REAL (minimum, U"Minimum (phon)", U"0.0")
  213. REAL (maximum, U"Maximum (phon)", U"100.0")
  214. BOOLEAN (garnish, U"Garnish", true)
  215. OK
  216. DO
  217. GRAPHICS_EACH (Excitation)
  218. Excitation_draw (me, GRAPHICS, fromFrequency, toFrequency, minimum, maximum, garnish);
  219. GRAPHICS_EACH_END
  220. }
  221. // MARK: Query
  222. DIRECT (REAL_Excitation_getLoudness) {
  223. NUMBER_ONE (Excitation)
  224. double result = Excitation_getLoudness (me);
  225. NUMBER_ONE_END (U" sones")
  226. }
  227. // MARK: Modify
  228. FORM (MODIFY_Excitation_formula, U"Excitation Formula", U"Excitation: Formula...") {
  229. LABEL (U"`x` is the place in Bark, `col` is the bin number")
  230. LABEL (U"x := 0; for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
  231. TEXTFIELD (formula, U"Formula:", U"self")
  232. OK
  233. DO
  234. MODIFY_EACH_WEAK (Excitation)
  235. Matrix_formula (me, formula, interpreter, nullptr);
  236. MODIFY_EACH_WEAK_END
  237. }
  238. // MARK: Convert
  239. FORM (NEW_Excitation_to_Formant, U"From Excitation to Formant", 0) {
  240. NATURAL (maximumNumberOfFormants, U"Maximum number of formants", U"20")
  241. OK
  242. DO
  243. CONVERT_EACH (Excitation)
  244. autoFormant result = Excitation_to_Formant (me, maximumNumberOfFormants);
  245. CONVERT_EACH_END (my name.get())
  246. }
  247. DIRECT (NEW_Excitation_to_Matrix) {
  248. CONVERT_EACH (Excitation)
  249. autoMatrix result = Excitation_to_Matrix (me);
  250. CONVERT_EACH_END (my name.get())
  251. }
  252. // MARK: - FORMANT
  253. // MARK: Help
  254. DIRECT (HELP_Formant_help) {
  255. HELP (U"Formant")
  256. }
  257. // MARK: Draw
  258. FORM (GRAPHICS_Formant_drawSpeckles, U"Draw Formant", U"Formant: Draw speckles...") {
  259. praat_TimeFunction_RANGE (fromTime, toTime)
  260. POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5500.0")
  261. REAL (dynamicRange, U"Dynamic range (dB)", U"30.0")
  262. BOOLEAN (garnish, U"Garnish", 1)
  263. OK
  264. DO
  265. GRAPHICS_EACH (Formant)
  266. Formant_drawSpeckles (me, GRAPHICS, fromTime, toTime, maximumFrequency, dynamicRange, garnish);
  267. GRAPHICS_EACH_END
  268. }
  269. FORM (GRAPHICS_Formant_drawTracks, U"Draw formant tracks", U"Formant: Draw tracks...") {
  270. praat_TimeFunction_RANGE (fromTime, toTime)
  271. POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5500.0")
  272. BOOLEAN (garnish, U"Garnish", 1)
  273. OK
  274. DO
  275. GRAPHICS_EACH (Formant)
  276. Formant_drawTracks (me, GRAPHICS, fromTime, toTime, maximumFrequency, garnish);
  277. GRAPHICS_EACH_END
  278. }
  279. FORM (GRAPHICS_Formant_scatterPlot, U"Formant: Scatter plot", nullptr) {
  280. praat_TimeFunction_RANGE (fromTime, toTime)
  281. NATURAL (horizontalFormantNumber, U"Horizontal formant number", U"2")
  282. REAL (left, U"left Horizontal range (Hz)", U"3000.0")
  283. REAL (right, U"right Horizontal range (Hz)", U"400.0")
  284. NATURAL (verticalFormantNumber, U"Vertical formant number", U"1")
  285. REAL (bottom, U"left Vertical range (Hz)", U"1500.0")
  286. REAL (top, U"right Vertical range (Hz)", U"100.0")
  287. POSITIVE (markSize, U"Mark size (mm)", U"1.0")
  288. BOOLEAN (garnish, U"Garnish", true)
  289. SENTENCE (markString, U"Mark string (+xo.)", U"+")
  290. OK
  291. DO
  292. GRAPHICS_EACH (Formant)
  293. Formant_scatterPlot (me, GRAPHICS, fromTime, toTime,
  294. horizontalFormantNumber, left, right, verticalFormantNumber, bottom, top,
  295. markSize, markString, garnish);
  296. GRAPHICS_EACH_END
  297. }
  298. // MARK: Tabulate
  299. FORM (LIST_Formant_list, U"Formant: List", nullptr) {
  300. BOOLEAN (includeFrameNumber, U"Include frame number", false)
  301. BOOLEAN (includeTime, U"Include time", true)
  302. NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
  303. BOOLEAN (includeIntensity, U"Include intensity", false)
  304. NATURAL (numberOfIntensityDecimals, U"Number of intensity decimals", U"3")
  305. BOOLEAN (includeNumberOfFormants, U"Include number of formants", true)
  306. NATURAL (numberOfFrequencyDecimals, U"Number of frequency decimals", U"3")
  307. BOOLEAN (includeBandwidths, U"Include bandwidths", true)
  308. OK
  309. DO
  310. INFO_ONE (Formant)
  311. Formant_list (me, includeFrameNumber, includeTime, numberOfTimeDecimals,
  312. includeIntensity, numberOfIntensityDecimals, includeNumberOfFormants, numberOfFrequencyDecimals,
  313. includeBandwidths);
  314. INFO_ONE_END
  315. }
  316. FORM (NEW_Formant_downto_Table, U"Formant: Down to Table", nullptr) {
  317. BOOLEAN (includeFrameNumber, U"Include frame number", false)
  318. BOOLEAN (includeTime, U"Include time", true)
  319. NATURAL (numberOfTimeDecimals, U"Number of time decimals", U"6")
  320. BOOLEAN (includeIntensity, U"Include intensity", false)
  321. NATURAL (numberOfIntensityDecimals, U"Number of intensity decimals", U"3")
  322. BOOLEAN (includeNumberOfFormants, U"Include number of formants", true)
  323. NATURAL (numberOfFrequencyDecimals, U"Number of frequency decimals", U"3")
  324. BOOLEAN (includeBandwidths, U"Include bandwidths", true)
  325. OK
  326. DO
  327. CONVERT_EACH (Formant)
  328. autoTable result = Formant_downto_Table (me, includeFrameNumber, includeTime, numberOfTimeDecimals,
  329. includeIntensity, numberOfIntensityDecimals, includeNumberOfFormants, numberOfFrequencyDecimals,
  330. includeBandwidths);
  331. CONVERT_EACH_END (my name.get())
  332. }
  333. // MARK: Query
  334. FORM (REAL_Formant_getValueAtTime, U"Formant: Get value", U"Formant: Get value at time...") {
  335. NATURAL (formantNumber, U"Formant number", U"1")
  336. REAL (time, U"Time (s)", U"0.5")
  337. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  338. RADIO (interpolation, U"Interpolation", 1) // ignored
  339. RADIOBUTTON (U"Linear")
  340. OK
  341. DO
  342. NUMBER_ONE (Formant)
  343. double result = Formant_getValueAtTime (me, formantNumber, time, unit);
  344. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  345. }
  346. FORM (REAL_Formant_getBandwidthAtTime, U"Formant: Get bandwidth", U"Formant: Get bandwidth at time...") {
  347. NATURAL (formantNumber, U"Formant number", U"1")
  348. REAL (time, U"Time (s)", U"0.5")
  349. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  350. RADIO (interpolation, U"Interpolation", 1) // ignored
  351. RADIOBUTTON (U"Linear")
  352. OK
  353. DO
  354. NUMBER_ONE (Formant)
  355. double result = Formant_getBandwidthAtTime (me, formantNumber, time, unit);
  356. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  357. }
  358. FORM (REAL_Formant_getMinimum, U"Formant: Get minimum", U"Formant: Get minimum...") {
  359. NATURAL (formantNumber, U"Formant number", U"1")
  360. praat_TimeFunction_RANGE (fromTime, toTime)
  361. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  362. RADIOx (interpolation, U"Interpolation", 2, 0)
  363. RADIOBUTTON (U"None")
  364. RADIOBUTTON (U"Parabolic")
  365. OK
  366. DO
  367. NUMBER_ONE (Formant)
  368. double result = Formant_getMinimum (me, formantNumber, fromTime, toTime, unit, interpolation);
  369. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  370. }
  371. FORM (REAL_Formant_getMaximum, U"Formant: Get maximum", U"Formant: Get maximum...") {
  372. NATURAL (formantNumber, U"Formant number", U"1")
  373. praat_TimeFunction_RANGE (fromTime, toTime)
  374. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  375. RADIOx (interpolation, U"Interpolation", 2, 0)
  376. RADIOBUTTON (U"None")
  377. RADIOBUTTON (U"Parabolic")
  378. OK
  379. DO
  380. NUMBER_ONE (Formant)
  381. double result = Formant_getMaximum (me, formantNumber, fromTime, toTime, unit, interpolation);
  382. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  383. }
  384. FORM (REAL_Formant_getTimeOfMinimum, U"Formant: Get time of minimum", U"Formant: Get time of minimum...") {
  385. NATURAL (formantNumber, U"Formant number", U"1")
  386. praat_TimeFunction_RANGE (fromTime, toTime)
  387. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  388. RADIOx (interpolation, U"Interpolation", 2, 0)
  389. RADIOBUTTON (U"None")
  390. RADIOBUTTON (U"Parabolic")
  391. OK
  392. DO
  393. NUMBER_ONE (Formant)
  394. double result = Formant_getTimeOfMinimum (me, formantNumber, fromTime, toTime, unit, interpolation);
  395. NUMBER_ONE_END (U" seconds")
  396. }
  397. FORM (REAL_Formant_getTimeOfMaximum, U"Formant: Get time of maximum", U"Formant: Get time of maximum...") {
  398. NATURAL (formantNumber, U"Formant number", U"1")
  399. praat_TimeFunction_RANGE (fromTime, toTime)
  400. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  401. RADIOx (interpolation, U"Interpolation", 2, 0)
  402. RADIOBUTTON (U"None")
  403. RADIOBUTTON (U"Parabolic")
  404. OK
  405. DO
  406. NUMBER_ONE (Formant)
  407. double result = Formant_getTimeOfMaximum (me, formantNumber, fromTime, toTime, unit, interpolation);
  408. NUMBER_ONE_END (U" seconds")
  409. }
  410. DIRECT (INTEGER_Formant_getMaximumNumberOfFormants) {
  411. NUMBER_ONE (Formant)
  412. integer result = Formant_getMaxNumFormants (me);
  413. NUMBER_ONE_END (U" (there are at most this many formants in every frame)")
  414. }
  415. FORM (REAL_Formant_getMean, U"Formant: Get mean", U"Formant: Get mean...") {
  416. NATURAL (formantNumber, U"Formant number", U"1")
  417. praat_TimeFunction_RANGE (fromTime, toTime)
  418. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  419. OK
  420. DO
  421. NUMBER_ONE (Formant)
  422. double result = Formant_getMean (me, formantNumber, fromTime, toTime, unit);
  423. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  424. }
  425. DIRECT (INTEGER_Formant_getMinimumNumberOfFormants) {
  426. NUMBER_ONE (Formant)
  427. integer result = Formant_getMinNumFormants (me);
  428. NUMBER_ONE_END (U" (there are at least this many formants in every frame)");
  429. }
  430. FORM (INTEGER_Formant_getNumberOfFormants, U"Formant: Get number of formants", U"Formant: Get number of formants...") {
  431. NATURAL (frameNumber, U"Frame number", U"1")
  432. OK
  433. DO
  434. NUMBER_ONE (Formant)
  435. if (frameNumber > my nx)
  436. Melder_throw (U"There is no frame ", frameNumber, U" in a Formant with only ", my nx, U" frames.");
  437. integer result = my d_frames [frameNumber]. nFormants;
  438. NUMBER_ONE_END (U" formants")
  439. }
  440. FORM (REAL_Formant_getQuantile, U"Formant: Get quantile", nullptr) {
  441. NATURAL (formantNumber, U"Formant number", U"1")
  442. praat_TimeFunction_RANGE (fromTime, toTime)
  443. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  444. REAL (quantile, U"Quantile", U"0.50 (= median)")
  445. OK
  446. DO
  447. NUMBER_ONE (Formant)
  448. double result = Formant_getQuantile (me, formantNumber, quantile, fromTime, toTime, unit);
  449. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  450. }
  451. FORM (REAL_Formant_getQuantileOfBandwidth, U"Formant: Get quantile of bandwidth", nullptr) {
  452. NATURAL (formantNumber, U"Formant number", U"1")
  453. praat_TimeFunction_RANGE (fromTime, toTime)
  454. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  455. REAL (quantile, U"Quantile", U"0.50 (= median)")
  456. OK
  457. DO
  458. NUMBER_ONE (Formant)
  459. double result = Formant_getQuantileOfBandwidth (me, formantNumber, quantile, fromTime, toTime, unit);
  460. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  461. }
  462. FORM (REAL_Formant_getStandardDeviation, U"Formant: Get standard deviation", nullptr) {
  463. NATURAL (formantNumber, U"Formant number", U"1")
  464. praat_TimeFunction_RANGE (fromTime, toTime)
  465. RADIO_ENUM (kFormant_unit, unit, U"Unit", kFormant_unit::HERTZ)
  466. OK
  467. DO
  468. NUMBER_ONE (Formant)
  469. double result = Formant_getStandardDeviation (me, formantNumber, fromTime, toTime, unit);
  470. NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
  471. }
  472. // MARK: Modify
  473. DIRECT (MODIFY_Formant_sort) {
  474. MODIFY_EACH (Formant)
  475. Formant_sort (me);
  476. MODIFY_EACH_END
  477. }
  478. FORM (MODIFY_Formant_formula_frequencies, U"Formant: Formula (frequencies)", U"Formant: Formula (frequencies)...") {
  479. LABEL (U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
  480. TEXTFIELD (formula, U"Formula:", U"if row = 2 then self + 200 else self fi")
  481. OK
  482. DO
  483. MODIFY_EACH_WEAK (Formant)
  484. Formant_formula_frequencies (me, formula, interpreter);
  485. MODIFY_EACH_WEAK_END
  486. }
  487. FORM (MODIFY_Formant_formula_bandwidths, U"Formant: Formula (bandwidths)", U"Formant: Formula (bandwidths)...") {
  488. LABEL (U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
  489. TEXTFIELD (formula, U"Formula:", U"self / 2 ; sharpen all peaks")
  490. OK
  491. DO
  492. MODIFY_EACH_WEAK (Formant)
  493. Formant_formula_bandwidths (me, formula, interpreter);
  494. MODIFY_EACH_WEAK_END
  495. }
  496. // MARK: Convert
  497. FORM (NEW_Formant_tracker, U"Formant tracker", U"Formant: Track...") {
  498. NATURAL (numberOfTracks, U"Number of tracks (1-5)", U"3")
  499. REAL (referenceF1, U"Reference F1 (Hz)", U"550")
  500. REAL (referenceF2, U"Reference F2 (Hz)", U"1650")
  501. REAL (referenceF3, U"Reference F3 (Hz)", U"2750")
  502. REAL (referenceF4, U"Reference F4 (Hz)", U"3850")
  503. REAL (referenceF5, U"Reference F5 (Hz)", U"4950")
  504. REAL (frequencyCost, U"Frequency cost (/kHz)", U"1.0")
  505. REAL (bandwidthCost, U"Bandwidth cost", U"1.0")
  506. REAL (transitionCost, U"Transition cost (/octave)", U"1.0")
  507. OK
  508. DO
  509. if (numberOfTracks > 5) Melder_throw (U"Your number of tracks should not be more than 5.");
  510. CONVERT_EACH (Formant)
  511. autoFormant result = Formant_tracker (me, numberOfTracks,
  512. referenceF1, referenceF2, referenceF3, referenceF4, referenceF5,
  513. frequencyCost, bandwidthCost, transitionCost);
  514. CONVERT_EACH_END (my name.get())
  515. }
  516. DIRECT (NEW_Formant_downto_FormantGrid) {
  517. CONVERT_EACH (Formant)
  518. autoFormantGrid result = Formant_downto_FormantGrid (me);
  519. CONVERT_EACH_END (my name.get())
  520. }
  521. DIRECT (NEW_Formant_downto_FormantTier) {
  522. CONVERT_EACH (Formant)
  523. autoFormantTier result = Formant_downto_FormantTier (me);
  524. CONVERT_EACH_END (my name.get())
  525. }
  526. FORM (NEW_Formant_to_Matrix, U"From Formant to Matrix", nullptr) {
  527. INTEGER (formantNumber, U"Formant number", U"1")
  528. OK
  529. DO
  530. CONVERT_EACH (Formant)
  531. autoMatrix result = Formant_to_Matrix (me, formantNumber);
  532. CONVERT_EACH_END (my name.get())
  533. }
  534. // MARK: - FORMANT & POINTPROCESS
  535. DIRECT (NEW1_Formant_PointProcess_to_FormantTier) {
  536. CONVERT_TWO (Formant, PointProcess)
  537. autoFormantTier result = Formant_PointProcess_to_FormantTier (me, you);
  538. CONVERT_TWO_END (my name.get(), U"_", your name.get())
  539. }
  540. // MARK: - FORMANT & SOUND
  541. DIRECT (NEW1_Sound_Formant_filter) {
  542. CONVERT_TWO (Sound, Formant)
  543. autoSound result = Sound_Formant_filter (me, you);
  544. CONVERT_TWO_END (my name.get(), U"_filt")
  545. }
  546. DIRECT (NEW1_Sound_Formant_filter_noscale) {
  547. CONVERT_TWO (Sound, Formant)
  548. autoSound result = Sound_Formant_filter_noscale (me, you);
  549. CONVERT_TWO_END (my name.get(), U"_filt")
  550. }
  551. // MARK: - HARMONICITY
  552. // MARK: Help
  553. DIRECT (HELP_Harmonicity_help) {
  554. HELP (U"Harmonicity")
  555. }
  556. // MARK: Draw
  557. FORM (GRAPHICS_Harmonicity_draw, U"Draw harmonicity", nullptr) {
  558. praat_TimeFunction_RANGE (fromTime, toTime)
  559. REAL (minimum, U"Minimum", U"0.0")
  560. REAL (maximum, U"Maximum", U"0.0 (= auto)")
  561. OK
  562. DO
  563. LOOP {
  564. iam (Harmonicity);
  565. autoPraatPicture picture;
  566. Matrix_drawRows (me, GRAPHICS, fromTime, toTime, 0.0, 0.0, minimum, maximum);
  567. }
  568. END }
  569. // MARK: Query
  570. FORM (REAL_Harmonicity_getMaximum, U"Harmonicity: Get maximum", U"Harmonicity: Get maximum...") {
  571. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  572. OK
  573. DO
  574. NUMBER_ONE (Harmonicity)
  575. double result = Vector_getMaximum (me, fromTime, toTime, interpolation);
  576. NUMBER_ONE_END (U" dB")
  577. }
  578. FORM (REAL_Harmonicity_getMean, U"Harmonicity: Get mean", U"Harmonicity: Get mean...") {
  579. praat_TimeFunction_RANGE (fromTime, toTime)
  580. OK
  581. DO
  582. NUMBER_ONE (Harmonicity)
  583. double result = Harmonicity_getMean (me, fromTime, toTime);
  584. NUMBER_ONE_END (U" dB")
  585. }
  586. FORM (REAL_Harmonicity_getMinimum, U"Harmonicity: Get minimum", U"Harmonicity: Get minimum...") {
  587. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  588. OK
  589. DO
  590. NUMBER_ONE (Harmonicity)
  591. double result = Vector_getMinimum (me, fromTime, toTime, interpolation);
  592. NUMBER_ONE_END (U" dB")
  593. }
  594. FORM (REAL_Harmonicity_getStandardDeviation, U"Harmonicity: Get standard deviation", U"Harmonicity: Get standard deviation...") {
  595. praat_TimeFunction_RANGE (fromTime, toTime)
  596. OK
  597. DO
  598. NUMBER_ONE (Harmonicity)
  599. double result = Harmonicity_getStandardDeviation (me, fromTime, toTime);
  600. NUMBER_ONE_END (U" dB")
  601. }
  602. FORM (REAL_Harmonicity_getTimeOfMaximum, U"Harmonicity: Get time of maximum", U"Harmonicity: Get time of maximum...") {
  603. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  604. OK
  605. DO
  606. NUMBER_ONE (Harmonicity)
  607. double result = Vector_getXOfMaximum (me, fromTime, toTime, interpolation);
  608. NUMBER_ONE_END (U" seconds")
  609. }
  610. FORM (REAL_Harmonicity_getTimeOfMinimum, U"Harmonicity: Get time of minimum", U"Harmonicity: Get time of minimum...") {
  611. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  612. OK
  613. DO
  614. NUMBER_ONE (Harmonicity)
  615. double result = Vector_getXOfMinimum (me, fromTime, toTime, interpolation);
  616. NUMBER_ONE_END (U" seconds")
  617. }
  618. FORM (REAL_Harmonicity_getValueAtTime, U"Harmonicity: Get value", U"Harmonicity: Get value at time...") {
  619. praat_TimeVector_INTERPOLATED_VALUE (time, interpolation)
  620. OK
  621. DO
  622. NUMBER_ONE (Harmonicity)
  623. double result = Vector_getValueAtX (me, time, 1, interpolation);
  624. NUMBER_ONE_END (U" dB")
  625. }
  626. FORM (REAL_Harmonicity_getValueInFrame, U"Get value in frame", U"Harmonicity: Get value in frame...") {
  627. INTEGER (frameNumber, U"Frame number", U"10")
  628. OK
  629. DO
  630. NUMBER_ONE (Harmonicity)
  631. double result = ( frameNumber < 1 || frameNumber > my nx ? undefined : my z [1] [frameNumber] );
  632. NUMBER_ONE_END (U" dB")
  633. }
  634. // MARK: Modify
  635. FORM (MODIFY_Harmonicity_formula, U"Harmonicity Formula", U"Harmonicity: Formula...") {
  636. LABEL (U"`x` is time")
  637. LABEL (U"for col := 1 to ncol do { self [col] := `formula` ; x := x + dx }")
  638. TEXTFIELD (formula, U"Formula:", U"self")
  639. OK
  640. DO
  641. MODIFY_EACH_WEAK (Harmonicity)
  642. Matrix_formula (me, formula, interpreter, nullptr);
  643. MODIFY_EACH_WEAK_END
  644. }
  645. // MARK: Convert
  646. DIRECT (NEW_Harmonicity_to_Matrix) {
  647. CONVERT_EACH (Harmonicity)
  648. autoMatrix result = Harmonicity_to_Matrix (me);
  649. CONVERT_EACH_END (my name.get())
  650. }
  651. // MARK: - INTENSITY
  652. // MARK: Help
  653. DIRECT (HELP_Intensity_help) {
  654. HELP (U"Intensity")
  655. }
  656. // MARK: Draw
  657. FORM (GRAPHICS_Intensity_draw, U"Draw Intensity", nullptr) {
  658. praat_TimeFunction_RANGE (fromTime, toTime)
  659. REAL (minimum, U"Minimum (dB)", U"0.0")
  660. REAL (maximum, U"Maximum (dB)", U"0.0 (= auto)")
  661. BOOLEAN (garnish, U"Garnish", true)
  662. OK
  663. DO
  664. GRAPHICS_EACH (Intensity)
  665. Intensity_draw (me, GRAPHICS, fromTime, toTime, minimum, maximum, garnish);
  666. GRAPHICS_EACH_END
  667. }
  668. // MARK: Query
  669. FORM (REAL_Intensity_getValueAtTime, U"Intensity: Get value", U"Intensity: Get value at time...") {
  670. praat_TimeVector_INTERPOLATED_VALUE (time, interpolation)
  671. OK
  672. DO
  673. NUMBER_ONE (Intensity)
  674. double result = Vector_getValueAtX (me, time, 1, interpolation);
  675. NUMBER_ONE_END (U" dB")
  676. }
  677. FORM (REAL_Intensity_getValueInFrame, U"Get value in frame", U"Intensity: Get value in frame...") {
  678. INTEGER (frameNumber, U"Frame number", U"10")
  679. OK
  680. DO
  681. NUMBER_ONE (Intensity)
  682. double result = ( frameNumber < 1 || frameNumber > my nx ? undefined : my z [1] [frameNumber] );
  683. NUMBER_ONE_END (U" dB")
  684. }
  685. FORM (REAL_Intensity_getMinimum, U"Intensity: Get minimum", U"Intensity: Get minimum...") {
  686. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  687. OK
  688. DO
  689. NUMBER_ONE (Intensity)
  690. double result = Vector_getMinimum (me, fromTime, toTime, interpolation);
  691. NUMBER_ONE_END (U" dB")
  692. }
  693. FORM (REAL_Intensity_getTimeOfMinimum, U"Intensity: Get time of minimum", U"Intensity: Get time of minimum...") {
  694. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  695. OK
  696. DO
  697. NUMBER_ONE (Intensity)
  698. double result = Vector_getXOfMinimum (me, fromTime, toTime, interpolation);
  699. NUMBER_ONE_END (U" seconds")
  700. }
  701. FORM (REAL_Intensity_getMaximum, U"Intensity: Get maximum", U"Intensity: Get maximum...") {
  702. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  703. OK
  704. DO
  705. NUMBER_ONE (Intensity)
  706. double result = Vector_getMaximum (me, fromTime, toTime, interpolation);
  707. NUMBER_ONE_END (U" dB")
  708. }
  709. FORM (REAL_Intensity_getTimeOfMaximum, U"Intensity: Get time of maximum", U"Intensity: Get time of maximum...") {
  710. praat_TimeVector_INTERPOLATED_EXTREMUM (fromTime, toTime, interpolation)
  711. OK
  712. DO
  713. NUMBER_ONE (Intensity)
  714. double result = Vector_getXOfMaximum (me, fromTime, toTime, interpolation);
  715. NUMBER_ONE_END (U" seconds")
  716. }
  717. FORM (REAL_Intensity_getQuantile, U"Intensity: Get quantile", 0) {
  718. praat_TimeFunction_RANGE (fromTime, toTime)
  719. REAL (quantile, U"Quantile (0-1)", U"0.50")
  720. OK
  721. DO
  722. NUMBER_ONE (Intensity)
  723. double result = Intensity_getQuantile (me, fromTime, toTime, quantile);
  724. NUMBER_ONE_END (U" dB")
  725. }
  726. FORM (REAL_old_Intensity_getMean, U"Intensity: Get mean", U"Intensity: Get mean...") {
  727. praat_TimeFunction_RANGE (fromTime, toTime)
  728. OK
  729. DO
  730. NUMBER_ONE (Intensity)
  731. double result = Sampled_getMean_standardUnit (me, fromTime, toTime, 0, 0, true);
  732. NUMBER_ONE_END (U" dB")
  733. }
  734. FORM (REAL_Intensity_getMean, U"Intensity: Get mean", U"Intensity: Get mean...") {
  735. praat_TimeFunction_RANGE (fromTime, toTime)
  736. RADIO (averagingMethod, U"Averaging method", 1)
  737. RADIOBUTTON (U"energy")
  738. RADIOBUTTON (U"sones")
  739. RADIOBUTTON (U"dB")
  740. OK
  741. DO_ALTERNATIVE (REAL_old_Intensity_getMean)
  742. NUMBER_ONE (Intensity)
  743. double result = Sampled_getMean_standardUnit (me, fromTime, toTime, 0, averagingMethod, true);
  744. NUMBER_ONE_END (U" dB")
  745. }
  746. FORM (REAL_Intensity_getStandardDeviation, U"Intensity: Get standard deviation", U"Intensity: Get standard deviation...") {
  747. praat_TimeFunction_RANGE (fromTime, toTime)
  748. OK
  749. DO
  750. NUMBER_ONE (Intensity)
  751. double result = Vector_getStandardDeviation (me, fromTime, toTime, 1);
  752. NUMBER_ONE_END (U" dB")
  753. }
  754. // MARK: Modify
  755. FORM (MODIFY_Intensity_formula, U"Intensity Formula", nullptr) {
  756. LABEL (U"`x` is the time in seconds, `col` is the frame number, `self` is in dB")
  757. LABEL (U"x := x1; for col := 1 to ncol do { self [col] := `formula` ; x := x + dx }")
  758. TEXTFIELD (formula, U"Formula:", U"0")
  759. OK
  760. DO
  761. MODIFY_EACH_WEAK (Intensity)
  762. Matrix_formula (me, formula, interpreter, nullptr);
  763. MODIFY_EACH_WEAK_END
  764. }
  765. // MARK: Analyse
  766. DIRECT (NEW_Intensity_to_IntensityTier_peaks) {
  767. CONVERT_EACH (Intensity)
  768. autoIntensityTier result = Intensity_to_IntensityTier_peaks (me);
  769. CONVERT_EACH_END (my name.get())
  770. }
  771. DIRECT (NEW_Intensity_to_IntensityTier_valleys) {
  772. CONVERT_EACH (Intensity)
  773. autoIntensityTier result = Intensity_to_IntensityTier_valleys (me);
  774. CONVERT_EACH_END (my name.get())
  775. }
  776. // MARK: Convert
  777. DIRECT (NEW_Intensity_downto_IntensityTier) {
  778. CONVERT_EACH (Intensity)
  779. autoIntensityTier result = Intensity_downto_IntensityTier (me);
  780. CONVERT_EACH_END (my name.get())
  781. }
  782. DIRECT (NEW_Intensity_downto_Matrix) {
  783. CONVERT_EACH (Intensity)
  784. autoMatrix result = Intensity_to_Matrix (me);
  785. CONVERT_EACH_END (my name.get())
  786. }
  787. // MARK: - INTENSITY & PITCH
  788. FORM (GRAPHICS_Pitch_Intensity_draw, U"Plot intensity by pitch", nullptr) {
  789. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  790. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= auto)")
  791. REAL (fromIntensity, U"From intensity (dB)", U"0.0")
  792. REAL (toIntensity, U"To intensity (dB)", U"100.0")
  793. BOOLEAN (garnish, U"Garnish", true)
  794. RADIO (drawingMethod, U"Drawing method", 1)
  795. RADIOBUTTON (U"Speckles")
  796. RADIOBUTTON (U"Curve")
  797. RADIOBUTTON (U"Speckles and curve")
  798. OK
  799. DO
  800. GRAPHICS_TWO (Pitch, Intensity)
  801. Pitch_Intensity_draw (me, you, GRAPHICS,
  802. fromFrequency, toFrequency, fromIntensity, toIntensity, garnish, drawingMethod);
  803. GRAPHICS_TWO_END
  804. }
  805. DIRECT (REAL_Pitch_Intensity_getMean) {
  806. NUMBER_TWO (Pitch, Intensity)
  807. double result = Pitch_Intensity_getMean (me, you);
  808. NUMBER_TWO_END (U" dB")
  809. }
  810. DIRECT (REAL_Pitch_Intensity_getMeanAbsoluteSlope) {
  811. NUMBER_TWO (Pitch, Intensity)
  812. double result = Pitch_Intensity_getMeanAbsoluteSlope (me, you);
  813. NUMBER_TWO_END (U" dB/second")
  814. }
  815. // MARK: - INTENSITY & POINTPROCESS
  816. DIRECT (NEW1_Intensity_PointProcess_to_IntensityTier) {
  817. CONVERT_TWO (Intensity, PointProcess)
  818. autoIntensityTier result = Intensity_PointProcess_to_IntensityTier (me, you);
  819. CONVERT_TWO_END (my name.get())
  820. }
  821. // MARK: - INTERVALTIER, the remainder is in praat_TextGrid_init.cpp
  822. FORM_READ (READ1_IntervalTier_readFromXwaves, U"Read IntervalTier from Xwaves", 0, true) {
  823. READ_ONE
  824. autoIntervalTier result = IntervalTier_readFromXwaves (file);
  825. READ_ONE_END
  826. }
  827. // MARK: - LTAS
  828. DIRECT (NEW1_Ltases_average) {
  829. CONVERT_TYPED_LIST (Ltas, LtasBag)
  830. autoLtas result = Ltases_average (list.get());
  831. CONVERT_TYPED_LIST_END (U"averaged")
  832. }
  833. FORM (NEW_Ltas_computeTrendLine, U"Ltas: Compute trend line", U"Ltas: Compute trend line...") {
  834. REAL (fromFrequency, U"left Frequency range (Hz)", U"600.0")
  835. POSITIVE (toFrequency, U"right Frequency range (Hz)", U"4000.0")
  836. OK
  837. DO
  838. CONVERT_EACH (Ltas)
  839. autoLtas result = Ltas_computeTrendLine (me, fromFrequency, toFrequency);
  840. CONVERT_EACH_END (my name.get(), U"_trend")
  841. }
  842. FORM (GRAPHICS_old_Ltas_draw, U"Ltas: Draw", nullptr) {
  843. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  844. REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
  845. REAL (fromPower, U"left Power range (dB/Hz)", U"-20.0")
  846. REAL (toPower, U"right Power range (dB/Hz)", U"80.0")
  847. BOOLEAN (garnish, U"Garnish", true)
  848. OK
  849. DO
  850. GRAPHICS_EACH (Ltas)
  851. Ltas_draw (me, GRAPHICS, fromFrequency, toFrequency, fromPower, toPower, garnish, U"Bars");
  852. GRAPHICS_EACH_END
  853. }
  854. FORM (GRAPHICS_Ltas_draw, U"Ltas: Draw", nullptr) {
  855. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  856. REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
  857. REAL (fromPower, U"left Power range (dB/Hz)", U"-20.0")
  858. REAL (toPower, U"right Power range (dB/Hz)", U"80.0")
  859. BOOLEAN (garnish, U"Garnish", true)
  860. LABEL (U"")
  861. OPTIONMENUSTR (drawingMethod, U"Drawing method", 2)
  862. OPTION (U"Curve")
  863. OPTION (U"Bars")
  864. OPTION (U"Poles")
  865. OPTION (U"Speckles")
  866. OK
  867. DO_ALTERNATIVE (GRAPHICS_old_Ltas_draw)
  868. GRAPHICS_EACH (Ltas)
  869. Ltas_draw (me, GRAPHICS, fromFrequency, toFrequency, fromPower, toPower, garnish, drawingMethod);
  870. GRAPHICS_EACH_END
  871. }
  872. FORM (MODIFY_Ltas_formula, U"Ltas Formula", nullptr) {
  873. LABEL (U"`x` is the frequency in hertz, `col` is the bin number")
  874. LABEL (U"x := x1; for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
  875. TEXTFIELD (formula, U"Formula:", U"0")
  876. OK
  877. DO
  878. MODIFY_EACH_WEAK (Ltas)
  879. Matrix_formula (me, formula, interpreter, nullptr);
  880. MODIFY_EACH_WEAK_END
  881. }
  882. DIRECT (REAL_Ltas_getLowestFrequency) {
  883. NUMBER_ONE (Ltas)
  884. double result = my xmin;
  885. NUMBER_ONE_END (U" hertz")
  886. }
  887. DIRECT (REAL_Ltas_getHighestFrequency) {
  888. NUMBER_ONE (Ltas)
  889. double result = my xmax;
  890. NUMBER_ONE_END (U" hertz")
  891. }
  892. DIRECT (REAL_Ltas_getBinWidth) {
  893. NUMBER_ONE (Ltas)
  894. double result = my dx;
  895. NUMBER_ONE_END (U" hertz")
  896. }
  897. FORM (REAL_Ltas_getFrequencyFromBinNumber, U"Ltas: Get frequency from bin number", U"Ltas: Get frequency from bin number...") {
  898. NATURAL (binNumber, U"Bin number", U"1")
  899. OK
  900. DO
  901. NUMBER_ONE (Ltas)
  902. double result = Sampled_indexToX (me, binNumber);
  903. NUMBER_ONE_END (U" hertz")
  904. }
  905. FORM (REAL_Ltas_getBinNumberFromFrequency, U"Ltas: Get band from frequency", U"Ltas: Get band from frequency...") {
  906. REAL (frequency, U"Frequency (Hz)", U"2000.0")
  907. OK
  908. DO
  909. NUMBER_ONE (Ltas)
  910. double result = Sampled_xToIndex (me, frequency);
  911. NUMBER_ONE_END (U"")
  912. }
  913. FORM (REAL_Ltas_getFrequencyOfMinimum, U"Ltas: Get frequency of minimum", U"Ltas: Get frequency of minimum...") {
  914. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  915. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
  916. RADIOx (interpolation, U"Interpolation", 1, 0)
  917. RADIOBUTTON (U"None")
  918. RADIOBUTTON (U"Parabolic")
  919. RADIOBUTTON (U"Cubic")
  920. RADIOBUTTON (U"Sinc70")
  921. RADIOBUTTON (U"Sinc700")
  922. OK
  923. DO
  924. NUMBER_ONE (Ltas)
  925. double result = Vector_getXOfMinimum (me, fromFrequency, toFrequency, interpolation);
  926. NUMBER_ONE_END (U" hertz");
  927. }
  928. FORM (REAL_Ltas_getFrequencyOfMaximum, U"Ltas: Get frequency of maximum", U"Ltas: Get frequency of maximum...") {
  929. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  930. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
  931. RADIOx (interpolation, U"Interpolation", 1, 0)
  932. RADIOBUTTON (U"None")
  933. RADIOBUTTON (U"Parabolic")
  934. RADIOBUTTON (U"Cubic")
  935. RADIOBUTTON (U"Sinc70")
  936. RADIOBUTTON (U"Sinc700")
  937. OK
  938. DO
  939. NUMBER_ONE (Ltas)
  940. double result = Vector_getXOfMaximum (me, fromFrequency, toFrequency, interpolation);
  941. NUMBER_ONE_END (U" hertz");
  942. }
  943. FORM (REAL_Ltas_getLocalPeakHeight, U"Ltas: Get local peak height", nullptr) {
  944. REAL (environmentMin, U"left Environment (Hz)", U"1700.0")
  945. REAL (environmentMax, U"right Environment (Hz)", U"4200.0")
  946. REAL (peakMin, U"left Peak (Hz)", U"2400.0")
  947. REAL (peakMax, U"right Peak (Hz)", U"3200.0")
  948. RADIO (averagingMethod, U"Averaging method", 1)
  949. RADIOBUTTON (U"energy")
  950. RADIOBUTTON (U"sones")
  951. RADIOBUTTON (U"dB")
  952. OK
  953. DO
  954. NUMBER_ONE (Ltas)
  955. if (environmentMin >= peakMin)
  956. Melder_throw (U"The beginning of the environment must lie before the peak.");
  957. if (peakMin >= peakMax)
  958. Melder_throw (U"The end of the peak must lie after its beginning.");
  959. if (environmentMax <= peakMax)
  960. Melder_throw (U"The end of the environment must lie after the peak.");
  961. double result = Ltas_getLocalPeakHeight (me, environmentMin, environmentMax, peakMin, peakMax, averagingMethod);
  962. NUMBER_ONE_END (U" dB")
  963. }
  964. FORM (REAL_Ltas_getMaximum, U"Ltas: Get maximum", U"Ltas: Get maximum...") {
  965. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  966. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
  967. RADIOx (interpolation, U"Interpolation", 1, 0)
  968. RADIOBUTTON (U"None")
  969. RADIOBUTTON (U"Parabolic")
  970. RADIOBUTTON (U"Cubic")
  971. RADIOBUTTON (U"Sinc70")
  972. RADIOBUTTON (U"Sinc700")
  973. OK
  974. DO
  975. NUMBER_ONE (Ltas)
  976. double result = Vector_getMaximum (me, fromFrequency, toFrequency, interpolation);
  977. NUMBER_ONE_END (U" dB")
  978. }
  979. FORM (REAL_Ltas_getMean, U"Ltas: Get mean", U"Ltas: Get mean...") {
  980. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  981. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
  982. RADIO (averagingMethod, U"Averaging method", 1)
  983. RADIOBUTTON (U"energy")
  984. RADIOBUTTON (U"sones")
  985. RADIOBUTTON (U"dB")
  986. OK
  987. DO
  988. NUMBER_ONE (Ltas)
  989. double result = Sampled_getMean_standardUnit (me, fromFrequency, toFrequency,
  990. 0, averagingMethod, false);
  991. NUMBER_ONE_END (U" dB")
  992. }
  993. FORM (REAL_Ltas_getMinimum, U"Ltas: Get minimum", U"Ltas: Get minimum...") {
  994. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  995. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
  996. RADIOx (interpolation, U"Interpolation", 1, 0)
  997. RADIOBUTTON (U"None")
  998. RADIOBUTTON (U"Parabolic")
  999. RADIOBUTTON (U"Cubic")
  1000. RADIOBUTTON (U"Sinc70")
  1001. RADIOBUTTON (U"Sinc700")
  1002. OK
  1003. DO
  1004. NUMBER_ONE (Ltas)
  1005. double result = Vector_getMinimum (me, fromFrequency, toFrequency, interpolation);
  1006. NUMBER_ONE_END (U" dB")
  1007. }
  1008. DIRECT (INTEGER_Ltas_getNumberOfBins) {
  1009. NUMBER_ONE (Ltas)
  1010. integer result = my nx;
  1011. NUMBER_ONE_END (U" bins")
  1012. }
  1013. FORM (REAL_Ltas_getSlope, U"Ltas: Get slope", 0) {
  1014. REAL (lowBandFrom, U"left Low band (Hz)", U"0.0")
  1015. REAL (lowBandTo, U"right Low band (Hz)", U"1000.0")
  1016. REAL (highBandFrom, U"left High band (Hz)", U"1000.0")
  1017. REAL (highBandTo, U"right High band (Hz)", U"4000.0")
  1018. RADIO (averagingMethod, U"Averaging method", 1)
  1019. RADIOBUTTON (U"energy")
  1020. RADIOBUTTON (U"sones")
  1021. RADIOBUTTON (U"dB")
  1022. OK
  1023. DO
  1024. NUMBER_ONE (Ltas)
  1025. double result = Ltas_getSlope (me, lowBandFrom, lowBandTo, highBandFrom, highBandTo, averagingMethod);
  1026. NUMBER_ONE_END (U" dB")
  1027. }
  1028. FORM (REAL_Ltas_getStandardDeviation, U"Ltas: Get standard deviation", U"Ltas: Get standard deviation...") {
  1029. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  1030. REAL (toFrequency, U"To frequency (Hz)", U"0.0 (= all)")
  1031. RADIO (averagingMethod, U"Averaging method", 1)
  1032. RADIOBUTTON (U"energy")
  1033. RADIOBUTTON (U"sones")
  1034. RADIOBUTTON (U"dB")
  1035. OK
  1036. DO
  1037. NUMBER_ONE (Ltas)
  1038. double result = Sampled_getStandardDeviation_standardUnit (me, fromFrequency, toFrequency,
  1039. 0, // level (irrelevant)
  1040. averagingMethod,
  1041. false); // interpolate (don't)
  1042. NUMBER_ONE_END (U" dB")
  1043. }
  1044. FORM (REAL_Ltas_getValueAtFrequency, U"Ltas: Get value", U"Ltas: Get value at frequency...") {
  1045. REAL (frequency, U"Frequency (Hz)", U"1500.0")
  1046. RADIOx (interpolation, U"Interpolation", 1, 0)
  1047. RADIOBUTTON (U"Nearest")
  1048. RADIOBUTTON (U"Linear")
  1049. RADIOBUTTON (U"Cubic")
  1050. RADIOBUTTON (U"Sinc70")
  1051. RADIOBUTTON (U"Sinc700")
  1052. OK
  1053. DO
  1054. NUMBER_ONE (Ltas)
  1055. double result = Vector_getValueAtX (me, frequency,
  1056. 1, // level
  1057. interpolation);
  1058. NUMBER_ONE_END (U" dB")
  1059. }
  1060. FORM (REAL_Ltas_getValueInBin, U"Get value in bin", U"Ltas: Get value in bin...") {
  1061. INTEGER (binNumber, U"Bin number", U"100")
  1062. OK
  1063. DO
  1064. NUMBER_ONE (Ltas)
  1065. double result = binNumber < 1 || binNumber > my nx ? undefined : my z [1] [binNumber];
  1066. NUMBER_ONE_END (U" dB")
  1067. }
  1068. DIRECT (HELP_Ltas_help) {
  1069. HELP (U"Ltas")
  1070. }
  1071. DIRECT (NEW1_Ltases_merge) {
  1072. CONVERT_TYPED_LIST (Ltas, LtasBag)
  1073. autoLtas result = Ltases_merge (list.get());
  1074. CONVERT_TYPED_LIST_END (U"merged")
  1075. }
  1076. FORM (NEW_Ltas_subtractTrendLine, U"Ltas: Subtract trend line", U"Ltas: Subtract trend line...") {
  1077. REAL (fromFrequency, U"left Frequency range (Hz)", U"600.0")
  1078. POSITIVE (toFrequency, U"right Frequency range (Hz)", U"4000.0")
  1079. OK
  1080. DO
  1081. CONVERT_EACH (Ltas)
  1082. autoLtas result = Ltas_subtractTrendLine (me, fromFrequency, toFrequency);
  1083. CONVERT_EACH_END (my name.get(), U"_fit")
  1084. }
  1085. DIRECT (NEW_Ltas_to_Matrix) {
  1086. CONVERT_EACH (Ltas)
  1087. autoMatrix result = Ltas_to_Matrix (me);
  1088. CONVERT_EACH_END (my name.get())
  1089. }
  1090. DIRECT (NEW_Ltas_to_SpectrumTier_peaks) {
  1091. CONVERT_EACH (Ltas)
  1092. autoSpectrumTier result = Ltas_to_SpectrumTier_peaks (me);
  1093. CONVERT_EACH_END (my name.get())
  1094. }
  1095. // MARK: - MANIPULATION
  1096. static void cb_ManipulationEditor_publication (Editor /* editor */, autoDaata publication) {
  1097. try {
  1098. praat_new (publication.move(), U"fromManipulationEditor");
  1099. praat_updateSelection ();
  1100. } catch (MelderError) {
  1101. Melder_flushError ();
  1102. }
  1103. }
  1104. DIRECT (WINDOW_Manipulation_viewAndEdit) {
  1105. if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Manipulation from batch.");
  1106. FIND_ONE_WITH_IOBJECT (Manipulation)
  1107. autoManipulationEditor editor = ManipulationEditor_create (ID_AND_FULL_NAME, me);
  1108. Editor_setPublicationCallback (editor.get(), cb_ManipulationEditor_publication);
  1109. praat_installEditor (editor.get(), IOBJECT);
  1110. editor.releaseToUser();
  1111. END
  1112. }
  1113. DIRECT (NEW_Manipulation_extractDurationTier) {
  1114. CONVERT_EACH (Manipulation)
  1115. if (! my duration) Melder_throw (me, U": I don't contain a DurationTier.");
  1116. autoDurationTier result = Data_copy (my duration.get());
  1117. CONVERT_EACH_END (my name.get())
  1118. }
  1119. DIRECT (NEW_Manipulation_extractOriginalSound) {
  1120. CONVERT_EACH (Manipulation)
  1121. if (! my sound) Melder_throw (me, U": I don't contain a Sound.");
  1122. autoSound result = Data_copy (my sound.get());
  1123. CONVERT_EACH_END (my name.get())
  1124. }
  1125. DIRECT (NEW_Manipulation_extractPitchTier) {
  1126. CONVERT_EACH (Manipulation)
  1127. if (! my pitch) Melder_throw (me, U": I don't contain a PitchTier.");
  1128. autoPitchTier result = Data_copy (my pitch.get());
  1129. CONVERT_EACH_END (my name.get())
  1130. }
  1131. DIRECT (NEW_Manipulation_extractPulses) {
  1132. CONVERT_EACH (Manipulation)
  1133. if (! my pulses) Melder_throw (me, U": I don't contain a PointProcess.");
  1134. autoPointProcess result = Data_copy (my pulses.get());
  1135. CONVERT_EACH_END (my name.get())
  1136. }
  1137. DIRECT (NEW_Manipulation_getResynthesis_lpc) {
  1138. CONVERT_EACH (Manipulation)
  1139. autoSound result = Manipulation_to_Sound (me, Manipulation_PITCH_LPC);
  1140. CONVERT_EACH_END (my name.get())
  1141. }
  1142. DIRECT (NEW_Manipulation_getResynthesis_overlapAdd) {
  1143. CONVERT_EACH (Manipulation)
  1144. autoSound result = Manipulation_to_Sound (me, Manipulation_OVERLAPADD);
  1145. CONVERT_EACH_END (my name.get())
  1146. }
  1147. DIRECT (HELP_Manipulation_help) {
  1148. HELP (U"Manipulation")
  1149. }
  1150. DIRECT (PLAY_Manipulation_play_lpc) {
  1151. PLAY_EACH (Manipulation)
  1152. Manipulation_play (me, Manipulation_PITCH_LPC);
  1153. PLAY_EACH_END
  1154. }
  1155. DIRECT (PLAY_Manipulation_play_overlapAdd) {
  1156. PLAY_EACH (Manipulation)
  1157. Manipulation_play (me, Manipulation_OVERLAPADD);
  1158. PLAY_EACH_END
  1159. }
  1160. DIRECT (MODIFY_Manipulation_removeDuration) {
  1161. MODIFY_EACH (Manipulation)
  1162. my duration = autoDurationTier();
  1163. MODIFY_EACH_END
  1164. }
  1165. DIRECT (MODIFY_Manipulation_removeOriginalSound) {
  1166. MODIFY_EACH (Manipulation)
  1167. my sound = autoSound();
  1168. MODIFY_EACH_END
  1169. }
  1170. FORM_SAVE (SAVE_Manipulation_writeToBinaryFileWithoutSound, U"Binary file without Sound", nullptr, nullptr) {
  1171. SAVE_ONE (Manipulation)
  1172. Manipulation_writeToBinaryFileWithoutSound (me, file);
  1173. SAVE_ONE_END
  1174. }
  1175. FORM_SAVE (SAVE_Manipulation_writeToTextFileWithoutSound, U"Text file without Sound", nullptr, nullptr) {
  1176. SAVE_ONE (Manipulation)
  1177. Manipulation_writeToTextFileWithoutSound (me, file);
  1178. SAVE_ONE_END
  1179. }
  1180. // MARK: - MANIPULATION & DURATIONTIER
  1181. DIRECT (MODIFY_Manipulation_replaceDurationTier) {
  1182. MODIFY_FIRST_OF_TWO (Manipulation, DurationTier)
  1183. Manipulation_replaceDurationTier (me, you);
  1184. MODIFY_FIRST_OF_TWO_END
  1185. }
  1186. DIRECT (HELP_Manipulation_replaceDurationTier_help) {
  1187. HELP (U"Manipulation: Replace duration tier")
  1188. }
  1189. // MARK: - MANIPULATION & PITCHTIER
  1190. DIRECT (MODIFY_Manipulation_replacePitchTier) {
  1191. MODIFY_FIRST_OF_TWO (Manipulation, PitchTier)
  1192. Manipulation_replacePitchTier (me, you);
  1193. MODIFY_FIRST_OF_TWO_END
  1194. }
  1195. DIRECT (HELP_Manipulation_replacePitchTier_help) {
  1196. HELP (U"Manipulation: Replace pitch tier")
  1197. }
  1198. // MARK: - MANIPULATION & POINTPROCESS
  1199. DIRECT (MODIFY_Manipulation_replacePulses) {
  1200. MODIFY_FIRST_OF_TWO (Manipulation, PointProcess)
  1201. Manipulation_replacePulses (me, you);
  1202. MODIFY_FIRST_OF_TWO_END
  1203. }
  1204. // MARK: - MANIPULATION & SOUND
  1205. DIRECT (MODIFY_Manipulation_replaceOriginalSound) {
  1206. MODIFY_FIRST_OF_TWO (Manipulation, Sound)
  1207. Manipulation_replaceOriginalSound (me, you);
  1208. MODIFY_FIRST_OF_TWO_END
  1209. }
  1210. // MARK: - MANIPULATION & TEXTTIER
  1211. DIRECT (NEW1_Manipulation_TextTier_to_Manipulation) {
  1212. CONVERT_TWO (Manipulation, TextTier)
  1213. autoManipulation result = Manipulation_AnyTier_to_Manipulation (me, reinterpret_cast <AnyTier> (you));
  1214. CONVERT_TWO_END (my name.get())
  1215. }
  1216. // MARK: - PARAMCURVE
  1217. FORM (GRAPHICS_ParamCurve_draw, U"Draw parametrized curve", nullptr) {
  1218. REAL (tmin, U"Tmin", U"0.0")
  1219. REAL (tmax, U"Tmax", U"0.0")
  1220. REAL (step, U"Step", U"0.0")
  1221. REAL (xmin, U"Xmin", U"0.0")
  1222. REAL (xmax, U"Xmax", U"0.0")
  1223. REAL (ymin, U"Ymin", U"0.0")
  1224. REAL (ymax, U"Ymax", U"0.0")
  1225. BOOLEAN (garnish, U"Garnish", true)
  1226. OK
  1227. DO
  1228. GRAPHICS_EACH (ParamCurve)
  1229. ParamCurve_draw (me, GRAPHICS, tmin, tmax, step, xmin, xmax, ymin, ymax, garnish);
  1230. GRAPHICS_EACH_END
  1231. }
  1232. DIRECT (HELP_ParamCurve_help) {
  1233. HELP (U"ParamCurve")
  1234. }
  1235. // MARK: - PITCH
  1236. DIRECT (INTEGER_Pitch_getNumberOfVoicedFrames) {
  1237. NUMBER_ONE (Pitch)
  1238. integer result = Pitch_countVoicedFrames (me);
  1239. NUMBER_ONE_END (U" voiced frames")
  1240. }
  1241. DIRECT (INFO_Pitch_difference) {
  1242. INFO_COUPLE (Pitch)
  1243. Pitch_difference (me, you);
  1244. INFO_COUPLE_END
  1245. }
  1246. FORM (GRAPHICS_Pitch_draw, U"Pitch: Draw", U"Pitch: Draw...") {
  1247. praat_TimeFunction_RANGE (fromTime, toTime)
  1248. REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0")
  1249. POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
  1250. BOOLEAN (garnish, U"Garnish", true)
  1251. OK
  1252. DO
  1253. if (toFrequency <= fromFrequency) Melder_throw (U"Maximum frequency must be greater than minimum frequency.");
  1254. GRAPHICS_EACH (Pitch)
  1255. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1256. garnish, Pitch_speckle_NO, kPitch_unit::HERTZ);
  1257. GRAPHICS_EACH_END
  1258. }
  1259. FORM (GRAPHICS_Pitch_drawErb, U"Pitch: Draw erb", U"Pitch: Draw...") {
  1260. praat_TimeFunction_RANGE (fromTime, toTime)
  1261. REAL (fromFrequency, U"left Frequency range (ERB)", U"0")
  1262. REAL (toFrequency, U"right Frequency range (ERB)", U"10.0")
  1263. BOOLEAN (garnish, U"Garnish", true)
  1264. OK
  1265. DO
  1266. GRAPHICS_EACH (Pitch)
  1267. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1268. garnish, Pitch_speckle_NO, kPitch_unit::ERB);
  1269. GRAPHICS_EACH_END
  1270. }
  1271. FORM (GRAPHICS_Pitch_drawLogarithmic, U"Pitch: Draw logarithmic", U"Pitch: Draw...") {
  1272. praat_TimeFunction_RANGE (fromTime, toTime)
  1273. POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0")
  1274. POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
  1275. BOOLEAN (garnish, U"Garnish", true)
  1276. OK
  1277. DO
  1278. if (toFrequency <= fromFrequency) Melder_throw (U"Maximum frequency must be greater than minimum frequency.");
  1279. GRAPHICS_EACH (Pitch)
  1280. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1281. garnish, Pitch_speckle_NO, kPitch_unit::HERTZ_LOGARITHMIC);
  1282. GRAPHICS_EACH_END
  1283. }
  1284. FORM (GRAPHICS_Pitch_drawMel, U"Pitch: Draw mel", U"Pitch: Draw...") {
  1285. praat_TimeFunction_RANGE (fromTime, toTime)
  1286. REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
  1287. REAL (toFrequency, U"right Frequency range (mel)", U"500.0")
  1288. BOOLEAN (garnish, U"Garnish", true)
  1289. OK
  1290. DO
  1291. GRAPHICS_EACH (Pitch)
  1292. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1293. garnish, Pitch_speckle_NO, kPitch_unit::MEL);
  1294. GRAPHICS_EACH_END
  1295. }
  1296. FORM (GRAPHICS_Pitch_drawSemitones100, U"Pitch: Draw semitones (re 100 Hz)", U"Pitch: Draw...") {
  1297. praat_TimeFunction_RANGE (fromTime, toTime)
  1298. LABEL (U"Range in semitones re 100 Hz:")
  1299. REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
  1300. REAL (toFrequency, U"right Frequency range (st)", U"30.0")
  1301. BOOLEAN (garnish, U"Garnish", true)
  1302. OK
  1303. DO
  1304. GRAPHICS_EACH (Pitch)
  1305. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1306. garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_100);
  1307. GRAPHICS_EACH_END
  1308. }
  1309. FORM (GRAPHICS_Pitch_drawSemitones200, U"Pitch: Draw semitones (re 200 Hz)", U"Pitch: Draw...") {
  1310. praat_TimeFunction_RANGE (fromTime, toTime)
  1311. LABEL (U"Range in semitones re 200 Hz:")
  1312. REAL (fromFrequency, U"left Frequency range (st)", U"-24.0")
  1313. REAL (toFrequency, U"right Frequency range (st)", U"18.0")
  1314. BOOLEAN (garnish, U"Garnish", true)
  1315. OK
  1316. DO
  1317. GRAPHICS_EACH (Pitch)
  1318. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1319. garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_200);
  1320. GRAPHICS_EACH_END
  1321. }
  1322. FORM (GRAPHICS_Pitch_drawSemitones440, U"Pitch: Draw semitones (re 440 Hz)", U"Pitch: Draw...") {
  1323. praat_TimeFunction_RANGE (fromTime, toTime)
  1324. LABEL (U"Range in semitones re 440 Hz:")
  1325. REAL (fromFrequency, U"left Frequency range (st)", U"-36.0")
  1326. REAL (toFrequency, U"right Frequency range (st)", U"6.0")
  1327. BOOLEAN (garnish, U"Garnish", true)
  1328. OK
  1329. DO
  1330. GRAPHICS_EACH (Pitch)
  1331. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1332. garnish, Pitch_speckle_NO, kPitch_unit::SEMITONES_440);
  1333. GRAPHICS_EACH_END
  1334. }
  1335. DIRECT (WINDOW_Pitch_viewAndEdit) {
  1336. if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Pitch from batch.");
  1337. FIND_ONE_WITH_IOBJECT (Pitch)
  1338. autoPitchEditor editor = PitchEditor_create (ID_AND_FULL_NAME, me);
  1339. praat_installEditor (editor.get(), IOBJECT);
  1340. editor.releaseToUser();
  1341. END
  1342. }
  1343. FORM (MODIFY_Pitch_formula, U"Pitch: Formula", U"Formula...") {
  1344. LABEL (U"`x` is time; `col` is frame number; `row` = candidate (1 = current path); frequency (time, candidate) :=")
  1345. TEXTFIELD (formula, U"Formula:", U"self*2 ; example: octave jump up")
  1346. OK
  1347. DO
  1348. MODIFY_EACH_WEAK (Pitch)
  1349. Pitch_formula (me, formula, interpreter);
  1350. MODIFY_EACH_WEAK_END
  1351. }
  1352. FORM (REAL_Pitch_getMinimum, U"Pitch: Get minimum", 0) {
  1353. praat_TimeFunction_RANGE (fromTime, toTime)
  1354. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1355. RADIOx (interpolation, U"Interpolation", 2, 0)
  1356. RADIOBUTTON (U"None")
  1357. RADIOBUTTON (U"Parabolic")
  1358. OK
  1359. DO
  1360. NUMBER_ONE (Pitch)
  1361. double result = Pitch_getMinimum (me, fromTime, toTime, unit, interpolation);
  1362. result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
  1363. NUMBER_ONE_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
  1364. }
  1365. FORM (REAL_Pitch_getMaximum, U"Pitch: Get maximum", nullptr) {
  1366. praat_TimeFunction_RANGE (fromTime, toTime)
  1367. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1368. RADIOx (interpolation, U"Interpolation", 2, 0)
  1369. RADIOBUTTON (U"None")
  1370. RADIOBUTTON (U"Parabolic")
  1371. OK
  1372. DO
  1373. NUMBER_ONE (Pitch)
  1374. double result = Pitch_getMaximum (me, fromTime, toTime, unit, interpolation);
  1375. result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
  1376. NUMBER_ONE_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
  1377. }
  1378. FORM (REAL_Pitch_getMean, U"Pitch: Get mean", nullptr) {
  1379. praat_TimeFunction_RANGE (fromTime, toTime)
  1380. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1381. OK
  1382. DO
  1383. NUMBER_ONE (Pitch)
  1384. double result = Pitch_getMean (me, fromTime, toTime, unit);
  1385. result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
  1386. NUMBER_ONE_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0));
  1387. }
  1388. FORM (REAL_Pitch_getMeanAbsoluteSlope, U"Pitch: Get mean absolute slope", 0) {
  1389. RADIO (unit, U"Unit", 1)
  1390. RADIOBUTTON (U"Hertz")
  1391. RADIOBUTTON (U"Mel")
  1392. RADIOBUTTON (U"Semitones")
  1393. RADIOBUTTON (U"ERB")
  1394. OK
  1395. DO
  1396. FIND_ONE (Pitch)
  1397. double slope;
  1398. integer nVoiced = (unit == 1 ? Pitch_getMeanAbsSlope_hertz : unit == 2 ? Pitch_getMeanAbsSlope_mel : unit == 3 ? Pitch_getMeanAbsSlope_semitones : Pitch_getMeanAbsSlope_erb)
  1399. (me, & slope);
  1400. if (nVoiced < 2) {
  1401. Melder_information (U"--undefined--");
  1402. } else {
  1403. Melder_information (slope, U" ",
  1404. (unit == 1 ? U"Hz" : unit == 2 ? U"mel" : unit == 3 ? U"semitones" : U"ERB"),
  1405. U"/s");
  1406. }
  1407. END
  1408. }
  1409. DIRECT (REAL_Pitch_getMeanAbsSlope_noOctave) {
  1410. NUMBER_ONE (Pitch)
  1411. double result;
  1412. (void) Pitch_getMeanAbsSlope_noOctave (me, & result);
  1413. NUMBER_ONE_END (U" semitones/s")
  1414. }
  1415. FORM (REAL_Pitch_getQuantile, U"Pitch: Get quantile", nullptr) {
  1416. praat_TimeFunction_RANGE (fromTime, toTime)
  1417. REAL (quantile, U"Quantile", U"0.50 (= median)")
  1418. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1419. OK
  1420. DO
  1421. NUMBER_ONE (Pitch)
  1422. double result = Sampled_getQuantile (me, fromTime, toTime, quantile, Pitch_LEVEL_FREQUENCY, (int) unit);
  1423. result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
  1424. NUMBER_ONE_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
  1425. }
  1426. FORM (REAL_Pitch_getStandardDeviation, U"Pitch: Get standard deviation", nullptr) {
  1427. praat_TimeFunction_RANGE (fromTime, toTime)
  1428. OPTIONMENU (unit_i, U"Unit", 1)
  1429. OPTION (U"Hertz")
  1430. OPTION (U"mel")
  1431. OPTION (U"logHertz")
  1432. OPTION (U"semitones")
  1433. OPTION (U"ERB")
  1434. OK
  1435. DO
  1436. kPitch_unit unit =
  1437. unit_i == 1 ? kPitch_unit::HERTZ :
  1438. unit_i == 2 ? kPitch_unit::MEL :
  1439. unit_i == 3 ? kPitch_unit::LOG_HERTZ :
  1440. unit_i == 4 ? kPitch_unit::SEMITONES_1 :
  1441. kPitch_unit::ERB;
  1442. NUMBER_ONE (Pitch)
  1443. double result = Pitch_getStandardDeviation (me, fromTime, toTime, unit);
  1444. conststring32 unitText =
  1445. unit == kPitch_unit::HERTZ ? U"Hz" :
  1446. unit == kPitch_unit::MEL ? U"mel" :
  1447. unit == kPitch_unit::LOG_HERTZ ? U"logHz" :
  1448. unit == kPitch_unit::SEMITONES_1 ? U"semitones" :
  1449. U"ERB";
  1450. NUMBER_ONE_END (U" ", unitText)
  1451. }
  1452. FORM (REAL_Pitch_getTimeOfMaximum, U"Pitch: Get time of maximum", nullptr) {
  1453. praat_TimeFunction_RANGE (fromTime, toTime)
  1454. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1455. RADIOx (interpolation, U"Interpolation", 2, 0)
  1456. RADIOBUTTON (U"None")
  1457. RADIOBUTTON (U"Parabolic")
  1458. OK
  1459. DO
  1460. NUMBER_ONE (Pitch)
  1461. double result = Pitch_getTimeOfMaximum (me, fromTime, toTime, unit, interpolation);
  1462. NUMBER_ONE_END (U" seconds")
  1463. }
  1464. FORM (REAL_Pitch_getTimeOfMinimum, U"Pitch: Get time of minimum", nullptr) {
  1465. praat_TimeFunction_RANGE (fromTime, toTime)
  1466. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1467. RADIOx (interpolation, U"Interpolation", 2, 0)
  1468. RADIOBUTTON (U"None")
  1469. RADIOBUTTON (U"Parabolic")
  1470. OK
  1471. DO
  1472. NUMBER_ONE (Pitch)
  1473. double result = Pitch_getTimeOfMinimum (me, fromTime, toTime, unit, interpolation);
  1474. NUMBER_ONE_END (U" seconds")
  1475. }
  1476. FORM (REAL_Pitch_getValueAtTime, U"Pitch: Get value at time", U"Pitch: Get value at time...") {
  1477. REAL (time, U"Time (s)", U"0.5")
  1478. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1479. RADIOx (interpolation, U"Interpolation", 2, 0)
  1480. RADIOBUTTON (U"Nearest")
  1481. RADIOBUTTON (U"Linear")
  1482. OK
  1483. DO
  1484. NUMBER_ONE (Pitch)
  1485. double result = Sampled_getValueAtX (me, time, Pitch_LEVEL_FREQUENCY, (int) unit, interpolation);
  1486. result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
  1487. NUMBER_ONE_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0))
  1488. }
  1489. FORM (REAL_Pitch_getValueInFrame, U"Pitch: Get value in frame", U"Pitch: Get value in frame...") {
  1490. INTEGER (frameNumber, U"Frame number", U"10")
  1491. OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
  1492. OK
  1493. DO
  1494. NUMBER_ONE (Pitch)
  1495. double result = Sampled_getValueAtSample (me, frameNumber, Pitch_LEVEL_FREQUENCY, (int) unit);
  1496. result = Function_convertToNonlogarithmic (me, result, Pitch_LEVEL_FREQUENCY, (int) unit);
  1497. NUMBER_ONE_END (U" ", Function_getUnitText (me, Pitch_LEVEL_FREQUENCY, (int) unit, 0));
  1498. }
  1499. DIRECT (HELP_Pitch_help) {
  1500. HELP (U"Pitch")
  1501. }
  1502. DIRECT (PLAY_Pitch_hum) {
  1503. PLAY_EACH (Pitch)
  1504. Pitch_hum (me, 0.0, 0.0);
  1505. PLAY_EACH_END
  1506. }
  1507. DIRECT (NEW_Pitch_interpolate) {
  1508. CONVERT_EACH (Pitch)
  1509. autoPitch result = Pitch_interpolate (me);
  1510. CONVERT_EACH_END (my name.get())
  1511. }
  1512. DIRECT (NEW_Pitch_killOctaveJumps) {
  1513. CONVERT_EACH (Pitch)
  1514. autoPitch result = Pitch_killOctaveJumps (me);
  1515. CONVERT_EACH_END (my name.get())
  1516. }
  1517. DIRECT (PLAY_Pitch_play) {
  1518. PLAY_EACH (Pitch)
  1519. Pitch_play (me, 0.0, 0.0);
  1520. PLAY_EACH_END
  1521. }
  1522. FORM (NEW_Pitch_smooth, U"Pitch: Smooth", U"Pitch: Smooth...") {
  1523. REAL (bandwidth, U"Bandwidth (Hz)", U"10.0")
  1524. OK
  1525. DO
  1526. CONVERT_EACH (Pitch)
  1527. autoPitch result = Pitch_smooth (me, bandwidth);
  1528. CONVERT_EACH_END (my name.get())
  1529. }
  1530. FORM (GRAPHICS_Pitch_speckle, U"Pitch: Speckle", U"Pitch: Draw...") {
  1531. praat_TimeFunction_RANGE (fromTime, toTime)
  1532. REAL (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"0.0")
  1533. POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
  1534. BOOLEAN (garnish, U"Garnish", true)
  1535. OK
  1536. DO
  1537. if (toFrequency <= fromFrequency) Melder_throw (U"Maximum frequency should be greater than minimum frequency.");
  1538. GRAPHICS_EACH (Pitch)
  1539. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ);
  1540. GRAPHICS_EACH_END
  1541. }
  1542. FORM (GRAPHICS_Pitch_speckleErb, U"Pitch: Speckle erb", U"Pitch: Draw...") {
  1543. praat_TimeFunction_RANGE (fromTime, toTime)
  1544. REAL (fromFrequency, U"left Frequency range (ERB)", U"0.0")
  1545. REAL (toFrequency, U"right Frequency range (ERB)", U"10.0")
  1546. BOOLEAN (garnish, U"Garnish", true)
  1547. OK
  1548. DO
  1549. GRAPHICS_EACH (Pitch)
  1550. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::ERB);
  1551. GRAPHICS_EACH_END
  1552. }
  1553. FORM (GRAPHICS_Pitch_speckleLogarithmic, U"Pitch: Speckle logarithmic", U"Pitch: Draw...") {
  1554. praat_TimeFunction_RANGE (fromTime, toTime)
  1555. POSITIVE (fromFrequency, STRING_FROM_FREQUENCY_HZ, U"50.0")
  1556. POSITIVE (toFrequency, STRING_TO_FREQUENCY_HZ, U"500.0")
  1557. BOOLEAN (garnish, U"Garnish", true)
  1558. OK
  1559. DO
  1560. if (toFrequency <= fromFrequency) Melder_throw (U"Maximum frequency must be greater than minimum frequency.");
  1561. GRAPHICS_EACH (Pitch)
  1562. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::HERTZ_LOGARITHMIC);
  1563. GRAPHICS_EACH_END
  1564. }
  1565. FORM (GRAPHICS_Pitch_speckleMel, U"Pitch: Speckle mel", U"Pitch: Draw...") {
  1566. praat_TimeFunction_RANGE (fromTime, toTime)
  1567. REAL (fromFrequency, U"left Frequency range (mel)", U"0.0")
  1568. REAL (toFrequency, U"right Frequency range (mel)", U"500.0")
  1569. BOOLEAN (garnish, U"Garnish", true)
  1570. OK
  1571. DO
  1572. GRAPHICS_EACH (Pitch)
  1573. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::MEL);
  1574. GRAPHICS_EACH_END
  1575. }
  1576. FORM (GRAPHICS_Pitch_speckleSemitones100, U"Pitch: Speckle semitones (re 100 Hz)", U"Pitch: Draw...") {
  1577. praat_TimeFunction_RANGE (fromTime, toTime)
  1578. LABEL (U"Range in semitones re 100 hertz:")
  1579. REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
  1580. REAL (toFrequency, U"right Frequency range (st)", U"30.0")
  1581. BOOLEAN (garnish, U"Garnish", true)
  1582. OK
  1583. DO
  1584. GRAPHICS_EACH (Pitch)
  1585. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_100);
  1586. GRAPHICS_EACH_END
  1587. }
  1588. FORM (GRAPHICS_Pitch_speckleSemitones200, U"Pitch: Speckle semitones (re 200 Hz)", U"Pitch: Draw...") {
  1589. praat_TimeFunction_RANGE (fromTime, toTime)
  1590. LABEL (U"Range in semitones re 200 hertz:")
  1591. REAL (fromFrequency, U"left Frequency range (st)", U"-24.0")
  1592. REAL (toFrequency, U"right Frequency range (st)", U"18.0")
  1593. BOOLEAN (garnish, U"Garnish", true)
  1594. OK
  1595. DO
  1596. GRAPHICS_EACH (Pitch)
  1597. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_200);
  1598. GRAPHICS_EACH_END
  1599. }
  1600. FORM (GRAPHICS_Pitch_speckleSemitones440, U"Pitch: Speckle semitones (re 440 Hz)", U"Pitch: Draw...") {
  1601. praat_TimeFunction_RANGE (fromTime, toTime)
  1602. LABEL (U"Range in semitones re 440 hertz:")
  1603. REAL (fromFrequency, U"left Frequency range (st)", U"-36.0")
  1604. REAL (toFrequency, U"right Frequency range (st)", U"6.0")
  1605. BOOLEAN (garnish, U"Garnish", true)
  1606. OK
  1607. DO
  1608. GRAPHICS_EACH (Pitch)
  1609. Pitch_draw (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency, garnish, Pitch_speckle_YES, kPitch_unit::SEMITONES_440);
  1610. GRAPHICS_EACH_END
  1611. }
  1612. FORM (NEW_Pitch_subtractLinearFit, U"Pitch: subtract linear fit", nullptr) {
  1613. OPTIONMENU (unit_i, U"Unit", 1)
  1614. OPTION (U"Hertz")
  1615. OPTION (U"mel")
  1616. OPTION (U"logHertz")
  1617. OPTION (U"semitones")
  1618. OPTION (U"ERB")
  1619. OK
  1620. DO
  1621. kPitch_unit unit =
  1622. unit_i == 1 ? kPitch_unit::HERTZ :
  1623. unit_i == 2 ? kPitch_unit::MEL :
  1624. unit_i == 3 ? kPitch_unit::LOG_HERTZ :
  1625. unit_i == 4 ? kPitch_unit::SEMITONES_1 :
  1626. kPitch_unit::ERB;
  1627. CONVERT_EACH (Pitch)
  1628. autoPitch result = Pitch_subtractLinearFit (me, unit);
  1629. CONVERT_EACH_END (my name.get())
  1630. }
  1631. DIRECT (NEW_Pitch_to_IntervalTier) {
  1632. CONVERT_EACH (Pitch)
  1633. autoIntervalTier result = IntervalTier_create (my xmin, my xmax);
  1634. CONVERT_EACH_END (my name.get())
  1635. }
  1636. DIRECT (NEW_Pitch_to_Matrix) {
  1637. CONVERT_EACH (Pitch)
  1638. autoMatrix result = Pitch_to_Matrix (me);
  1639. CONVERT_EACH_END (my name.get())
  1640. }
  1641. DIRECT (NEW_Pitch_downto_PitchTier) {
  1642. CONVERT_EACH (Pitch)
  1643. autoPitchTier result = Pitch_to_PitchTier (me);
  1644. CONVERT_EACH_END (my name.get())
  1645. }
  1646. DIRECT (NEW_Pitch_to_PointProcess) {
  1647. CONVERT_EACH (Pitch)
  1648. autoPointProcess result = Pitch_to_PointProcess (me);
  1649. CONVERT_EACH_END (my name.get())
  1650. }
  1651. DIRECT (NEW_Pitch_to_Sound_pulses) {
  1652. CONVERT_EACH (Pitch)
  1653. autoSound result = Pitch_to_Sound (me, 0.0, 0.0, false);
  1654. CONVERT_EACH_END (my name.get())
  1655. }
  1656. DIRECT (NEW_Pitch_to_Sound_hum) {
  1657. CONVERT_EACH (Pitch)
  1658. autoSound result = Pitch_to_Sound (me, 0.0, 0.0, true);
  1659. CONVERT_EACH_END (my name.get())
  1660. }
  1661. FORM (NEW_Pitch_to_Sound_sine, U"Pitch: To Sound (sine)", nullptr) {
  1662. POSITIVE (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
  1663. RADIOx (cutVoicelessStretches, U"Cut voiceless stretches", 2, 0)
  1664. OPTION (U"exactly")
  1665. OPTION (U"at nearest zero crossings")
  1666. OK
  1667. DO
  1668. CONVERT_EACH (Pitch)
  1669. autoSound result = Pitch_to_Sound_sine (me, 0.0, 0.0, samplingFrequency, cutVoicelessStretches);
  1670. CONVERT_EACH_END (my name.get())
  1671. }
  1672. FORM (NEW_Pitch_to_TextGrid, U"To TextGrid...", U"Pitch: To TextGrid...") {
  1673. SENTENCE (tierNames, U"Tier names", U"Mary John bell")
  1674. SENTENCE (pointTiers, U"Point tiers", U"bell")
  1675. OK
  1676. DO
  1677. CONVERT_EACH (Pitch)
  1678. autoTextGrid result = TextGrid_create (my xmin, my xmax, tierNames, pointTiers);
  1679. CONVERT_EACH_END (my name.get())
  1680. }
  1681. DIRECT (NEW_Pitch_to_TextTier) {
  1682. CONVERT_EACH (Pitch)
  1683. autoTextTier result = TextTier_create (my xmin, my xmax);
  1684. CONVERT_EACH_END (my name.get())
  1685. }
  1686. // MARK: - PITCH & PITCHTIER
  1687. FORM (GRAPHICS_old_PitchTier_Pitch_draw, U"PitchTier & Pitch: Draw", nullptr) {
  1688. praat_TimeFunction_RANGE (fromTime, toTime)
  1689. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  1690. REAL (toFrequency, U"To frequency (Hz)", U"500.0")
  1691. RADIOx (lineTypeForNonperiodicIntervals, U"Line type for non-periodic intervals", 2, 0)
  1692. RADIOBUTTON (U"Normal")
  1693. RADIOBUTTON (U"Dotted")
  1694. RADIOBUTTON (U"Blank")
  1695. BOOLEAN (garnish, U"Garnish", true)
  1696. OK
  1697. DO
  1698. GRAPHICS_TWO (PitchTier, Pitch)
  1699. PitchTier_Pitch_draw (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1700. lineTypeForNonperiodicIntervals, garnish, U"lines and speckles");
  1701. GRAPHICS_TWO_END
  1702. }
  1703. FORM (GRAPHICS_PitchTier_Pitch_draw, U"PitchTier & Pitch: Draw", nullptr) {
  1704. praat_TimeFunction_RANGE (fromTime, toTime)
  1705. REAL (fromFrequency, U"From frequency (Hz)", U"0.0")
  1706. REAL (toFrequency, U"To frequency (Hz)", U"500.0")
  1707. RADIOx (lineTypeForNonperiodicIntervals, U"Line type for non-periodic intervals", 2, 0)
  1708. RADIOBUTTON (U"Normal")
  1709. RADIOBUTTON (U"Dotted")
  1710. RADIOBUTTON (U"Blank")
  1711. BOOLEAN (garnish, U"Garnish", true)
  1712. LABEL (U"")
  1713. OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
  1714. OPTION (U"lines")
  1715. OPTION (U"speckles")
  1716. OPTION (U"lines and speckles")
  1717. OK
  1718. DO_ALTERNATIVE (GRAPHICS_old_PitchTier_Pitch_draw)
  1719. GRAPHICS_TWO (PitchTier, Pitch)
  1720. PitchTier_Pitch_draw (me, you, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1721. lineTypeForNonperiodicIntervals, garnish, drawingMethod);
  1722. GRAPHICS_TWO_END
  1723. }
  1724. DIRECT (NEW1_Pitch_PitchTier_to_Pitch) {
  1725. CONVERT_TWO (Pitch, PitchTier)
  1726. autoPitch result = Pitch_PitchTier_to_Pitch (me, you);
  1727. CONVERT_TWO_END (my name.get(), U"_stylized");
  1728. }
  1729. // MARK: - PITCH & POINTPROCESS
  1730. DIRECT (NEW1_Pitch_PointProcess_to_PitchTier) {
  1731. CONVERT_TWO (Pitch, PointProcess)
  1732. autoPitchTier result = Pitch_PointProcess_to_PitchTier (me, you);
  1733. CONVERT_TWO_END (my name.get());
  1734. }
  1735. // MARK: - PITCH & SOUND
  1736. DIRECT (NEW1_Sound_Pitch_to_Manipulation) {
  1737. CONVERT_TWO (Sound, Pitch)
  1738. autoManipulation result = Sound_Pitch_to_Manipulation (me, you);
  1739. CONVERT_TWO_END (your name.get());
  1740. }
  1741. DIRECT (NEW1_Sound_Pitch_to_PointProcess_cc) {
  1742. CONVERT_TWO (Sound, Pitch)
  1743. autoPointProcess result = Sound_Pitch_to_PointProcess_cc (me, you);
  1744. CONVERT_TWO_END (my name.get(), U"_", your name.get());
  1745. }
  1746. FORM (NEW1_Sound_Pitch_to_PointProcess_peaks, U"Sound & Pitch: To PointProcess (peaks)", 0) {
  1747. BOOLEAN (includeMaxima, U"Include maxima", true)
  1748. BOOLEAN (includeMinima, U"Include minima", false)
  1749. OK
  1750. DO
  1751. CONVERT_TWO (Sound, Pitch)
  1752. autoPointProcess result = Sound_Pitch_to_PointProcess_peaks (me, you, includeMaxima, includeMinima);
  1753. CONVERT_TWO_END (my name.get(), U"_", your name.get())
  1754. }
  1755. // MARK: - POLYGON
  1756. FORM (GRAPHICS_Polygon_draw, U"Polygon: Draw", nullptr) {
  1757. REAL (xmin, U"Xmin", U"0.0")
  1758. REAL (xmax, U"Xmax", U"0.0 (= all)")
  1759. REAL (ymin, U"Ymin", U"0.0")
  1760. REAL (ymax, U"Ymax", U"0.0 (= all)")
  1761. OK
  1762. DO
  1763. GRAPHICS_EACH (Polygon)
  1764. Polygon_draw (me, GRAPHICS, xmin, xmax, ymin, ymax);
  1765. GRAPHICS_EACH_END
  1766. }
  1767. FORM (GRAPHICS_Polygon_drawCircles, U"Polygon: Draw circles", nullptr) {
  1768. REAL (xmin, U"Xmin", U"0.0")
  1769. REAL (xmax, U"Xmax", U"0.0 (= all)")
  1770. REAL (ymin, U"Ymin", U"0.0")
  1771. REAL (ymax, U"Ymax", U"0.0 (= all)")
  1772. POSITIVE (diameter, U"Diameter (mm)", U"3.0")
  1773. OK
  1774. DO
  1775. GRAPHICS_EACH (Polygon)
  1776. Polygon_drawCircles (me, GRAPHICS, xmin, xmax, ymin, ymax, diameter);
  1777. GRAPHICS_EACH_END
  1778. }
  1779. FORM (GRAPHICS_Polygon_drawClosed, U"Polygon: Draw", nullptr) {
  1780. REAL (xmin, U"Xmin", U"0.0")
  1781. REAL (xmax, U"Xmax", U"0.0 (= all)")
  1782. REAL (ymin, U"Ymin", U"0.0")
  1783. REAL (ymax, U"Ymax", U"0.0 (= all)")
  1784. OK
  1785. DO
  1786. GRAPHICS_EACH (Polygon)
  1787. Polygon_drawClosed (me, GRAPHICS, xmin, xmax, ymin, ymax);
  1788. GRAPHICS_EACH_END
  1789. }
  1790. FORM (GRAPHICS_Polygons_drawConnection, U"Polygons: Draw connection", nullptr) {
  1791. REAL (xmin, U"Xmin", U"0.0")
  1792. REAL (xmax, U"Xmax", U"0.0 (= all)")
  1793. REAL (ymin, U"Ymin", U"0.0")
  1794. REAL (ymax, U"Ymax", U"0.0 (= all)")
  1795. BOOLEAN (arrow, U"Arrow", false)
  1796. POSITIVE (relativeLength, U"Relative length", U"0.9")
  1797. OK
  1798. DO
  1799. GRAPHICS_COUPLE (Polygon)
  1800. Polygons_drawConnection (me, you, GRAPHICS, xmin, xmax, ymin, ymax, arrow, relativeLength);
  1801. GRAPHICS_COUPLE_END
  1802. }
  1803. DIRECT (HELP_Polygon_help) {
  1804. HELP (U"Polygon")
  1805. }
  1806. FORM (GRAPHICS_Polygon_paint, U"Polygon: Paint", nullptr) {
  1807. COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
  1808. REAL (xmin, U"Xmin", U"0.0")
  1809. REAL (xmax, U"Xmax", U"0.0 (= all)")
  1810. REAL (ymin, U"Ymin", U"0.0")
  1811. REAL (ymax, U"Ymax", U"0.0 (= all)")
  1812. OK
  1813. DO
  1814. GRAPHICS_EACH (Polygon)
  1815. Polygon_paint (me, GRAPHICS, colour, xmin, xmax, ymin, ymax);
  1816. GRAPHICS_EACH_END
  1817. }
  1818. FORM (GRAPHICS_Polygon_paintCircles, U"Polygon: Paint circles", nullptr) {
  1819. REAL (xmin, U"Xmin", U"0.0")
  1820. REAL (xmax, U"Xmax", U"0.0 (= all)")
  1821. REAL (ymin, U"Ymin", U"0.0")
  1822. REAL (ymax, U"Ymax", U"0.0 (= all)")
  1823. POSITIVE (diameter, U"Diameter (mm)", U"3.0")
  1824. OK
  1825. DO
  1826. GRAPHICS_EACH (Polygon)
  1827. Polygon_paintCircles (me, GRAPHICS, xmin, xmax, ymin, ymax, diameter);
  1828. GRAPHICS_EACH_END
  1829. }
  1830. DIRECT (MODIFY_Polygon_randomize) {
  1831. MODIFY_EACH (Polygon)
  1832. Polygon_randomize (me);
  1833. MODIFY_EACH_END
  1834. }
  1835. FORM (MODIFY_Polygon_salesperson, U"Polygon: Find shortest path", nullptr) {
  1836. NATURAL (numberOfIterations, U"Number of iterations", U"1")
  1837. OK
  1838. DO
  1839. MODIFY_EACH (Polygon)
  1840. Polygon_salesperson (me, numberOfIterations);
  1841. MODIFY_EACH_END
  1842. }
  1843. DIRECT (NEW_Polygon_to_Matrix) {
  1844. CONVERT_EACH (Polygon)
  1845. autoMatrix result = Polygon_to_Matrix (me);
  1846. CONVERT_EACH_END (my name.get())
  1847. }
  1848. // MARK: - SOUND & PITCH & POINTPROCESS
  1849. FORM (INFO_Sound_Pitch_PointProcess_voiceReport, U"Voice report", U"Voice") {
  1850. praat_TimeFunction_RANGE (fromTime, toTime)
  1851. POSITIVE (fromPitch, U"left Pitch range (Hz)", U"75.0")
  1852. POSITIVE (toPitch, U"right Pitch range (Hz)", U"600.0")
  1853. POSITIVE (maximumPeriodFactor, U"Maximum period factor", U"1.3")
  1854. POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", U"1.6")
  1855. REAL (silenceThreshold, U"Silence threshold", U"0.03")
  1856. REAL (voicingThreshold, U"Voicing threshold", U"0.45")
  1857. OK
  1858. DO
  1859. INFO_THREE (Sound, Pitch, PointProcess)
  1860. MelderInfo_open ();
  1861. Sound_Pitch_PointProcess_voiceReport (me, you, him, fromTime, toTime, fromPitch, toPitch,
  1862. maximumPeriodFactor, maximumAmplitudeFactor, silenceThreshold, voicingThreshold);
  1863. MelderInfo_close ();
  1864. INFO_THREE_END
  1865. }
  1866. // MARK: - SOUND & POINTPROCESS & PITCHTIER & DURATIONTIER
  1867. FORM (NEW1_Sound_Point_Pitch_Duration_to_Sound, U"To Sound", nullptr) {
  1868. POSITIVE (longestPeriod, U"Longest period (s)", U"0.02")
  1869. OK
  1870. DO
  1871. CONVERT_FOUR (Sound, PointProcess, PitchTier, DurationTier)
  1872. autoSound result = Sound_Point_Pitch_Duration_to_Sound (me, you, him, she, longestPeriod);
  1873. CONVERT_FOUR_END (U"manip");
  1874. }
  1875. // MARK: - SPECTROGRAM
  1876. FORM (GRAPHICS_Spectrogram_paint, U"Spectrogram: Paint", U"Spectrogram: Paint...") {
  1877. praat_TimeFunction_RANGE (fromTime, toTime)
  1878. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  1879. REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
  1880. REAL (maximum, U"Maximum (dB/Hz)", U"100.0")
  1881. BOOLEAN (autoscaling, U"Autoscaling", 1)
  1882. POSITIVE (dynamicRange, U"Dynamic range (dB)", U"50.0")
  1883. REAL (preEmphasis, U"Pre-emphasis (dB/oct)", U"6.0")
  1884. REAL (dynamicCompression, U"Dynamic compression (0-1)", U"0.0")
  1885. BOOLEAN (garnish, U"Garnish", 1)
  1886. OK
  1887. DO
  1888. GRAPHICS_EACH (Spectrogram)
  1889. Spectrogram_paint (me, GRAPHICS, fromTime, toTime, fromFrequency, toFrequency,
  1890. maximum, autoscaling, dynamicRange, preEmphasis, dynamicCompression, garnish);
  1891. GRAPHICS_EACH_END
  1892. }
  1893. FORM (MODIFY_Spectrogram_formula, U"Spectrogram: Formula", U"Spectrogram: Formula...") {
  1894. LABEL (U"Do for all times and frequencies:")
  1895. LABEL (U" `x` is the time in seconds")
  1896. LABEL (U" `y` is the frequency in hertz")
  1897. LABEL (U" `self` is the current value in Pa\u00B2/Hz")
  1898. TEXTFIELD (formula, U" Replace all values with:", U"self * exp (- x / 0.1)")
  1899. OK
  1900. DO
  1901. MODIFY_EACH_WEAK (Spectrogram)
  1902. Matrix_formula (me, formula, interpreter, nullptr);
  1903. MODIFY_EACH_WEAK_END
  1904. }
  1905. FORM (REAL_Spectrogram_getPowerAt, U"Spectrogram: Get power at (time, frequency)", nullptr) {
  1906. REAL (time, U"Time (s)", U"0.5")
  1907. REAL (frequency, U"Frequency (Hz)", U"1000")
  1908. OK
  1909. DO
  1910. NUMBER_ONE (Spectrogram)
  1911. double result = Matrix_getValueAtXY (me, time, frequency);
  1912. NUMBER_ONE_END (U" Pa2/Hz (at time = ", time, U" seconds and frequency = ", frequency, U" Hz)")
  1913. }
  1914. DIRECT (HELP_Spectrogram_help) {
  1915. HELP (U"Spectrogram")
  1916. }
  1917. DIRECT (MOVIE_Spectrogram_movie) {
  1918. MOVIE_ONE (Spectrogram, U"Spectrogram movie", 300, 300)
  1919. Matrix_movie (me, graphics);
  1920. MOVIE_ONE_END
  1921. }
  1922. DIRECT (NEW_Spectrogram_to_Matrix) {
  1923. CONVERT_EACH (Spectrogram)
  1924. autoMatrix result = Spectrogram_to_Matrix (me);
  1925. CONVERT_EACH_END (my name.get())
  1926. }
  1927. FORM (NEW_Spectrogram_to_Sound, U"Spectrogram: To Sound", nullptr) {
  1928. REAL (samplingFrequency, U"Sampling frequency (Hz)", U"44100.0")
  1929. OK
  1930. DO
  1931. CONVERT_EACH (Spectrogram)
  1932. autoSound result = Spectrogram_to_Sound (me, samplingFrequency);
  1933. CONVERT_EACH_END (my name.get())
  1934. }
  1935. FORM (NEW_Spectrogram_to_Spectrum, U"Spectrogram: To Spectrum (slice)", nullptr) {
  1936. REAL (time, U"Time (seconds)", U"0.0")
  1937. OK
  1938. DO
  1939. CONVERT_EACH (Spectrogram)
  1940. autoSpectrum result = Spectrogram_to_Spectrum (me, time);
  1941. CONVERT_EACH_END (my name.get())
  1942. }
  1943. DIRECT (WINDOW_Spectrogram_view) {
  1944. if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Spectrogram from batch.");
  1945. FIND_ONE_WITH_IOBJECT (Spectrogram)
  1946. autoSpectrogramEditor editor = SpectrogramEditor_create (ID_AND_FULL_NAME, me);
  1947. praat_installEditor (editor.get(), IOBJECT);
  1948. editor.releaseToUser();
  1949. END
  1950. }
  1951. // MARK: - SPECTRUM
  1952. // MARK: - Help
  1953. DIRECT (HELP_Spectrum_help) {
  1954. HELP (U"Spectrum")
  1955. }
  1956. // MARK: View & Edit
  1957. DIRECT (WINDOW_Spectrum_viewAndEdit) {
  1958. if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Spectrum from batch.");
  1959. FIND_ONE_WITH_IOBJECT (Spectrum)
  1960. autoSpectrumEditor editor = SpectrumEditor_create (ID_AND_FULL_NAME, me);
  1961. praat_installEditor (editor.get(), IOBJECT);
  1962. editor.releaseToUser();
  1963. END
  1964. }
  1965. // MARK: Draw
  1966. FORM (GRAPHICS_Spectrum_draw, U"Spectrum: Draw", nullptr) {
  1967. REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
  1968. REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= all)")
  1969. REAL (minimumPower, U"Minimum power (dB/Hz)", U"0 (= auto)")
  1970. REAL (maximumPower, U"Maximum power (dB/Hz)", U"0 (= auto)")
  1971. BOOLEAN (garnish, U"Garnish", true)
  1972. OK
  1973. DO
  1974. GRAPHICS_EACH (Spectrum)
  1975. Spectrum_draw (me, GRAPHICS, fromFrequency, toFrequency, minimumPower, maximumPower, garnish);
  1976. GRAPHICS_EACH_END
  1977. }
  1978. FORM (GRAPHICS_Spectrum_drawLogFreq, U"Spectrum: Draw (log freq)", nullptr) {
  1979. POSITIVE (fromFrequency, U"left Frequency range (Hz)", U"10.0")
  1980. POSITIVE (toFrequency, U"right Frequency range (Hz)", U"10000.0")
  1981. REAL (minimumPower, U"Minimum power (dB/Hz)", U"0 (= auto)")
  1982. REAL (maximumPower, U"Maximum power (dB/Hz)", U"0 (= auto)")
  1983. BOOLEAN (garnish, U"Garnish", true)
  1984. OK
  1985. DO
  1986. GRAPHICS_EACH (Spectrum)
  1987. Spectrum_drawLogFreq (me, GRAPHICS, fromFrequency, toFrequency, minimumPower, maximumPower, garnish);
  1988. GRAPHICS_EACH_END
  1989. }
  1990. // MARK: Tabulate
  1991. FORM (LIST_Spectrum_list, U"Spectrum: List", 0) {
  1992. BOOLEAN (includeBinNumber, U"Include bin number", false)
  1993. BOOLEAN (includeFrequency, U"Include frequency", true)
  1994. BOOLEAN (includeRealPart, U"Include real part", false)
  1995. BOOLEAN (includeImaginaryPart, U"Include imaginary part", false)
  1996. BOOLEAN (includeEnergyDensity, U"Include energy density", false)
  1997. BOOLEAN (includePowerDensity, U"Include power density", true)
  1998. OK
  1999. DO
  2000. INFO_ONE (Spectrum)
  2001. Spectrum_list (me, includeBinNumber, includeFrequency, includeRealPart, includeImaginaryPart,
  2002. includeEnergyDensity, includePowerDensity);
  2003. INFO_ONE_END
  2004. }
  2005. // MARK: Query
  2006. FORM (REAL_Spectrum_getBandDensity, U"Spectrum: Get band density", nullptr) {
  2007. REAL (bandFloor, U"Band floor (Hz)", U"200.0")
  2008. REAL (bandCeiling, U"Band ceiling (Hz)", U"1000.0")
  2009. OK
  2010. DO
  2011. NUMBER_ONE (Spectrum)
  2012. double result = Spectrum_getBandDensity (me, bandFloor, bandCeiling);
  2013. NUMBER_ONE_END (U" Pa2 / Hz2")
  2014. }
  2015. FORM (REAL_Spectrum_getBandDensityDifference, U"Spectrum: Get band density difference", nullptr) {
  2016. REAL (lowBandFloor, U"Low band floor (Hz)", U"0.0")
  2017. REAL (lowBandCeiling, U"Low band ceiling (Hz)", U"500.0")
  2018. REAL (highBandFloor, U"High band floor (Hz)", U"500.0")
  2019. REAL (highBandCeiling, U"High band ceiling (Hz)", U"4000.0")
  2020. OK
  2021. DO
  2022. NUMBER_ONE (Spectrum)
  2023. double result = Spectrum_getBandDensityDifference (me,
  2024. lowBandFloor, lowBandCeiling, highBandFloor, highBandCeiling);
  2025. NUMBER_ONE_END (U" dB")
  2026. }
  2027. FORM (REAL_Spectrum_getBandEnergy, U"Spectrum: Get band energy", nullptr) {
  2028. REAL (bandFloor, U"Band floor (Hz)", U"200.0")
  2029. REAL (bandCeiling, U"Band ceiling (Hz)", U"1000.0")
  2030. OK
  2031. DO
  2032. NUMBER_ONE (Spectrum)
  2033. double result = Spectrum_getBandEnergy (me, bandFloor, bandCeiling);
  2034. NUMBER_ONE_END (U" Pa2 sec")
  2035. }
  2036. FORM (REAL_Spectrum_getBandEnergyDifference, U"Spectrum: Get band energy difference", nullptr) {
  2037. REAL (lowBandFloor, U"Low band floor (Hz)", U"0.0")
  2038. REAL (lowBandCeiling, U"Low band ceiling (Hz)", U"500.0")
  2039. REAL (highBandFloor, U"High band floor (Hz)", U"500.0")
  2040. REAL (highBandCeiling, U"High band ceiling (Hz)", U"4000.0")
  2041. OK
  2042. DO
  2043. NUMBER_ONE (Spectrum)
  2044. double result = Spectrum_getBandEnergyDifference (me,
  2045. lowBandFloor, lowBandCeiling, highBandFloor, highBandCeiling);
  2046. NUMBER_ONE_END (U" dB")
  2047. }
  2048. FORM (REAL_Spectrum_getBinNumberFromFrequency, U"Spectrum: Get bin number from frequency", nullptr) {
  2049. REAL (frequency, U"Frequency (Hz)", U"2000.0")
  2050. OK
  2051. DO
  2052. NUMBER_ONE (Spectrum)
  2053. double result = Sampled_xToIndex (me, frequency);
  2054. NUMBER_ONE_END (U" (bin number as a real value)")
  2055. }
  2056. DIRECT (REAL_Spectrum_getBinWidth) {
  2057. NUMBER_ONE (Spectrum)
  2058. double result = my dx;
  2059. NUMBER_ONE_END (U" hertz")
  2060. }
  2061. FORM (REAL_Spectrum_getCentralMoment, U"Spectrum: Get central moment", U"Spectrum: Get central moment...") {
  2062. POSITIVE (moment, U"Moment", U"3.0")
  2063. POSITIVE (power, U"Power", U"2.0")
  2064. OK
  2065. DO
  2066. NUMBER_ONE (Spectrum)
  2067. double result = Spectrum_getCentralMoment (me, moment, power);
  2068. NUMBER_ONE_END (U" hertz to the power ", moment)
  2069. }
  2070. FORM (REAL_Spectrum_getCentreOfGravity, U"Spectrum: Get centre of gravity", U"Spectrum: Get centre of gravity...") {
  2071. POSITIVE (power, U"Power", U"2.0")
  2072. OK
  2073. DO
  2074. NUMBER_ONE (Spectrum)
  2075. double result = Spectrum_getCentreOfGravity (me, power);
  2076. NUMBER_ONE_END (U" hertz")
  2077. }
  2078. FORM (REAL_Spectrum_getFrequencyFromBin, U"Spectrum: Get frequency from bin", nullptr) {
  2079. NATURAL (bandNumber, U"Band number", U"1")
  2080. OK
  2081. DO
  2082. NUMBER_ONE (Spectrum)
  2083. double result = Sampled_indexToX (me, bandNumber);
  2084. NUMBER_ONE_END (U" hertz")
  2085. }
  2086. DIRECT (REAL_Spectrum_getLowestFrequency) {
  2087. NUMBER_ONE (Spectrum)
  2088. double result = my xmin;
  2089. NUMBER_ONE_END (U" hertz")
  2090. }
  2091. DIRECT (REAL_Spectrum_getHighestFrequency) {
  2092. NUMBER_ONE (Spectrum)
  2093. double result = my xmax;
  2094. NUMBER_ONE_END (U" hertz");
  2095. }
  2096. FORM (REAL_Spectrum_getRealValueInBin, U"Spectrum: Get real value in bin", nullptr) {
  2097. NATURAL (binNumber, U"Bin number", U"100")
  2098. OK
  2099. DO
  2100. NUMBER_ONE (Spectrum)
  2101. if (binNumber > my nx) Melder_throw (U"Bin number should not exceed number of bins.");
  2102. double result = my z [1] [binNumber];
  2103. NUMBER_ONE_END (U" (real value in bin ", binNumber, U")")
  2104. }
  2105. FORM (REAL_Spectrum_getImaginaryValueInBin, U"Spectrum: Get imaginary value in bin", nullptr) {
  2106. NATURAL (binNumber, U"Bin number", U"100")
  2107. OK
  2108. DO
  2109. NUMBER_ONE (Spectrum)
  2110. if (binNumber > my nx) Melder_throw (U"The bin number should not exceed the number of bins.");
  2111. double result = my z [2] [binNumber];
  2112. NUMBER_ONE_END (U" (imaginary value in bin ", binNumber, U")")
  2113. }
  2114. FORM (REAL_Spectrum_getKurtosis, U"Spectrum: Get kurtosis", U"Spectrum: Get kurtosis...") {
  2115. POSITIVE (power, U"Power", U"2.0")
  2116. OK
  2117. DO
  2118. NUMBER_ONE (Spectrum)
  2119. double result = Spectrum_getKurtosis (me, power);
  2120. NUMBER_ONE_END (U" (kurtosis)")
  2121. }
  2122. DIRECT (INTEGER_Spectrum_getNumberOfBins) {
  2123. NUMBER_ONE (Spectrum)
  2124. integer result = my nx;
  2125. NUMBER_ONE_END (U" bins")
  2126. }
  2127. FORM (REAL_Spectrum_getSkewness, U"Spectrum: Get skewness", U"Spectrum: Get skewness...") {
  2128. POSITIVE (power, U"Power", U"2.0")
  2129. OK
  2130. DO
  2131. NUMBER_ONE (Spectrum)
  2132. double result = Spectrum_getSkewness (me, power);
  2133. NUMBER_ONE_END (U" (skewness)")
  2134. }
  2135. FORM (REAL_Spectrum_getStandardDeviation, U"Spectrum: Get standard deviation", U"Spectrum: Get standard deviation...") {
  2136. POSITIVE (power, U"Power", U"2.0")
  2137. OK
  2138. DO
  2139. NUMBER_ONE (Spectrum)
  2140. double result = Spectrum_getStandardDeviation (me, power);
  2141. NUMBER_ONE_END (U" hertz")
  2142. }
  2143. // MARK: Modify
  2144. FORM (MODIFY_Spectrum_formula, U"Spectrum: Formula", U"Spectrum: Formula...") {
  2145. LABEL (U"`x` is the frequency in hertz, `col` is the bin number; "
  2146. "`y' = `row' is 1 (real part) or 2 (imaginary part)")
  2147. LABEL (U"y := 1; row := 1; "
  2148. "x := 0; for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
  2149. LABEL (U"y := 2; row := 2; "
  2150. "x := 0; for col := 1 to ncol do { self [2, col] := `formula` ; x := x + dx }")
  2151. TEXTFIELD (formula, U"Formula:", U"0")
  2152. OK
  2153. DO
  2154. MODIFY_EACH_WEAK (Spectrum)
  2155. Matrix_formula (me, formula, interpreter, nullptr);
  2156. MODIFY_EACH_WEAK_END
  2157. }
  2158. FORM (MODIFY_Spectrum_passHannBand, U"Spectrum: Filter (pass Hann band)", U"Spectrum: Filter (pass Hann band)...") {
  2159. REAL (fromFrequency, U"From frequency (Hz)", U"500.0")
  2160. REAL (toFrequency, U"To frequency (Hz)", U"1000.0")
  2161. POSITIVE (smoothing, U"Smoothing (Hz)", U"100.0")
  2162. OK
  2163. DO
  2164. MODIFY_EACH (Spectrum)
  2165. Spectrum_passHannBand (me, fromFrequency, toFrequency, smoothing);
  2166. MODIFY_EACH_END
  2167. }
  2168. FORM (MODIFY_Spectrum_stopHannBand, U"Spectrum: Filter (stop Hann band)", U"Spectrum: Filter (stop Hann band)...") {
  2169. REAL (fromFrequency, U"From frequency (Hz)", U"500.0")
  2170. REAL (toFrequency, U"To frequency (Hz)", U"1000.0")
  2171. POSITIVE (smoothing, U"Smoothing (Hz)", U"100.0")
  2172. OK
  2173. DO
  2174. MODIFY_EACH (Spectrum)
  2175. Spectrum_stopHannBand (me, fromFrequency, toFrequency, smoothing);
  2176. MODIFY_EACH_END
  2177. }
  2178. // MARK: Convert
  2179. FORM (NEW_Spectrum_cepstralSmoothing, U"Spectrum: Cepstral smoothing", nullptr) {
  2180. POSITIVE (bandwidth, U"Bandwidth (Hz)", U"500.0")
  2181. OK
  2182. DO
  2183. CONVERT_EACH (Spectrum)
  2184. autoSpectrum result = Spectrum_cepstralSmoothing (me, bandwidth);
  2185. CONVERT_EACH_END (my name.get())
  2186. }
  2187. FORM (NEW_Spectrum_lpcSmoothing, U"Spectrum: LPC smoothing", 0) {
  2188. NATURAL (numberOfPeaks, U"Number of peaks", U"5")
  2189. POSITIVE (preEmphasisFrom, U"Pre-emphasis from (Hz)", U"50.0")
  2190. OK
  2191. DO
  2192. CONVERT_EACH (Spectrum)
  2193. autoSpectrum result = Spectrum_lpcSmoothing (me, numberOfPeaks, preEmphasisFrom);
  2194. CONVERT_EACH_END (my name.get())
  2195. }
  2196. FORM (NEW_Spectrum_to_Excitation, U"Spectrum: To Excitation", nullptr) {
  2197. POSITIVE (frequencyResolution, U"Frequency resolution (Bark)", U"0.1")
  2198. OK
  2199. DO
  2200. CONVERT_EACH (Spectrum)
  2201. autoExcitation result = Spectrum_to_Excitation (me, frequencyResolution);
  2202. CONVERT_EACH_END (my name.get())
  2203. }
  2204. FORM (NEW_Spectrum_to_Formant_peaks, U"Spectrum: To Formant (peaks)", nullptr) {
  2205. LABEL (U"Warning: this simply picks peaks from 0 Hz up!")
  2206. NATURAL (maximumNumberOfFormants, U"Maximum number of formants", U"1000")
  2207. OK
  2208. DO
  2209. CONVERT_EACH (Spectrum)
  2210. autoFormant result = Spectrum_to_Formant (me, maximumNumberOfFormants);
  2211. CONVERT_EACH_END (my name.get())
  2212. }
  2213. FORM (NEW_Spectrum_to_Ltas, U"Spectrum: To Long-term average spectrum", nullptr) {
  2214. POSITIVE (bandwidth, U"Bandwidth (Hz)", U"1000.0")
  2215. OK
  2216. DO
  2217. CONVERT_EACH (Spectrum)
  2218. autoLtas result = Spectrum_to_Ltas (me, bandwidth);
  2219. CONVERT_EACH_END (my name.get())
  2220. }
  2221. DIRECT (NEW_Spectrum_to_Ltas_1to1) {
  2222. CONVERT_EACH (Spectrum)
  2223. autoLtas result = Spectrum_to_Ltas_1to1 (me);
  2224. CONVERT_EACH_END (my name.get())
  2225. }
  2226. DIRECT (NEW_Spectrum_to_Matrix) {
  2227. CONVERT_EACH (Spectrum)
  2228. autoMatrix result = Spectrum_to_Matrix (me);
  2229. CONVERT_EACH_END (my name.get())
  2230. }
  2231. DIRECT (NEW_Spectrum_to_Sound) {
  2232. CONVERT_EACH (Spectrum)
  2233. autoSound result = Spectrum_to_Sound (me);
  2234. CONVERT_EACH_END (my name.get())
  2235. }
  2236. DIRECT (NEW_Spectrum_to_Spectrogram) {
  2237. CONVERT_EACH (Spectrum)
  2238. autoSpectrogram result = Spectrum_to_Spectrogram (me);
  2239. CONVERT_EACH_END (my name.get())
  2240. }
  2241. DIRECT (NEW_Spectrum_to_SpectrumTier_peaks) {
  2242. CONVERT_EACH (Spectrum)
  2243. autoSpectrumTier result = Spectrum_to_SpectrumTier_peaks (me);
  2244. CONVERT_EACH_END (my name.get())
  2245. }
  2246. // MARK: - STRINGS
  2247. // MARK: New
  2248. FORM (NEW1_Strings_createAsFileList, U"Create Strings as file list", U"Create Strings as file list...") {
  2249. SENTENCE (name, U"Name", U"fileList")
  2250. static structMelderDir defaultDir { };
  2251. Melder_getHomeDir (& defaultDir);
  2252. static conststring32 homeDirectory = Melder_dirToPath (& defaultDir);
  2253. static char32 defaultPath [kMelder_MAXPATH+1];
  2254. #if defined (UNIX)
  2255. Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, U"/*.wav");
  2256. #elif defined (_WIN32)
  2257. {
  2258. static int len = str32len (homeDirectory);
  2259. Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, len == 0 || homeDirectory [len - 1] != U'\\' ? U"\\" : U"", U"*.wav");
  2260. }
  2261. #else
  2262. Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, U"/*.wav");
  2263. #endif
  2264. TEXTFIELD (path, U"File path:", defaultPath)
  2265. OK
  2266. DO
  2267. CREATE_ONE
  2268. autoStrings result = Strings_createAsFileList (path);
  2269. CREATE_ONE_END (name)
  2270. }
  2271. FORM (NEW1_Strings_createAsDirectoryList, U"Create Strings as directory list", U"Create Strings as directory list...") {
  2272. SENTENCE (name, U"Name", U"directoryList")
  2273. static structMelderDir defaultDir { };
  2274. Melder_getHomeDir (& defaultDir);
  2275. static conststring32 homeDirectory = Melder_dirToPath (& defaultDir);
  2276. static char32 defaultPath [kMelder_MAXPATH+1];
  2277. #if defined (UNIX)
  2278. Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, U"/*");
  2279. #elif defined (_WIN32)
  2280. {
  2281. int len = str32len (homeDirectory);
  2282. Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, len == 0 || homeDirectory [len - 1] != U'\\' ? U"\\" : U"");
  2283. }
  2284. #else
  2285. Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, U"/*");
  2286. #endif
  2287. TEXTFIELD (path, U"Path:", defaultPath)
  2288. OK
  2289. DO
  2290. CREATE_ONE
  2291. autoStrings result = Strings_createAsDirectoryList (path);
  2292. CREATE_ONE_END (name)
  2293. }
  2294. // MARK: Open
  2295. FORM_READ (READ1_Strings_readFromRawTextFile, U"Read Strings from raw text file", nullptr, true) {
  2296. READ_ONE
  2297. autoStrings result = Strings_readFromRawTextFile (file);
  2298. READ_ONE_END
  2299. }
  2300. // MARK: Save
  2301. FORM_SAVE (SAVE_Strings_writeToRawTextFile, U"Save Strings as text file", nullptr, U"txt") {
  2302. SAVE_ONE (Strings)
  2303. Strings_writeToRawTextFile (me, file);
  2304. SAVE_ONE_END
  2305. }
  2306. // MARK: Help
  2307. DIRECT (HELP_Strings_help) {
  2308. HELP (U"Strings")
  2309. }
  2310. // MARK: View & Edit
  2311. DIRECT (WINDOW_Strings_viewAndEdit) {
  2312. if (theCurrentPraatApplication -> batch) Melder_throw (U"Cannot view or edit a Strings from batch.");
  2313. FIND_ONE_WITH_IOBJECT (Strings)
  2314. autoStringsEditor editor = StringsEditor_create (ID_AND_FULL_NAME, me);
  2315. praat_installEditor (editor.get(), IOBJECT);
  2316. editor.releaseToUser();
  2317. END
  2318. }
  2319. // MARK: Query
  2320. DIRECT (BOOLEAN_Strings_equal) {
  2321. NUMBER_COUPLE (Strings)
  2322. integer result = (integer) Data_equal (me, you); // cast bool to 0 or 1
  2323. NUMBER_COUPLE_END (result ? U" (equal)" : U" (unequal)")
  2324. }
  2325. DIRECT (INTEGER_Strings_getNumberOfStrings) {
  2326. NUMBER_ONE (Strings)
  2327. integer result = my numberOfStrings;
  2328. NUMBER_ONE_END (U" strings")
  2329. }
  2330. FORM (STRING_Strings_getString, U"Get string", nullptr) {
  2331. NATURAL (position, U"Position", U"1")
  2332. OK
  2333. DO
  2334. STRING_ONE (Strings)
  2335. conststring32 result = position > my numberOfStrings ? U"" : my strings [position].get(); // TODO
  2336. STRING_ONE_END
  2337. }
  2338. // MARK: Modify
  2339. FORM (MODIFY_Strings_insertString, U"Strings: Insert string", nullptr) {
  2340. INTEGER (atPosition, U"At position", U"0 (= at end)")
  2341. TEXTFIELD (string, U"String:", U"")
  2342. OK
  2343. DO
  2344. MODIFY_EACH (Strings)
  2345. Strings_insert (me, atPosition, string);
  2346. MODIFY_EACH_END
  2347. }
  2348. DIRECT (MODIFY_Strings_nativize) {
  2349. MODIFY_EACH_WEAK (Strings)
  2350. Strings_nativize (me);
  2351. MODIFY_EACH_WEAK_END
  2352. }
  2353. DIRECT (MODIFY_Strings_genericize) {
  2354. MODIFY_EACH_WEAK (Strings)
  2355. Strings_genericize (me);
  2356. MODIFY_EACH_WEAK_END
  2357. }
  2358. DIRECT (MODIFY_Strings_randomize) {
  2359. MODIFY_EACH (Strings)
  2360. Strings_randomize (me);
  2361. MODIFY_EACH_END
  2362. }
  2363. FORM (MODIFY_Strings_removeString, U"Strings: Remove string", nullptr) {
  2364. NATURAL (position, U"Position", U"1")
  2365. OK
  2366. DO
  2367. MODIFY_EACH (Strings)
  2368. Strings_remove (me, position);
  2369. MODIFY_EACH_END
  2370. }
  2371. FORM (MODIFY_Strings_setString, U"Strings: Set string", nullptr) {
  2372. NATURAL (position, U"Position", U"1")
  2373. TEXTFIELD (newString, U"New string:", U"")
  2374. OK
  2375. DO
  2376. MODIFY_EACH (Strings)
  2377. Strings_replace (me, position, newString);
  2378. MODIFY_EACH_END
  2379. }
  2380. DIRECT (MODIFY_Strings_sort) {
  2381. MODIFY_EACH (Strings)
  2382. Strings_sort (me);
  2383. MODIFY_EACH_END
  2384. }
  2385. // MARK: Convert
  2386. FORM (NEW_Strings_replaceAll, U"Strings: Replace all", nullptr) {
  2387. SENTENCE (find, U"Find", U"a")
  2388. SENTENCE (replaceWith, U"Replace with", U"b")
  2389. INTEGER (replaceLimitPerString, U"Replace limit per string", U"0 (= unlimited)")
  2390. RADIOx (findAndReplaceStringsAre, U"Find and replace strings are", 1, 0)
  2391. RADIOBUTTON (U"literals")
  2392. RADIOBUTTON (U"regular expressions")
  2393. OK
  2394. DO
  2395. CONVERT_EACH (Strings)
  2396. integer numberOfMatches, numberOfStringMatches;
  2397. autoStrings result = Strings_change (me, find, replaceWith,
  2398. replaceLimitPerString, & numberOfMatches, & numberOfStringMatches, findAndReplaceStringsAre); // FIXME: boolean inappropriate
  2399. CONVERT_EACH_END (my name.get(), U"_replaced")
  2400. }
  2401. DIRECT (NEW_Strings_to_Distributions) {
  2402. CONVERT_EACH (Strings)
  2403. autoDistributions result = Strings_to_Distributions (me);
  2404. CONVERT_EACH_END (my name.get())
  2405. }
  2406. DIRECT (NEW_Strings_to_WordList) {
  2407. CONVERT_EACH (Strings)
  2408. autoWordList result = Strings_to_WordList (me);
  2409. CONVERT_EACH_END (my name.get())
  2410. }
  2411. // MARK: - TABLE; the remainder is in praat_Stat.cpp *****/
  2412. DIRECT (NEW_Table_downto_Matrix) {
  2413. CONVERT_EACH (Table)
  2414. autoMatrix result = Table_to_Matrix (me);
  2415. CONVERT_EACH_END (my name.get())
  2416. }
  2417. // MARK: - TEXTGRID; the remainder is in praat_TextGrid_init.cpp
  2418. FORM (NEW1_TextGrid_create, U"Create TextGrid", U"Create TextGrid...") {
  2419. LABEL (U"Hint: to label or segment an existing Sound,")
  2420. LABEL (U"select that Sound and choose \"To TextGrid...\".")
  2421. REAL (startTime, U"Start time (s)", U"0.0")
  2422. REAL (endTime, U"End time (s)", U"1.0")
  2423. SENTENCE (allTierNames, U"All tier names", U"Mary John bell")
  2424. SENTENCE (whichOfTheseArePointTiers, U"Which of these are point tiers?", U"bell")
  2425. OK
  2426. DO
  2427. if (endTime <= startTime) Melder_throw (U"The end time should be greater than the start time");
  2428. CREATE_ONE
  2429. autoTextGrid result = TextGrid_create (startTime, endTime, allTierNames, whichOfTheseArePointTiers);
  2430. CREATE_ONE_END (allTierNames)
  2431. }
  2432. // MARK: - TEXTTIER; the remainder is in praat_TextGrid_init.cpp *****/
  2433. FORM_READ (READ1_TextTier_readFromXwaves, U"Read TextTier from Xwaves", nullptr, true) {
  2434. READ_ONE
  2435. autoTextTier result = TextTier_readFromXwaves (file);
  2436. READ_ONE_END
  2437. }
  2438. // MARK: - TRANSITION
  2439. DIRECT (NEW_Transition_conflate) {
  2440. CONVERT_EACH (Transition)
  2441. autoDistributions result = Transition_to_Distributions_conflate (me);
  2442. CONVERT_EACH_END (my name.get())
  2443. }
  2444. FORM (GRAPHICS_Transition_drawAsNumbers, U"Draw as numbers", nullptr) {
  2445. RADIO (format, U"Format", 1)
  2446. RADIOBUTTON (U"decimal")
  2447. RADIOBUTTON (U"exponential")
  2448. RADIOBUTTON (U"free")
  2449. RADIOBUTTON (U"rational")
  2450. NATURAL (precision, U"Precision", U"2")
  2451. OK
  2452. DO
  2453. GRAPHICS_EACH (Transition)
  2454. Transition_drawAsNumbers (me, GRAPHICS, format, precision);
  2455. GRAPHICS_EACH_END
  2456. }
  2457. DIRECT (NEWTIMES2_Transition_eigen) {
  2458. LOOP {
  2459. iam (Transition);
  2460. autoMatrix vectors, values;
  2461. Transition_eigen (me, & vectors, & values);
  2462. praat_new (vectors.move(), U"eigenvectors");
  2463. praat_new (values.move(), U"eigenvalues");
  2464. }
  2465. END }
  2466. DIRECT (HELP_Transition_help) {
  2467. HELP (U"Transition")
  2468. }
  2469. FORM (NEW_Transition_power, U"Transition: Power...", nullptr) {
  2470. NATURAL (power, U"Power", U"2")
  2471. OK
  2472. DO
  2473. CONVERT_EACH (Transition)
  2474. autoTransition result = Transition_power (me, power);
  2475. CONVERT_EACH_END (my name.get())
  2476. }
  2477. DIRECT (NEW_Transition_to_Matrix) {
  2478. CONVERT_EACH (Transition)
  2479. autoMatrix result = Transition_to_Matrix (me);
  2480. CONVERT_EACH_END (my name.get())
  2481. }
  2482. // MARK: - Praat menu
  2483. FORM (INFO_Praat_test, U"Praat test", 0) {
  2484. OPTIONMENU_ENUM (kPraatTests, test, U"Test", kPraatTests::DEFAULT)
  2485. SENTENCE (arg1, U"arg1", U"1000000")
  2486. SENTENCE (arg2, U"arg2", U"")
  2487. SENTENCE (arg3, U"arg3", U"")
  2488. SENTENCE (arg4, U"arg4", U"")
  2489. OK
  2490. DO
  2491. INFO_NONE
  2492. Praat_tests ((kPraatTests) test, arg1, arg2, arg3, arg4);
  2493. INFO_NONE_END
  2494. }
  2495. // MARK: - Help menu
  2496. DIRECT (HELP_ObjectWindow) { HELP (U"Object window") }
  2497. DIRECT (HELP_Intro) { HELP (U"Intro") }
  2498. DIRECT (HELP_WhatsNew) { HELP (U"What's new?") }
  2499. DIRECT (HELP_TypesOfObjects) { HELP (U"Types of objects") }
  2500. DIRECT (HELP_Editors) { HELP (U"Editors") }
  2501. DIRECT (HELP_FrequentlyAskedQuestions) { HELP (U"FAQ (Frequently Asked Questions)") }
  2502. DIRECT (HELP_Acknowledgments) { HELP (U"Acknowledgments") }
  2503. DIRECT (HELP_FormulasTutorial) { HELP (U"Formulas") }
  2504. DIRECT (HELP_ScriptingTutorial) { HELP (U"Scripting") }
  2505. DIRECT (HELP_DemoWindow) { HELP (U"Demo window") }
  2506. DIRECT (HELP_Interoperability) { HELP (U"Interoperability") }
  2507. DIRECT (HELP_Programming) { HELP (U"Programming with Praat") }
  2508. DIRECT (HELP_SearchManual_Fon) { Melder_search (); END }
  2509. // MARK: - file recognizers
  2510. static autoDaata cgnSyntaxFileRecognizer (integer nread, const char *header, MelderFile file) {
  2511. if (nread < 57) return autoDaata ();
  2512. if (! strnequ (& header [0], "<?xml version=\"1.0\"?>", 21) ||
  2513. (! strnequ (& header [22], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35) &&
  2514. ! strnequ (& header [23], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35))) return autoDaata ();
  2515. return TextGrid_readFromCgnSyntaxFile (file);
  2516. }
  2517. static autoDaata chronologicalTextGridTextFileRecognizer (integer nread, const char *header, MelderFile file) {
  2518. if (nread < 100) return autoDaata ();
  2519. if (strnequ (& header [0], "\"Praat chronological TextGrid text file\"", 40))
  2520. return TextGrid_readFromChronologicalTextFile (file);
  2521. char headerCopy [101];
  2522. memcpy (headerCopy, header, 100);
  2523. headerCopy [100] = '\0';
  2524. for (int i = 0; i < 100; i ++)
  2525. if (headerCopy [i] == '\0') headerCopy [i] = '\001';
  2526. //if (strstr (headerCopy, "\"\001P\001r\001a\001a\001t\001 \001c\001h\001r\001o\001n\001o\001l\001o\001g\001i\001c\001a\001l\001"
  2527. // " \001T\001e\001x\001t\001G\001r\001i\001d\001 t\001"))
  2528. if (strstr (headerCopy, "\"\001P\001r\001a\001a\001t\001 \001c\001h\001r\001o\001n\001o\001l\001o\001g\001i\001c\001a\001l\001"
  2529. " \001T\001e\001x\001t\001G\001r\001i\001d\001 \001t\001e\001x\001t\001 \001f\001i\001l\001e\001\""))
  2530. {
  2531. return TextGrid_readFromChronologicalTextFile (file);
  2532. }
  2533. return autoDaata ();
  2534. }
  2535. // MARK: - buttons
  2536. void praat_uvafon_init () {
  2537. Thing_recognizeClassesByName (classPolygon, classParamCurve,
  2538. classSpectrum, classLtas, classSpectrogram, classFormant,
  2539. classExcitation, classCochleagram, classVocalTract,
  2540. classLabel, classTier, classAutosegment, // three obsolete classes
  2541. classIntensity, classPitch, classHarmonicity,
  2542. classTransition,
  2543. classManipulation, classTextPoint, classTextInterval, classTextTier,
  2544. classIntervalTier, classTextGrid, classWordList, classSpellingChecker,
  2545. classCorpus,
  2546. nullptr);
  2547. Thing_recognizeClassByOtherName (classManipulation, U"Psola");
  2548. Thing_recognizeClassByOtherName (classManipulation, U"Analysis");
  2549. Thing_recognizeClassByOtherName (classPitchTier, U"StylPitch");
  2550. Data_recognizeFileType (cgnSyntaxFileRecognizer);
  2551. Data_recognizeFileType (chronologicalTextGridTextFileRecognizer);
  2552. Data_recognizeFileType (IDXFormattedMatrixFileRecognizer);
  2553. structManipulationEditor :: f_preferences ();
  2554. structSpectrumEditor :: f_preferences ();
  2555. structFormantGridEditor :: f_preferences ();
  2556. praat_addMenuCommand (U"Objects", U"Technical", U"Praat test...", nullptr, 0, INFO_Praat_test);
  2557. /*
  2558. The user interfaces for the classes are included in the order
  2559. in which they have to appear in the New menu:
  2560. */
  2561. praat_Sound_init ();
  2562. praat_addMenuCommand (U"Objects", U"New", U"-- new numerics --", nullptr, 0, nullptr);
  2563. praat_Matrix_init ();
  2564. INCLUDE_LIBRARY (praat_uvafon_stat_init)
  2565. praat_Tiers_init ();
  2566. praat_uvafon_TextGrid_init ();
  2567. praat_addMenuCommand (U"Objects", U"Open", U"Read Strings from raw text file...", nullptr, 0, READ1_Strings_readFromRawTextFile);
  2568. praat_addMenuCommand (U"Objects", U"New", U"-- new textgrid --", nullptr, 0, nullptr);
  2569. praat_addMenuCommand (U"Objects", U"New", U"Create TextGrid...", nullptr, 0, NEW1_TextGrid_create);
  2570. praat_addMenuCommand (U"Objects", U"New", U"Create Corpus...", nullptr, 0, NEW1_Corpus_create);
  2571. praat_addMenuCommand (U"Objects", U"New", U"Strings", nullptr, 0, nullptr);
  2572. praat_addMenuCommand (U"Objects", U"New", U"Create Strings as file list...", nullptr, 1, NEW1_Strings_createAsFileList);
  2573. praat_addMenuCommand (U"Objects", U"New", U"Create Strings as directory list...", nullptr, 1, NEW1_Strings_createAsDirectoryList);
  2574. praat_addMenuCommand (U"Objects", U"Open", U"-- read tier --", nullptr, 0, nullptr);
  2575. praat_addMenuCommand (U"Objects", U"Open", U"Read from special tier file...", nullptr, 0, nullptr);
  2576. praat_addMenuCommand (U"Objects", U"Open", U"Read TextTier from Xwaves...", nullptr, 1, READ1_TextTier_readFromXwaves);
  2577. praat_addMenuCommand (U"Objects", U"Open", U"Read IntervalTier from Xwaves...", nullptr, 1, READ1_IntervalTier_readFromXwaves);
  2578. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Praat Intro", nullptr, '?', HELP_Intro);
  2579. #ifndef macintosh
  2580. praat_addMenuCommand (U"Objects", U"Help", U"Object window", nullptr, 0, HELP_ObjectWindow);
  2581. #endif
  2582. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Frequently asked questions", nullptr, 0, HELP_FrequentlyAskedQuestions);
  2583. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"What's new?", nullptr, 0, HELP_WhatsNew);
  2584. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Types of objects", nullptr, 0, HELP_TypesOfObjects);
  2585. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Editors", nullptr, 0, HELP_Editors);
  2586. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Acknowledgments", nullptr, 0, HELP_Acknowledgments);
  2587. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- shell help --", nullptr, 0, nullptr);
  2588. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Formulas tutorial", nullptr, 0, HELP_FormulasTutorial);
  2589. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Scripting tutorial", nullptr, 0, HELP_ScriptingTutorial);
  2590. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Demo window", nullptr, 0, HELP_DemoWindow);
  2591. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Interoperability", nullptr, 0, HELP_Interoperability);
  2592. praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"Programming", nullptr, 0, HELP_Programming);
  2593. #ifdef macintosh
  2594. praat_addMenuCommand (U"Objects", U"Help", U"Praat Intro", nullptr, '?', HELP_Intro);
  2595. praat_addMenuCommand (U"Objects", U"Help", U"Object window help", nullptr, 0, HELP_ObjectWindow);
  2596. praat_addMenuCommand (U"Objects", U"Help", U"-- manual --", nullptr, 0, nullptr);
  2597. praat_addMenuCommand (U"Objects", U"Help", U"Search Praat manual...", nullptr, 'M', HELP_SearchManual_Fon);
  2598. #endif
  2599. praat_addAction1 (classCochleagram, 0, U"Cochleagram help", nullptr, 0, HELP_Cochleagram_help);
  2600. praat_addAction1 (classCochleagram, 1, U"Movie", nullptr, 0, MOVIE_Cochleagram_movie);
  2601. praat_addAction1 (classCochleagram, 0, U"Info", nullptr, 0, nullptr);
  2602. praat_addAction1 (classCochleagram, 2, U"Difference...", nullptr, 0, REAL_Cochleagram_difference);
  2603. praat_addAction1 (classCochleagram, 0, U"Draw", nullptr, 0, nullptr);
  2604. praat_addAction1 (classCochleagram, 0, U"Paint...", nullptr, 0, GRAPHICS_Cochleagram_paint);
  2605. praat_addAction1 (classCochleagram, 0, U"Modify", nullptr, 0, nullptr);
  2606. praat_addAction1 (classCochleagram, 0, U"Formula...", nullptr, 0, MODIFY_Cochleagram_formula);
  2607. praat_addAction1 (classCochleagram, 0, U"Analyse", nullptr, 0, nullptr);
  2608. praat_addAction1 (classCochleagram, 0, U"To Excitation (slice)...", nullptr, 0, NEW_Cochleagram_to_Excitation);
  2609. praat_addAction1 (classCochleagram, 0, U"Hack", nullptr, 0, nullptr);
  2610. praat_addAction1 (classCochleagram, 0, U"To Matrix", nullptr, 0, NEW_Cochleagram_to_Matrix);
  2611. praat_addAction1 (classCorpus, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_Corpus_edit);
  2612. praat_addAction1 (classDistributions, 0, U"Learn", nullptr, 0, nullptr);
  2613. praat_addAction1 (classDistributions, 1, U"To Transition...", nullptr, 0, NEW_Distributions_to_Transition);
  2614. praat_addAction1 (classDistributions, 2, U"To Transition (noise)...", nullptr, 0, NEW1_Distributions_to_Transition_noise);
  2615. praat_addAction1 (classExcitation, 0, U"Excitation help", nullptr, 0, HELP_Excitation_help);
  2616. praat_addAction1 (classExcitation, 0, U"Draw", nullptr, 0, nullptr);
  2617. praat_addAction1 (classExcitation, 0, U"Draw...", nullptr, 0, GRAPHICS_Excitation_draw);
  2618. praat_addAction1 (classExcitation, 0, U"Analyse", nullptr, 0, nullptr);
  2619. praat_addAction1 (classExcitation, 0, U"To Formant...", nullptr, 0, NEW_Excitation_to_Formant);
  2620. praat_addAction1 (classExcitation, 1, U"Query -", nullptr, 0, nullptr);
  2621. praat_addAction1 (classExcitation, 1, U"Get loudness", nullptr, 0, REAL_Excitation_getLoudness);
  2622. praat_addAction1 (classExcitation, 0, U"Modify", nullptr, 0, nullptr);
  2623. praat_addAction1 (classExcitation, 0, U"Formula...", nullptr, 0, MODIFY_Excitation_formula);
  2624. praat_addAction1 (classExcitation, 0, U"Hack", nullptr, 0, nullptr);
  2625. praat_addAction1 (classExcitation, 0, U"To Matrix", nullptr, 0, NEW_Excitation_to_Matrix);
  2626. praat_addAction1 (classFormant, 0, U"Formant help", nullptr, 0, HELP_Formant_help);
  2627. praat_addAction1 (classFormant, 0, U"Draw -", nullptr, 0, nullptr);
  2628. praat_addAction1 (classFormant, 0, U"Speckle...", nullptr, 1, GRAPHICS_Formant_drawSpeckles);
  2629. praat_addAction1 (classFormant, 0, U"Draw tracks...", nullptr, 1, GRAPHICS_Formant_drawTracks);
  2630. praat_addAction1 (classFormant, 0, U"Scatter plot...", nullptr, 1, GRAPHICS_Formant_scatterPlot);
  2631. praat_addAction1 (classFormant, 0, U"Tabulate -", nullptr, 0, nullptr);
  2632. praat_addAction1 (classFormant, 1, U"List...", nullptr, 1, LIST_Formant_list);
  2633. praat_addAction1 (classFormant, 0, U"Down to Table...", nullptr, 1, NEW_Formant_downto_Table);
  2634. praat_addAction1 (classFormant, 0, U"Query -", nullptr, 0, nullptr);
  2635. praat_TimeFrameSampled_query_init (classFormant);
  2636. praat_addAction1 (classFormant, 1, U"Get number of formants...", nullptr, 1, INTEGER_Formant_getNumberOfFormants);
  2637. praat_addAction1 (classFormant, 1, U"Get minimum number of formants", nullptr, 1, INTEGER_Formant_getMinimumNumberOfFormants);
  2638. praat_addAction1 (classFormant, 1, U"Get maximum number of formants", nullptr, 1, INTEGER_Formant_getMaximumNumberOfFormants);
  2639. praat_addAction1 (classFormant, 1, U"-- get value --", nullptr, 1, nullptr);
  2640. praat_addAction1 (classFormant, 1, U"Get value at time...", nullptr, 1, REAL_Formant_getValueAtTime);
  2641. praat_addAction1 (classFormant, 1, U"Get bandwidth at time...", nullptr, 1, REAL_Formant_getBandwidthAtTime);
  2642. praat_addAction1 (classFormant, 1, U"-- get extreme --", nullptr, 1, nullptr);
  2643. praat_addAction1 (classFormant, 1, U"Get minimum...", nullptr, 1, REAL_Formant_getMinimum);
  2644. praat_addAction1 (classFormant, 1, U"Get time of minimum...", nullptr, 1, REAL_Formant_getTimeOfMinimum);
  2645. praat_addAction1 (classFormant, 1, U"Get maximum...", nullptr, 1, REAL_Formant_getMaximum);
  2646. praat_addAction1 (classFormant, 1, U"Get time of maximum...", nullptr, 1, REAL_Formant_getTimeOfMaximum);
  2647. praat_addAction1 (classFormant, 1, U"-- get distribution --", nullptr, 1, nullptr);
  2648. praat_addAction1 (classFormant, 1, U"Get quantile...", nullptr, 1, REAL_Formant_getQuantile);
  2649. praat_addAction1 (classFormant, 1, U"Get quantile of bandwidth...", nullptr, 1, REAL_Formant_getQuantileOfBandwidth);
  2650. praat_addAction1 (classFormant, 1, U"Get mean...", nullptr, 1, REAL_Formant_getMean);
  2651. praat_addAction1 (classFormant, 1, U"Get standard deviation...", nullptr, 1, REAL_Formant_getStandardDeviation);
  2652. praat_addAction1 (classFormant, 0, U"Modify -", nullptr, 0, nullptr);
  2653. praat_TimeFunction_modify_init (classFormant);
  2654. praat_addAction1 (classFormant, 0, U"Sort", nullptr, 1, MODIFY_Formant_sort);
  2655. praat_addAction1 (classFormant, 0, U"Formula (frequencies)...", nullptr, 1, MODIFY_Formant_formula_frequencies);
  2656. praat_addAction1 (classFormant, 0, U"Formula (bandwidths)...", nullptr, 1, MODIFY_Formant_formula_bandwidths);
  2657. praat_addAction1 (classFormant, 0, U"Convert", nullptr, 0, nullptr);
  2658. praat_addAction1 (classFormant, 0, U"Track...", nullptr, 0, NEW_Formant_tracker);
  2659. praat_addAction1 (classFormant, 0, U"Down to FormantTier", nullptr, praat_HIDDEN, NEW_Formant_downto_FormantTier);
  2660. praat_addAction1 (classFormant, 0, U"Down to FormantGrid", nullptr, 0, NEW_Formant_downto_FormantGrid);
  2661. praat_addAction1 (classFormant, 0, U"Hack", nullptr, 0, nullptr);
  2662. praat_addAction1 (classFormant, 0, U"To Matrix...", nullptr, 0, NEW_Formant_to_Matrix);
  2663. praat_addAction1 (classHarmonicity, 0, U"Harmonicity help", nullptr, 0, HELP_Harmonicity_help);
  2664. praat_addAction1 (classHarmonicity, 0, U"Draw", nullptr, 0, nullptr);
  2665. praat_addAction1 (classHarmonicity, 0, U"Draw...", nullptr, 0, GRAPHICS_Harmonicity_draw);
  2666. praat_addAction1 (classHarmonicity, 1, U"Query -", nullptr, 0, nullptr);
  2667. praat_TimeFrameSampled_query_init (classHarmonicity);
  2668. praat_addAction1 (classHarmonicity, 1, U"-- get content --", nullptr, 1, nullptr);
  2669. praat_addAction1 (classHarmonicity, 1, U"Get value at time...", nullptr, 1, REAL_Harmonicity_getValueAtTime);
  2670. praat_addAction1 (classHarmonicity, 1, U"Get value in frame...", nullptr, 1, REAL_Harmonicity_getValueInFrame);
  2671. praat_addAction1 (classHarmonicity, 1, U"-- get extreme --", nullptr, 1, nullptr);
  2672. praat_addAction1 (classHarmonicity, 1, U"Get minimum...", nullptr, 1, REAL_Harmonicity_getMinimum);
  2673. praat_addAction1 (classHarmonicity, 1, U"Get time of minimum...", nullptr, 1, REAL_Harmonicity_getTimeOfMinimum);
  2674. praat_addAction1 (classHarmonicity, 1, U"Get maximum...", nullptr, 1, REAL_Harmonicity_getMaximum);
  2675. praat_addAction1 (classHarmonicity, 1, U"Get time of maximum...", nullptr, 1, REAL_Harmonicity_getTimeOfMaximum);
  2676. praat_addAction1 (classHarmonicity, 1, U"-- get statistics --", nullptr, 1, nullptr);
  2677. praat_addAction1 (classHarmonicity, 1, U"Get mean...", nullptr, 1, REAL_Harmonicity_getMean);
  2678. praat_addAction1 (classHarmonicity, 1, U"Get standard deviation...", nullptr, 1, REAL_Harmonicity_getStandardDeviation);
  2679. praat_addAction1 (classHarmonicity, 0, U"Modify", nullptr, 0, nullptr);
  2680. praat_TimeFunction_modify_init (classHarmonicity);
  2681. praat_addAction1 (classHarmonicity, 0, U"Formula...", nullptr, 0, MODIFY_Harmonicity_formula);
  2682. praat_addAction1 (classHarmonicity, 0, U"Hack", nullptr, 0, nullptr);
  2683. praat_addAction1 (classHarmonicity, 0, U"To Matrix", nullptr, 0, NEW_Harmonicity_to_Matrix);
  2684. praat_addAction1 (classIntensity, 0, U"Intensity help", nullptr, 0, HELP_Intensity_help);
  2685. praat_addAction1 (classIntensity, 0, U"Draw...", nullptr, 0, GRAPHICS_Intensity_draw);
  2686. praat_addAction1 (classIntensity, 1, U"Query -", nullptr, 0, nullptr);
  2687. praat_TimeFrameSampled_query_init (classIntensity);
  2688. praat_addAction1 (classIntensity, 1, U"-- get content --", nullptr, 1, nullptr);
  2689. praat_addAction1 (classIntensity, 1, U"Get value at time...", nullptr, 1, REAL_Intensity_getValueAtTime);
  2690. praat_addAction1 (classIntensity, 1, U"Get value in frame...", nullptr, 1, REAL_Intensity_getValueInFrame);
  2691. praat_addAction1 (classIntensity, 1, U"-- get extreme --", nullptr, 1, nullptr);
  2692. praat_addAction1 (classIntensity, 1, U"Get minimum...", nullptr, 1, REAL_Intensity_getMinimum);
  2693. praat_addAction1 (classIntensity, 1, U"Get time of minimum...", nullptr, 1, REAL_Intensity_getTimeOfMinimum);
  2694. praat_addAction1 (classIntensity, 1, U"Get maximum...", nullptr, 1, REAL_Intensity_getMaximum);
  2695. praat_addAction1 (classIntensity, 1, U"Get time of maximum...", nullptr, 1, REAL_Intensity_getTimeOfMaximum);
  2696. praat_addAction1 (classIntensity, 1, U"-- get statistics --", nullptr, 1, nullptr);
  2697. praat_addAction1 (classIntensity, 1, U"Get quantile...", nullptr, 1, REAL_Intensity_getQuantile);
  2698. praat_addAction1 (classIntensity, 1, U"Get mean...", nullptr, 1, REAL_Intensity_getMean);
  2699. praat_addAction1 (classIntensity, 1, U"Get standard deviation...", nullptr, 1, REAL_Intensity_getStandardDeviation);
  2700. praat_addAction1 (classIntensity, 0, U"Modify -", nullptr, 0, nullptr);
  2701. praat_TimeFunction_modify_init (classIntensity);
  2702. praat_addAction1 (classIntensity, 0, U"Formula...", nullptr, 1, MODIFY_Intensity_formula);
  2703. praat_addAction1 (classIntensity, 0, U"Analyse", nullptr, 0, nullptr);
  2704. praat_addAction1 (classIntensity, 0, U"To IntensityTier (peaks)", nullptr, 0, NEW_Intensity_to_IntensityTier_peaks);
  2705. praat_addAction1 (classIntensity, 0, U"To IntensityTier (valleys)", nullptr, 0, NEW_Intensity_to_IntensityTier_valleys);
  2706. praat_addAction1 (classIntensity, 0, U"Convert", nullptr, 0, nullptr);
  2707. praat_addAction1 (classIntensity, 0, U"Down to IntensityTier", nullptr, 0, NEW_Intensity_downto_IntensityTier);
  2708. praat_addAction1 (classIntensity, 0, U"Down to Matrix", nullptr, 0, NEW_Intensity_downto_Matrix);
  2709. praat_addAction1 (classLtas, 0, U"Ltas help", nullptr, 0, HELP_Ltas_help);
  2710. praat_addAction1 (classLtas, 0, U"Draw...", nullptr, 0, GRAPHICS_Ltas_draw);
  2711. praat_addAction1 (classLtas, 1, U"Query -", nullptr, 0, nullptr);
  2712. praat_addAction1 (classLtas, 1, U"Frequency domain", nullptr, 1, nullptr);
  2713. praat_addAction1 (classLtas, 1, U"Get lowest frequency", nullptr, 2, REAL_Ltas_getLowestFrequency);
  2714. praat_addAction1 (classLtas, 1, U"Get highest frequency", nullptr, 2, REAL_Ltas_getHighestFrequency);
  2715. praat_addAction1 (classLtas, 1, U"Frequency sampling", nullptr, 1, nullptr);
  2716. praat_addAction1 (classLtas, 1, U"Get number of bins", nullptr, 2, INTEGER_Ltas_getNumberOfBins);
  2717. praat_addAction1 (classLtas, 1, U"Get number of bands", U"*Get number of bins", praat_DEPTH_2 | praat_DEPRECATED_2004, INTEGER_Ltas_getNumberOfBins);
  2718. praat_addAction1 (classLtas, 1, U"Get bin width", nullptr, 2, REAL_Ltas_getBinWidth);
  2719. praat_addAction1 (classLtas, 1, U"Get band width", U"*Get bin width", praat_DEPTH_2 | praat_DEPRECATED_2004, REAL_Ltas_getBinWidth);
  2720. praat_addAction1 (classLtas, 1, U"Get frequency from bin number...", nullptr, 2, REAL_Ltas_getFrequencyFromBinNumber);
  2721. praat_addAction1 (classLtas, 1, U"Get frequency from band...", U"*Get frequency from bin number...", praat_DEPTH_2 | praat_DEPRECATED_2004, REAL_Ltas_getFrequencyFromBinNumber);
  2722. praat_addAction1 (classLtas, 1, U"Get bin number from frequency...", nullptr, 2, REAL_Ltas_getBinNumberFromFrequency);
  2723. praat_addAction1 (classLtas, 1, U"Get band from frequency...", U"*Get bin number from frequency...", praat_DEPTH_2 | praat_DEPRECATED_2004, REAL_Ltas_getBinNumberFromFrequency);
  2724. praat_addAction1 (classLtas, 1, U"-- get content --", nullptr, 1, nullptr);
  2725. praat_addAction1 (classLtas, 1, U"Get value at frequency...", nullptr, 1, REAL_Ltas_getValueAtFrequency);
  2726. praat_addAction1 (classLtas, 1, U"Get value in bin...", nullptr, 1, REAL_Ltas_getValueInBin);
  2727. praat_addAction1 (classLtas, 1, U"Get value in band...", U"*Get value in bin...", praat_DEPTH_1 | praat_DEPRECATED_2004, REAL_Ltas_getValueInBin);
  2728. praat_addAction1 (classLtas, 1, U"-- get extreme --", nullptr, 1, nullptr);
  2729. praat_addAction1 (classLtas, 1, U"Get minimum...", nullptr, 1, REAL_Ltas_getMinimum);
  2730. praat_addAction1 (classLtas, 1, U"Get frequency of minimum...", nullptr, 1, REAL_Ltas_getFrequencyOfMinimum);
  2731. praat_addAction1 (classLtas, 1, U"Get maximum...", nullptr, 1, REAL_Ltas_getMaximum);
  2732. praat_addAction1 (classLtas, 1, U"Get frequency of maximum...", nullptr, 1, REAL_Ltas_getFrequencyOfMaximum);
  2733. praat_addAction1 (classLtas, 1, U"-- get statistics --", nullptr, 1, nullptr);
  2734. praat_addAction1 (classLtas, 1, U"Get mean...", nullptr, 1, REAL_Ltas_getMean);
  2735. praat_addAction1 (classLtas, 1, U"Get slope...", nullptr, 1, REAL_Ltas_getSlope);
  2736. praat_addAction1 (classLtas, 1, U"Get local peak height...", nullptr, 1, REAL_Ltas_getLocalPeakHeight);
  2737. praat_addAction1 (classLtas, 1, U"Get standard deviation...", nullptr, 1, REAL_Ltas_getStandardDeviation);
  2738. praat_addAction1 (classLtas, 0, U"Modify", nullptr, 0, nullptr);
  2739. praat_addAction1 (classLtas, 0, U"Formula...", nullptr, 0, MODIFY_Ltas_formula);
  2740. praat_addAction1 (classLtas, 0, U"Analyse", nullptr, 0, nullptr);
  2741. praat_addAction1 (classLtas, 0, U"To SpectrumTier (peaks)", nullptr, 0, NEW_Ltas_to_SpectrumTier_peaks);
  2742. praat_addAction1 (classLtas, 0, U"Convert", nullptr, 0, nullptr);
  2743. praat_addAction1 (classLtas, 0, U"Compute trend line...", nullptr, 0, NEW_Ltas_computeTrendLine);
  2744. praat_addAction1 (classLtas, 0, U"Subtract trend line...", nullptr, 0, NEW_Ltas_subtractTrendLine);
  2745. praat_addAction1 (classLtas, 0, U"Combine", nullptr, 0, nullptr);
  2746. praat_addAction1 (classLtas, 0, U"Merge", nullptr, praat_DEPRECATED_2005, NEW1_Ltases_merge);
  2747. praat_addAction1 (classLtas, 0, U"Average", nullptr, 0, NEW1_Ltases_average);
  2748. praat_addAction1 (classLtas, 0, U"Hack", nullptr, 0, nullptr);
  2749. praat_addAction1 (classLtas, 0, U"To Matrix", nullptr, 0, NEW_Ltas_to_Matrix);
  2750. praat_addAction1 (classManipulation, 0, U"Manipulation help", nullptr, 0, HELP_Manipulation_help);
  2751. praat_addAction1 (classManipulation, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_Manipulation_viewAndEdit);
  2752. praat_addAction1 (classManipulation, 1, U"Edit", nullptr, praat_DEPRECATED_2011, WINDOW_Manipulation_viewAndEdit);
  2753. praat_addAction1 (classManipulation, 0, U"Play (overlap-add)", nullptr, 0, PLAY_Manipulation_play_overlapAdd);
  2754. praat_addAction1 (classManipulation, 0, U"Play (PSOLA)", nullptr, praat_DEPRECATED_2007, PLAY_Manipulation_play_overlapAdd);
  2755. praat_addAction1 (classManipulation, 0, U"Play (LPC)", nullptr, 0, PLAY_Manipulation_play_lpc);
  2756. praat_addAction1 (classManipulation, 0, U"Get resynthesis (overlap-add)", nullptr, 0, NEW_Manipulation_getResynthesis_overlapAdd);
  2757. praat_addAction1 (classManipulation, 0, U"Get resynthesis (PSOLA)", U"*Get resynthesis (overlap-add)", praat_DEPRECATED_2007, NEW_Manipulation_getResynthesis_overlapAdd);
  2758. praat_addAction1 (classManipulation, 0, U"Get resynthesis (LPC)", nullptr, 0, NEW_Manipulation_getResynthesis_lpc);
  2759. praat_addAction1 (classManipulation, 0, U"Extract original sound", nullptr, 0, NEW_Manipulation_extractOriginalSound);
  2760. praat_addAction1 (classManipulation, 0, U"Extract pulses", nullptr, 0, NEW_Manipulation_extractPulses);
  2761. praat_addAction1 (classManipulation, 0, U"Extract pitch tier", nullptr, 0, NEW_Manipulation_extractPitchTier);
  2762. praat_addAction1 (classManipulation, 0, U"Extract duration tier", nullptr, 0, NEW_Manipulation_extractDurationTier);
  2763. praat_addAction1 (classManipulation, 0, U"Modify -", nullptr, 0, nullptr);
  2764. praat_TimeFunction_modify_init (classManipulation);
  2765. praat_addAction1 (classManipulation, 0, U"Replace pitch tier?", nullptr, 1, HELP_Manipulation_replacePitchTier_help);
  2766. praat_addAction1 (classManipulation, 0, U"Replace duration tier?", nullptr, 1, HELP_Manipulation_replaceDurationTier_help);
  2767. praat_addAction1 (classManipulation, 1, U"Save as text file without Sound...", nullptr, 0, SAVE_Manipulation_writeToTextFileWithoutSound);
  2768. praat_addAction1 (classManipulation, 1, U"Write to text file without Sound...", U"*Save as text file without Sound...", praat_DEPRECATED_2011, SAVE_Manipulation_writeToTextFileWithoutSound);
  2769. praat_addAction1 (classManipulation, 1, U"Save as binary file without Sound...", nullptr, 0, SAVE_Manipulation_writeToBinaryFileWithoutSound);
  2770. praat_addAction1 (classManipulation, 1, U"Write to binary file without Sound...", U"*Save as binary file without Sound...", praat_DEPRECATED_2011, SAVE_Manipulation_writeToBinaryFileWithoutSound);
  2771. praat_addAction1 (classParamCurve, 0, U"ParamCurve help", nullptr, 0, HELP_ParamCurve_help);
  2772. praat_addAction1 (classParamCurve, 0, U"Draw", nullptr, 0, nullptr);
  2773. praat_addAction1 (classParamCurve, 0, U"Draw...", nullptr, 0, GRAPHICS_ParamCurve_draw);
  2774. praat_addAction1 (classPitch, 0, U"Pitch help", nullptr, 0, HELP_Pitch_help);
  2775. praat_addAction1 (classPitch, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_Pitch_viewAndEdit);
  2776. praat_addAction1 (classPitch, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_Pitch_viewAndEdit);
  2777. praat_addAction1 (classPitch, 0, U"Sound -", nullptr, 0, nullptr);
  2778. praat_addAction1 (classPitch, 0, U"Play pulses", nullptr, 1, PLAY_Pitch_play);
  2779. praat_addAction1 (classPitch, 0, U"Hum", nullptr, 1, PLAY_Pitch_hum);
  2780. praat_addAction1 (classPitch, 0, U"-- to sound --", nullptr, 1, nullptr);
  2781. praat_addAction1 (classPitch, 0, U"To Sound (pulses)", nullptr, 1, NEW_Pitch_to_Sound_pulses);
  2782. praat_addAction1 (classPitch, 0, U"To Sound (hum)", nullptr, 1, NEW_Pitch_to_Sound_hum);
  2783. praat_addAction1 (classPitch, 0, U"To Sound (sine)...", nullptr, 1, NEW_Pitch_to_Sound_sine);
  2784. praat_addAction1 (classPitch, 0, U"Draw -", nullptr, 0, nullptr);
  2785. praat_addAction1 (classPitch, 0, U"Draw...", nullptr, 1, GRAPHICS_Pitch_draw);
  2786. praat_addAction1 (classPitch, 0, U"Draw logarithmic...", nullptr, 1, GRAPHICS_Pitch_drawLogarithmic);
  2787. praat_addAction1 (classPitch, 0, U"Draw semitones (re 100 Hz)...", nullptr, 1, GRAPHICS_Pitch_drawSemitones100);
  2788. praat_addAction1 (classPitch, 0, U"Draw semitones...", U"*Draw semitones (re 100 Hz)...", praat_DEPTH_1 | praat_DEPRECATED_2012, GRAPHICS_Pitch_drawSemitones100);
  2789. praat_addAction1 (classPitch, 0, U"Draw semitones (re 200 Hz)...", nullptr, 1, GRAPHICS_Pitch_drawSemitones200);
  2790. praat_addAction1 (classPitch, 0, U"Draw semitones (re 440 Hz)...", nullptr, 1, GRAPHICS_Pitch_drawSemitones440);
  2791. praat_addAction1 (classPitch, 0, U"Draw mel...", nullptr, 1, GRAPHICS_Pitch_drawMel);
  2792. praat_addAction1 (classPitch, 0, U"Draw erb...", nullptr, 1, GRAPHICS_Pitch_drawErb);
  2793. praat_addAction1 (classPitch, 0, U"Speckle...", nullptr, 1, GRAPHICS_Pitch_speckle);
  2794. praat_addAction1 (classPitch, 0, U"Speckle logarithmic...", nullptr, 1, GRAPHICS_Pitch_speckleLogarithmic);
  2795. praat_addAction1 (classPitch, 0, U"Speckle semitones (re 100 Hz)...", nullptr, 1, GRAPHICS_Pitch_speckleSemitones100);
  2796. praat_addAction1 (classPitch, 0, U"Speckle semitones...", U"*Speckle semitones (re 100 Hz)...", praat_DEPTH_1 | praat_DEPRECATED_2012, GRAPHICS_Pitch_speckleSemitones100);
  2797. praat_addAction1 (classPitch, 0, U"Speckle semitones (re 200 Hz)...", nullptr, 1, GRAPHICS_Pitch_speckleSemitones200);
  2798. praat_addAction1 (classPitch, 0, U"Speckle semitones (re 440 Hz)...", nullptr, 1, GRAPHICS_Pitch_speckleSemitones440);
  2799. praat_addAction1 (classPitch, 0, U"Speckle mel...", nullptr, 1, GRAPHICS_Pitch_speckleMel);
  2800. praat_addAction1 (classPitch, 0, U"Speckle erb...", nullptr, 1, GRAPHICS_Pitch_speckleErb);
  2801. praat_addAction1 (classPitch, 0, U"Query -", nullptr, 0, nullptr);
  2802. praat_TimeFrameSampled_query_init (classPitch);
  2803. praat_addAction1 (classPitch, 1, U"-- get content --", nullptr, 1, nullptr);
  2804. praat_addAction1 (classPitch, 1, U"Count voiced frames", nullptr, 1, INTEGER_Pitch_getNumberOfVoicedFrames);
  2805. praat_addAction1 (classPitch, 1, U"Get value at time...", nullptr, 1, REAL_Pitch_getValueAtTime);
  2806. praat_addAction1 (classPitch, 1, U"Get value in frame...", nullptr, 1, REAL_Pitch_getValueInFrame);
  2807. praat_addAction1 (classPitch, 1, U"-- get extreme --", nullptr, 1, nullptr);
  2808. praat_addAction1 (classPitch, 1, U"Get minimum...", nullptr, 1, REAL_Pitch_getMinimum);
  2809. praat_addAction1 (classPitch, 1, U"Get time of minimum...", nullptr, 1, REAL_Pitch_getTimeOfMinimum);
  2810. praat_addAction1 (classPitch, 1, U"Get maximum...", nullptr, 1, REAL_Pitch_getMaximum);
  2811. praat_addAction1 (classPitch, 1, U"Get time of maximum...", nullptr, 1, REAL_Pitch_getTimeOfMaximum);
  2812. praat_addAction1 (classPitch, 1, U"-- get statistics --", nullptr, 1, nullptr);
  2813. praat_addAction1 (classPitch, 1, U"Get quantile...", nullptr, 1, REAL_Pitch_getQuantile);
  2814. /*praat_addAction1 (classPitch, 1, U"Get spreading...", nullptr, 1, REAL_Pitch_getSpreading);*/
  2815. praat_addAction1 (classPitch, 1, U"Get mean...", nullptr, 1, REAL_Pitch_getMean);
  2816. praat_addAction1 (classPitch, 1, U"Get standard deviation...", nullptr, 1, REAL_Pitch_getStandardDeviation);
  2817. praat_addAction1 (classPitch, 1, U"-- get slope --", nullptr, 1, nullptr);
  2818. praat_addAction1 (classPitch, 1, U"Get mean absolute slope...", nullptr, 1, REAL_Pitch_getMeanAbsoluteSlope);
  2819. praat_addAction1 (classPitch, 1, U"Get slope without octave jumps", nullptr, 1, REAL_Pitch_getMeanAbsSlope_noOctave);
  2820. praat_addAction1 (classPitch, 2, U"-- query two --", nullptr, 1, nullptr);
  2821. praat_addAction1 (classPitch, 2, U"Count differences", nullptr, 1, INFO_Pitch_difference);
  2822. praat_addAction1 (classPitch, 0, U"Modify -", nullptr, 0, nullptr);
  2823. praat_TimeFunction_modify_init (classPitch);
  2824. praat_addAction1 (classPitch, 0, U"Formula...", nullptr, 1, MODIFY_Pitch_formula);
  2825. praat_addAction1 (classPitch, 0, U"Annotate -", nullptr, 0, nullptr);
  2826. praat_addAction1 (classPitch, 0, U"To TextGrid...", nullptr, 1, NEW_Pitch_to_TextGrid);
  2827. praat_addAction1 (classPitch, 0, U"-- to single tier --", nullptr, praat_HIDDEN + praat_DEPTH_1, nullptr);
  2828. praat_addAction1 (classPitch, 0, U"To TextTier", nullptr, praat_HIDDEN | praat_DEPTH_1, NEW_Pitch_to_TextTier);
  2829. praat_addAction1 (classPitch, 0, U"To IntervalTier", nullptr, praat_HIDDEN | praat_DEPTH_1, NEW_Pitch_to_IntervalTier);
  2830. praat_addAction1 (classPitch, 0, U"Analyse -", nullptr, 0, nullptr);
  2831. praat_addAction1 (classPitch, 0, U"To PointProcess", nullptr, 1, NEW_Pitch_to_PointProcess);
  2832. praat_addAction1 (classPitch, 0, U"Convert -", nullptr, 0, nullptr);
  2833. praat_addAction1 (classPitch, 0, U"Interpolate", nullptr, 1, NEW_Pitch_interpolate);
  2834. praat_addAction1 (classPitch, 0, U"Smooth...", nullptr, 1, NEW_Pitch_smooth);
  2835. praat_addAction1 (classPitch, 0, U"Subtract linear fit...", nullptr, 1, NEW_Pitch_subtractLinearFit);
  2836. praat_addAction1 (classPitch, 0, U"Hack", nullptr, 1, nullptr);
  2837. praat_addAction1 (classPitch, 0, U"Kill octave jumps", nullptr, 2, NEW_Pitch_killOctaveJumps);
  2838. praat_addAction1 (classPitch, 0, U"-- to other types --", nullptr, 1, nullptr);
  2839. praat_addAction1 (classPitch, 0, U"Down to PitchTier", nullptr, 1, NEW_Pitch_downto_PitchTier);
  2840. praat_addAction1 (classPitch, 0, U"To Matrix", nullptr, 1, NEW_Pitch_to_Matrix);
  2841. praat_addAction1 (classPolygon, 0, U"Polygon help", nullptr, 0, HELP_Polygon_help);
  2842. praat_addAction1 (classPolygon, 0, U"Draw -", nullptr, 0, nullptr);
  2843. praat_addAction1 (classPolygon, 0, U"Draw...", nullptr, 1, GRAPHICS_Polygon_draw);
  2844. praat_addAction1 (classPolygon, 0, U"Draw closed...", nullptr, 1, GRAPHICS_Polygon_drawClosed);
  2845. praat_addAction1 (classPolygon, 0, U"Paint...", nullptr, 1, GRAPHICS_Polygon_paint);
  2846. praat_addAction1 (classPolygon, 0, U"Draw circles...", nullptr, 1, GRAPHICS_Polygon_drawCircles);
  2847. praat_addAction1 (classPolygon, 0, U"Paint circles...", nullptr, 1, GRAPHICS_Polygon_paintCircles);
  2848. praat_addAction1 (classPolygon, 2, U"Draw connection...", nullptr, 1, GRAPHICS_Polygons_drawConnection);
  2849. praat_addAction1 (classPolygon, 0, U"Modify -", nullptr, 0, nullptr);
  2850. praat_addAction1 (classPolygon, 0, U"Randomize", nullptr, 1, MODIFY_Polygon_randomize);
  2851. praat_addAction1 (classPolygon, 0, U"Salesperson...", nullptr, 1, MODIFY_Polygon_salesperson);
  2852. praat_addAction1 (classPolygon, 0, U"Hack -", nullptr, 0, nullptr);
  2853. praat_addAction1 (classPolygon, 0, U"To Matrix", nullptr, 1, NEW_Polygon_to_Matrix);
  2854. praat_addAction1 (classSpectrogram, 0, U"Spectrogram help", nullptr, 0, HELP_Spectrogram_help);
  2855. praat_addAction1 (classSpectrogram, 1, U"View", nullptr, 0, WINDOW_Spectrogram_view);
  2856. praat_addAction1 (classSpectrogram, 1, U"Movie", nullptr, 0, MOVIE_Spectrogram_movie);
  2857. praat_addAction1 (classSpectrogram, 0, U"Query -", nullptr, 0, nullptr);
  2858. praat_TimeFrameSampled_query_init (classSpectrogram);
  2859. praat_addAction1 (classSpectrogram, 1, U"Get power at...", nullptr, 1, REAL_Spectrogram_getPowerAt);
  2860. praat_addAction1 (classSpectrogram, 0, U"Draw -", nullptr, 0, nullptr);
  2861. praat_addAction1 (classSpectrogram, 0, U"Paint...", nullptr, 1, GRAPHICS_Spectrogram_paint);
  2862. praat_addAction1 (classSpectrogram, 0, U"Analyse -", nullptr, 0, nullptr);
  2863. praat_addAction1 (classSpectrogram, 0, U"To Spectrum (slice)...", nullptr, 1, NEW_Spectrogram_to_Spectrum);
  2864. praat_addAction1 (classSpectrogram, 0, U"Synthesize -", nullptr, 0, nullptr);
  2865. praat_addAction1 (classSpectrogram, 0, U"To Sound...", nullptr, 1, NEW_Spectrogram_to_Sound);
  2866. praat_addAction1 (classSpectrogram, 0, U"Modify -", nullptr, 0, nullptr);
  2867. praat_TimeFunction_modify_init (classSpectrogram);
  2868. praat_addAction1 (classSpectrogram, 0, U"Formula...", nullptr, 1, MODIFY_Spectrogram_formula);
  2869. praat_addAction1 (classSpectrogram, 0, U"Hack -", nullptr, 0, nullptr);
  2870. praat_addAction1 (classSpectrogram, 0, U"To Matrix", nullptr, 1, NEW_Spectrogram_to_Matrix);
  2871. praat_addAction1 (classSpectrum, 0, U"Spectrum help", nullptr, 0, HELP_Spectrum_help);
  2872. praat_addAction1 (classSpectrum, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_Spectrum_viewAndEdit);
  2873. praat_addAction1 (classSpectrum, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_Spectrum_viewAndEdit);
  2874. praat_addAction1 (classSpectrum, 0, U"Sound -", nullptr, 0, nullptr);
  2875. praat_addAction1 (classSpectrum, 0, U"To Sound", nullptr, 1, NEW_Spectrum_to_Sound);
  2876. praat_addAction1 (classSpectrum, 0, U"To Sound (fft)", U"*To Sound", praat_DEPTH_1 | praat_DEPRECATED_2004, NEW_Spectrum_to_Sound);
  2877. praat_addAction1 (classSpectrum, 0, U"Draw -", nullptr, 0, nullptr);
  2878. praat_addAction1 (classSpectrum, 0, U"Draw...", nullptr, 1, GRAPHICS_Spectrum_draw);
  2879. praat_addAction1 (classSpectrum, 0, U"Draw (log freq)...", nullptr, 1, GRAPHICS_Spectrum_drawLogFreq);
  2880. praat_addAction1 (classSpectrum, 1, U"Tabulate -", nullptr, 0, nullptr);
  2881. praat_addAction1 (classSpectrum, 1, U"List...", nullptr, 1, LIST_Spectrum_list);
  2882. praat_addAction1 (classSpectrum, 1, U"Query -", nullptr, 0, nullptr);
  2883. praat_addAction1 (classSpectrum, 1, U"Frequency domain", nullptr, 1, nullptr);
  2884. praat_addAction1 (classSpectrum, 1, U"Get lowest frequency", nullptr, 2, REAL_Spectrum_getLowestFrequency);
  2885. praat_addAction1 (classSpectrum, 1, U"Get highest frequency", nullptr, 2, REAL_Spectrum_getHighestFrequency);
  2886. praat_addAction1 (classSpectrum, 1, U"Frequency sampling", nullptr, 1, nullptr);
  2887. praat_addAction1 (classSpectrum, 1, U"Get number of bins", nullptr, 2, INTEGER_Spectrum_getNumberOfBins);
  2888. praat_addAction1 (classSpectrum, 1, U"Get bin width", nullptr, 2, REAL_Spectrum_getBinWidth);
  2889. praat_addAction1 (classSpectrum, 1, U"Get frequency from bin number...", nullptr, 2, REAL_Spectrum_getFrequencyFromBin);
  2890. praat_addAction1 (classSpectrum, 1, U"Get frequency from bin...", U"*Get frequency from bin number...", praat_DEPTH_2 | praat_DEPRECATED_2004, REAL_Spectrum_getFrequencyFromBin);
  2891. praat_addAction1 (classSpectrum, 1, U"Get bin number from frequency...", nullptr, 2, REAL_Spectrum_getBinNumberFromFrequency);
  2892. praat_addAction1 (classSpectrum, 1, U"Get bin from frequency...", nullptr, praat_DEPTH_2 | praat_DEPRECATED_2004, REAL_Spectrum_getBinNumberFromFrequency);
  2893. praat_addAction1 (classSpectrum, 1, U"-- get content --", nullptr, 1, nullptr);
  2894. praat_addAction1 (classSpectrum, 1, U"Get real value in bin...", nullptr, 1, REAL_Spectrum_getRealValueInBin);
  2895. praat_addAction1 (classSpectrum, 1, U"Get imaginary value in bin...", nullptr, 1, REAL_Spectrum_getImaginaryValueInBin);
  2896. praat_addAction1 (classSpectrum, 1, U"-- get energy --", nullptr, 1, nullptr);
  2897. praat_addAction1 (classSpectrum, 1, U"Get band energy...", nullptr, 1, REAL_Spectrum_getBandEnergy);
  2898. praat_addAction1 (classSpectrum, 1, U"Get band density...", nullptr, 1, REAL_Spectrum_getBandDensity);
  2899. praat_addAction1 (classSpectrum, 1, U"Get band energy difference...", nullptr, 1, REAL_Spectrum_getBandEnergyDifference);
  2900. praat_addAction1 (classSpectrum, 1, U"Get band density difference...", nullptr, 1, REAL_Spectrum_getBandDensityDifference);
  2901. praat_addAction1 (classSpectrum, 1, U"-- get moments --", nullptr, 1, nullptr);
  2902. praat_addAction1 (classSpectrum, 1, U"Get centre of gravity...", nullptr, 1, REAL_Spectrum_getCentreOfGravity);
  2903. praat_addAction1 (classSpectrum, 1, U"Get standard deviation...", nullptr, 1, REAL_Spectrum_getStandardDeviation);
  2904. praat_addAction1 (classSpectrum, 1, U"Get skewness...", nullptr, 1, REAL_Spectrum_getSkewness);
  2905. praat_addAction1 (classSpectrum, 1, U"Get kurtosis...", nullptr, 1, REAL_Spectrum_getKurtosis);
  2906. praat_addAction1 (classSpectrum, 1, U"Get central moment...", nullptr, 1, REAL_Spectrum_getCentralMoment);
  2907. praat_addAction1 (classSpectrum, 0, U"Modify -", nullptr, 0, nullptr);
  2908. praat_addAction1 (classSpectrum, 0, U"Formula...", nullptr, 1, MODIFY_Spectrum_formula);
  2909. praat_addAction1 (classSpectrum, 0, U"Filter (pass Hann band)...", nullptr, 1, MODIFY_Spectrum_passHannBand);
  2910. praat_addAction1 (classSpectrum, 0, U"Filter (stop Hann band)...", nullptr, 1, MODIFY_Spectrum_stopHannBand);
  2911. praat_addAction1 (classSpectrum, 0, U"Analyse -", nullptr, 0, nullptr);
  2912. praat_addAction1 (classSpectrum, 0, U"To Excitation...", nullptr, 1, NEW_Spectrum_to_Excitation);
  2913. praat_addAction1 (classSpectrum, 0, U"To SpectrumTier (peaks)", nullptr, 1, NEW_Spectrum_to_SpectrumTier_peaks);
  2914. praat_addAction1 (classSpectrum, 0, U"To Formant (peaks)...", nullptr, 1, NEW_Spectrum_to_Formant_peaks);
  2915. praat_addAction1 (classSpectrum, 0, U"To Ltas...", nullptr, 1, NEW_Spectrum_to_Ltas);
  2916. praat_addAction1 (classSpectrum, 0, U"To Ltas (1-to-1)", nullptr, 1, NEW_Spectrum_to_Ltas_1to1);
  2917. praat_addAction1 (classSpectrum, 0, U"To Spectrogram", nullptr, 1, NEW_Spectrum_to_Spectrogram);
  2918. praat_addAction1 (classSpectrum, 0, U"Convert -", nullptr, 0, nullptr);
  2919. praat_addAction1 (classSpectrum, 0, U"Cepstral smoothing...", nullptr, 1, NEW_Spectrum_cepstralSmoothing);
  2920. praat_addAction1 (classSpectrum, 0, U"LPC smoothing...", nullptr, 1, NEW_Spectrum_lpcSmoothing);
  2921. praat_addAction1 (classSpectrum, 0, U"Hack", nullptr, 1, nullptr);
  2922. praat_addAction1 (classSpectrum, 0, U"To Matrix", nullptr, 2, NEW_Spectrum_to_Matrix);
  2923. praat_addAction1 (classStrings, 0, U"Strings help", nullptr, 0, HELP_Strings_help);
  2924. praat_addAction1 (classStrings, 1, U"Save as raw text file...", nullptr, 0, SAVE_Strings_writeToRawTextFile);
  2925. praat_addAction1 (classStrings, 1, U"Write to raw text file...", U"*Save as raw text file...", praat_DEPRECATED_2011, SAVE_Strings_writeToRawTextFile);
  2926. praat_addAction1 (classStrings, 1, U"View & Edit", nullptr, praat_ATTRACTIVE, WINDOW_Strings_viewAndEdit);
  2927. praat_addAction1 (classStrings, 1, U"Edit", U"*View & Edit", praat_DEPRECATED_2011, WINDOW_Strings_viewAndEdit);
  2928. praat_addAction1 (classStrings, 0, U"Query -", nullptr, 0, nullptr);
  2929. praat_addAction1 (classStrings, 2, U"Equal?", nullptr, 1, BOOLEAN_Strings_equal);
  2930. praat_addAction1 (classStrings, 1, U"Get number of strings", nullptr, 1, INTEGER_Strings_getNumberOfStrings);
  2931. praat_addAction1 (classStrings, 1, U"Get string...", nullptr, 1, STRING_Strings_getString);
  2932. praat_addAction1 (classStrings, 0, U"Modify -", nullptr, 0, nullptr);
  2933. praat_addAction1 (classStrings, 0, U"Set string...", nullptr, 1, MODIFY_Strings_setString);
  2934. praat_addAction1 (classStrings, 0, U"Insert string...", nullptr, 1, MODIFY_Strings_insertString);
  2935. praat_addAction1 (classStrings, 0, U"Remove string...", nullptr, 1, MODIFY_Strings_removeString);
  2936. praat_addAction1 (classStrings, 0, U"-- modify order --", nullptr, 1, nullptr);
  2937. praat_addAction1 (classStrings, 0, U"Randomize", nullptr, 1, MODIFY_Strings_randomize);
  2938. praat_addAction1 (classStrings, 0, U"Sort", nullptr, 1, MODIFY_Strings_sort);
  2939. praat_addAction1 (classStrings, 0, U"-- convert --", nullptr, 1, nullptr);
  2940. praat_addAction1 (classStrings, 0, U"Convert to backslash trigraphs", nullptr, 1, MODIFY_Strings_genericize);
  2941. praat_addAction1 (classStrings, 0, U"Genericize", U"*Convert to backslash trigraphs", praat_DEPTH_1 | praat_DEPRECATED_2016, MODIFY_Strings_genericize);
  2942. praat_addAction1 (classStrings, 0, U"Convert to Unicode", nullptr, 1, MODIFY_Strings_nativize);
  2943. praat_addAction1 (classStrings, 0, U"Nativize", U"*Convert to Unicode", praat_DEPTH_1 | praat_DEPRECATED_2016, MODIFY_Strings_nativize);
  2944. praat_addAction1 (classStrings, 0, U"Convert -", nullptr, 0, nullptr);
  2945. praat_addAction1 (classStrings, 0, U"Replace all...", nullptr, 1, NEW_Strings_replaceAll);
  2946. praat_addAction1 (classStrings, 0, U"Analyze", nullptr, 0, nullptr);
  2947. praat_addAction1 (classStrings, 0, U"To Distributions", nullptr, 0, NEW_Strings_to_Distributions);
  2948. praat_addAction1 (classStrings, 0, U"Synthesize", nullptr, 0, nullptr);
  2949. praat_addAction1 (classStrings, 0, U"To WordList", nullptr, 0, NEW_Strings_to_WordList);
  2950. praat_addAction1 (classTable, 0, U"Down to Matrix", nullptr, 0, NEW_Table_downto_Matrix);
  2951. praat_addAction1 (classTransition, 0, U"Transition help", nullptr, 0, HELP_Transition_help);
  2952. praat_addAction1 (classTransition, 0, U"Draw", nullptr, 0, nullptr);
  2953. praat_addAction1 (classTransition, 0, U"Draw as numbers...", nullptr, 0, GRAPHICS_Transition_drawAsNumbers);
  2954. praat_addAction1 (classTransition, 0, U"Analyse", nullptr, 0, nullptr);
  2955. praat_addAction1 (classTransition, 0, U"Eigen", nullptr, 0, NEWTIMES2_Transition_eigen);
  2956. praat_addAction1 (classTransition, 0, U"Conflate", nullptr, 0, NEW_Transition_conflate);
  2957. praat_addAction1 (classTransition, 0, U"Synthesize", nullptr, 0, nullptr);
  2958. praat_addAction1 (classTransition, 0, U"Power...", nullptr, 0, NEW_Transition_power);
  2959. praat_addAction1 (classTransition, 0, U"Cast", nullptr, 0, nullptr);
  2960. praat_addAction1 (classTransition, 0, U"To Matrix", nullptr, 0, NEW_Transition_to_Matrix);
  2961. praat_addAction2 (classDistributions, 1, classTransition, 1, U"Map", nullptr, 0, NEW1_Distributions_Transition_map);
  2962. praat_addAction2 (classDistributions, 1, classTransition, 1, U"To Transition...", nullptr, 0, NEW1_Distributions_to_Transition_adj);
  2963. praat_addAction2 (classDistributions, 2, classTransition, 1, U"To Transition (noise)...", nullptr, 0, NEW1_Distributions_to_Transition_noise_adj);
  2964. praat_addAction2 (classFormant, 1, classPointProcess, 1, U"To FormantTier", nullptr, 0, NEW1_Formant_PointProcess_to_FormantTier);
  2965. praat_addAction2 (classFormant, 1, classSound, 1, U"Filter", nullptr, 0, NEW1_Sound_Formant_filter);
  2966. praat_addAction2 (classFormant, 1, classSound, 1, U"Filter (no scale)", nullptr, 0, NEW1_Sound_Formant_filter_noscale);
  2967. praat_addAction2 (classIntensity, 1, classPitch, 1, U"Draw", nullptr, 0, nullptr);
  2968. praat_addAction2 (classIntensity, 1, classPitch, 1, U"Draw (phonetogram)...", nullptr, 0, GRAPHICS_Pitch_Intensity_draw);
  2969. praat_addAction2 (classIntensity, 1, classPitch, 1, U"Get mean", nullptr, 1, REAL_Pitch_Intensity_getMean);
  2970. praat_addAction2 (classIntensity, 1, classPitch, 1, U"Get mean absolute slope", nullptr, 1, REAL_Pitch_Intensity_getMeanAbsoluteSlope);
  2971. praat_addAction2 (classIntensity, 1, classPointProcess, 1, U"To IntensityTier", nullptr, 0, NEW1_Intensity_PointProcess_to_IntensityTier);
  2972. praat_addAction2 (classManipulation, 1, classSound, 1, U"Replace original sound", nullptr, 0, MODIFY_Manipulation_replaceOriginalSound);
  2973. praat_addAction2 (classManipulation, 1, classPointProcess, 1, U"Replace pulses", nullptr, 0, MODIFY_Manipulation_replacePulses);
  2974. praat_addAction2 (classManipulation, 1, classPitchTier, 1, U"Replace pitch tier", nullptr, 0, MODIFY_Manipulation_replacePitchTier);
  2975. praat_addAction2 (classManipulation, 1, classDurationTier, 1, U"Replace duration tier", nullptr, 0, MODIFY_Manipulation_replaceDurationTier);
  2976. praat_addAction2 (classManipulation, 1, classTextTier, 1, U"To Manipulation", nullptr, 0, NEW1_Manipulation_TextTier_to_Manipulation);
  2977. praat_addAction2 (classPitch, 1, classPitchTier, 1, U"Draw...", nullptr, 0, GRAPHICS_PitchTier_Pitch_draw);
  2978. praat_addAction2 (classPitch, 1, classPitchTier, 1, U"To Pitch", nullptr, 0, NEW1_Pitch_PitchTier_to_Pitch);
  2979. praat_addAction2 (classPitch, 1, classPointProcess, 1, U"To PitchTier", nullptr, 0, NEW1_Pitch_PointProcess_to_PitchTier);
  2980. praat_addAction3 (classPitch, 1, classPointProcess, 1, classSound, 1, U"Voice report...", nullptr, 0, INFO_Sound_Pitch_PointProcess_voiceReport);
  2981. praat_addAction2 (classPitch, 1, classSound, 1, U"To PointProcess (cc)", nullptr, 0, NEW1_Sound_Pitch_to_PointProcess_cc);
  2982. praat_addAction2 (classPitch, 1, classSound, 1, U"To PointProcess (peaks)...", nullptr, 0, NEW1_Sound_Pitch_to_PointProcess_peaks);
  2983. praat_addAction2 (classPitch, 1, classSound, 1, U"To Manipulation", nullptr, 0, NEW1_Sound_Pitch_to_Manipulation);
  2984. praat_addAction4 (classDurationTier, 1, classPitchTier, 1, classPointProcess, 1, classSound, 1, U"To Sound...", nullptr, 0, NEW1_Sound_Point_Pitch_Duration_to_Sound);
  2985. INCLUDE_MANPAGES (manual_Manual_init)
  2986. INCLUDE_MANPAGES (manual_Script_init)
  2987. INCLUDE_MANPAGES (manual_Picture_init)
  2988. INCLUDE_MANPAGES (manual_Fon_init)
  2989. INCLUDE_MANPAGES (manual_tutorials_init)
  2990. INCLUDE_MANPAGES (manual_glossary_init)
  2991. INCLUDE_MANPAGES (manual_references_init)
  2992. INCLUDE_MANPAGES (manual_soundFiles_init)
  2993. INCLUDE_MANPAGES (manual_statistics_init)
  2994. INCLUDE_MANPAGES (manual_voice_init)
  2995. INCLUDE_MANPAGES (manual_programming_init)
  2996. INCLUDE_MANPAGES (manual_gram_init)
  2997. INCLUDE_MANPAGES (manual_ExperimentMFC_init)
  2998. INCLUDE_MANPAGES (manual_EEG_init)
  2999. INCLUDE_LIBRARY (praat_EEG_init)
  3000. praat_addMenuCommand (U"Objects", U"New", U"-- new synthesis --", nullptr, 0, nullptr);
  3001. INCLUDE_LIBRARY (praat_uvafon_Artsynth_init)
  3002. INCLUDE_LIBRARY (praat_uvafon_David_init)
  3003. praat_addMenuCommand (U"Objects", U"New", U"-- new grammars --", nullptr, 0, nullptr);
  3004. INCLUDE_LIBRARY (praat_uvafon_gram_init)
  3005. INCLUDE_LIBRARY (praat_uvafon_FFNet_init)
  3006. INCLUDE_LIBRARY (praat_uvafon_LPC_init)
  3007. praat_ExperimentMFC_init ();
  3008. }
  3009. /* End of file praat_Fon.cpp */