|
A growing list of functions that you can use in formulas and scripting...
abs (x) – absolute valueabs# (vector#) – absolute value of each element of vector#abs## (matrix##) – absolute value of each cell of matrix##appDay ( ) – the month day at which the present version of Praat was builtappendFile (filePath$, ...) – write texts, numbers, vectors and so on at the end of an existing file (create such a file if it does not exist yet)appendFileLine (filePath$, ...) – write texts, numbers, vectors and so on, followed by a newline, at the end of an existing file (create such a file if it does not exist yet)appendInfo (...) – write texts, numbers, vectors and so on, to the Info windowappendInfoLine (...) – write texts, numbers, vectors and so on, followed by a newline, to the Info windowappMonth ( ) – the month in which the present version of Praat was built (between 1 and 12)appMonth$ ( ) – the name of the month (in English) in which the present version of Praat was builtappVersion ( ) – the number of the present version of PraatappVersion$ ( ) – the present version of Praat, as textappYear ( ) – the year in which the present version of Praat was builtarccos (x) – inverse cosinearccos# (vector#) – inverse cosine of each element of vector#arccos## (matrix##) – inverse cosine of each cell of matrix##arccosh (x) – inverse hyperbolic cosinearccosh# (vector#) – inverse hyperbolic cosine of each element of vector#arccosh## (matrix##) – inverse hyperbolic cosine of each cell of matrix##arcsin (x) – inverse sinearcsin# (vector#) – inverse sine of each element of vector#arcsin## (matrix##) – inverse sine of each cell of matrix##arcsinh (x) – inverse hyperbolic sinearcsinh# (vector#) – inverse hyperbolic sine of each element of vector#arcsinh## (matrix##) – inverse hyperbolic sine of each cell of matrix##arctan (x) – inverse tangentarctan# (vector#) – inverse tangent of each element of vector#arctan## (matrix##) – inverse tangent of each cell of matrix##arctan2 (y, x) – argument anglearctanh (x) – inverse hyperbolic tangentarctanh# (vector#) – inverse hyperbolic tangent of each element of vector#arctanh## (matrix##) – inverse hyperbolic tangent of each cell of matrix##assert condition – condition checkingasserterror message$ – testing that a certain error occursasynchronous – let the script continue while the sound is playingbackslashTrigraphsToUnicode$ (string$) – convert e.g. \ct to ɔbarkToHertz (x) – from Bark-rate to acoustic frequencybesselI (n, x) – modified Bessel function of the first kind, InbesselK (n, x) – modified Bessel function of the second kind, Knbeta (x, y) – β functionbetween_by# (low, high, step) – symmetrically dispersed numbers between low and high, in steps of stepbetween_count# (low, high, n) – n symmetrically dispersed numbers between low and high (bin centres)binomialP (p, k, n) – probability of Bernoulli event occurring at most k in n timesbinomialQ (p, k, n) – probability of Bernoulli event occurring at least k in n timesceiling (x) – round up to integerceiling# (vector#) – round up each element of vector#ceiling## (matrix##) – round up each cell of matrix##center (v#) – center (or centre) of gravitychiSquareP (chiSquare, df) – area under the χ2 curve up to chiSquarechiSquareQ (chiSquare, df) – area under the χ2 curve after chiSquarechooseFolder$ (title$) – pops up a folder selection windowchooseReadFile$ (title$) – pops up a file selection window for opening (or appending to) an existing filechooseWriteFile$ (title$, defaultFilename$) – pops up a file selection window for saving to a new fileclearinfo – clear the Info windowclock ( ) – typically the number of seconds since system start-upcol – the columns number (of the current cell) in a Formula commandcol$ [i] – the name of column i of an objectcol# (matrix##, columnNumber) - extract one column from a matrixcolumnSums# (matrix##)combine# (...) - combine numbers, vectors and matrices into a new vectorcorrelation (u#, v#) – correlation (between −1 and +1) of two vectorscos (x) – cosinecos# (vector#) – cosine of each element of vector#cos## (matrix##) – cosine of each cell of matrix##cosh (x) – hyperbolic cosinecosh# (vector#) – hyperbolic cosine of each element of vector#cosh## (matrix##) – hyperbolic cosine of each cell of matrix##createFolder (folderPath$) – create a new folder, or do nothing if it already existsdate$ ( ) – current local date and time in the form "Mon Nov 8 16:32:42 2021"date_iso$ ( ) – current local date and time in the form "2021-11-08T16:32:42+01:00"date# ( ) – current local date and time in the form { 2021, 11, 8, 16, 32, 42 }date_utc$ ( ) – current standard date and time in the form "Mon Nov 8 15:32:42 2021"date_utc_iso$ ( ) – current standard date and time in the form "2021-11-08T15:32:42Z"date_utc# ( ) – current standard date and time in the form { 2021, 11, 8, 15, 32, 42 }deleteFile (filePath$) – delete a file, or do nothing if it does not existdemo – execute a graphics command in the Demo window (instead of in the Picture window)demoClicked ( ) – determine whether the user clicked in the Demo windowdemoClickedIn (xmin, xmax, ymmin, ymax) – determine whether the user clicked in a rectangular region in the Demo windowdemoCommandKeyPressed ( ) – determine whether the user pressed the Command key when they typed into the Demo windowdemoInput (characters$) – determine whether the user typed (or clicked) the specified characters into the Demo windowdemoKey$ ( ) – determine the key that the user typed into the Demo windowdemoKeyPressed ( ) – determine whether the user typed anything into the Demo windowdemoOptionKeyPressed ( ) – determine whether the user pressed the Option key when they typed into the Demo windowdemoPeekInput ( ) – see whether a user event (click or key press) is available in the Demo windowdemoShiftKeyPressed ( ) – determine whether the user pressed the Shift key when they typed into the Demo windowdemoShow ( ) – make all deferred drawing commands immediately visibledemoWaitForInput ( ) – wait for a user event (click or key press) in the Demo windowdemoWindowTitle (newTitle$) – change the title of the Demo windowdemoX ( ) – the horizontal position of a mouse click in the Demo windowdemoY ( ) – the vertical position of a mouse click in the Demo windowdifferenceLimensToPhon (x) – from jnd-scale to perceptual loudnessdx – the horizontal distance between cells (i.e. the distance between columns) of an objectdy – the vertical distance between cells (i.e. the distance between rows) of an objecteditor (editor($)) – enter the environment of an editor (by number or by name)empty$# (numberOfStrings) – create an array of empty stringsendeditor – leave the environment of an editorendproc – end a procedure definitionendsWith (string$, part$) – determine whether string$ ends in part$endsWith_caseInsensitive (string$, part$) – determine whether string$ ends in part$environment$ (string$) – look up a system environment stringerb (f) – equivalent rectangular bandwidth for frequency ferbToHertz (x) – from ERB-rate to acoustic frequencyerf (x) – error function, the integral of the Gaussianerfc (x) – complement of the error function, i.e. 1 − erf (x); this is a separate function because erf (x) can be close to 1exitScript (...) – show a message that tells the user why the script will be interruptedexp (x) – exponentiation, i.e. exexp# (vector#) – exponentiate each element of vector#exp## (matrix##) – exponentiate each cell of matrix##extractLine$ (string$, part$) – everything that comes after the first occurrence of part$ in string$extractNumber (string$, part$) – the first number after the first occurrence of part$% in %stringextractWord$ (string$, part$) – the first “word” after the first occurrence of part$% in %stringfileNames$# (folderNameOrPattern$) – get the names (not the whole paths) of the files in a folder or that match a pattern with an asteriskfileNames_caseInsensitive$# (folderNameOrPattern$) – get the names (not the whole paths) of the files in a folder or that match a pattern with an asteriskfileReadable (filePath$) – 1 if the file exists and can be read, 0 otherwisefisherP (f, df1, df2) – area under the Fisher F curve up to ffisherQ (f, df1, df2) – area under the Fisher F curve after ffixed$ (number, precision) – format a number as a string, with precision digits after the decimal pointfixed$ (vector#, precision) – format a vector as a string, with all elements expressed in precision digits after the decimal pointfixed$ (matrix##, precision) – format a matrix as a string, with all cells expressed in precision digits after the decimal pointfloor (x) – round down to integerfloor# (vector#) – round down each element of vector#floor## (matrix##) – round down each cell of matrix##folderExists (folderPath$) – 1 if the folder exists and can be read, 0 otherwisefolderNames$# (folderNameOrPattern$) – get the names (not the whole paths) of the subfolders in a folder or that match a pattern with an asteriskfolderNames_caseInsensitive$# (folderNameOrPattern$) – get the names (not the whole paths) of the subfolders in a folder or that match a pattern with an asteriskfrom_to# (m, n) – the integers from m through nfrom_to_by# (m, n, step) – numbers from m through n, in steps of stepfrom_to_count# (start, end, n) – n numbers from start through endgaussP (z) – area under the normal curve up to zgaussQ (z) – area under the normal curve after zgoto – place in a script to jump fromhertzToBark (x) – from acoustic frequency to Bark-ratehertzToErb (x) – from acoustic frequency to ERB-ratehertzToMel (x) – from acoustic frequency to melhertzToSemitones (x) – from acoustic frequency to logarithmic scale re 100 Hzimax (x, ...) – location of the maximumimin (x, ...) – location of the minimumindex (string$, part$) – look up a substring, or 0 if not foundindex (strings$#, s$) – look up whether and where s$ first occurs in strings$index_caseInsensitive (string$, part$) – look up a substring, or 0 if not foundindex_caseInsensitive (strings$#, s$) – look up whether and where s$ first occurs in strings$index_regex (string$, regex$) – determine whether and where string$ first matches regex$inner (a#, b#) – inner productinvBinomialP (P, k, n) – inverse of binomialPinvBinomialQ (Q, k, n) – inverse of binomialQinvChiSquareQ (q, df) – inverse of chiSquareQinvFisherQ (q, df1, df2) – inverse of fisherQinvGaussQ (z) – inverse of gaussQinvSigmoid (x) – inverse sigmoidinvSigmoid# (vector#) – inverse sigmoid of each element of vector#invSigmoid## (matrix##) – inverse sigmoid of each cell of matrix##invStudentQ (q, df) – inverse studentQlabel – place in a script to jump toleft$ (string$, n) – the n first characters in string$length (string$) – number of Unicode characters in string$ln (x) – natural logarithm, base eln# (vector#) – natural logarithm of each element of vector#ln## (matrix##) – natural logarithm of each cell of matrix##lnGamma (x) – logarithm of the Γ functionlog2 (x) – logarithm, base 2log2# (vector#) – base-2 logarithm of each element of vector#log2## (matrix##) – base-2 logarithm of each cell of matrix##log10 (x) – logarithm, base 10log10# (vector#) – base-10 logarithm of each element of vector#log10## (matrix##) – base-10 logarithm of each cell of matrix##lowerCaseAppName$ ( ) – the name of the app in lower snake case, e.g. praat or praat_for_hospitalsmax (x, ...) – maximummean (v#) – average of the elements of a vectormelToHertz (x) – from mel to acoustic frequencymid$ (string$, from, n) – the n characters in string$ starting at position frommin (x, ...) – minimumminusObject (...) – shrink the selection of objects in the listmoveAndOrRenameFile (fromFilePath$, toFilePath$) – move and/or rename a file (note: supply two paths)mul## (a##, b##) – matrix multiplicationncol – the number of columns of an objectnrow – the number of rows of an objectnumber (a$) – interpret a string as a numbernumber# (a$#) – interpret strings as numbersnumberOfColumns (matrix##)numberOfRows (matrix##)nx – the number of cells horizontally (i.e. the number of columns) of an objectny – the number of cells vertically (i.e. the number of rows) of an objectouter## (a#, b#) – outer product, i.e. resultij = aibjpadLeft$ (string$, minimumNewWidth [, pad$]) – left paddingpadOrTruncateLeft$ (string$, newWidth [, pad$]) – left padding or truncationpadOrTruncateRight$ (string$, newWidth [, pad$]) – right padding or truncationpadRight$ (string$, minimumNewWidth [, pad$]) – right paddingpauseScript (...) – show a message in a simple pause windowpercent$ (number, precision) – format a number as a string, with a trailing percent sign and precision digits after the decimal pointphonToDifferenceLimens (x) – from perceptual loudness to jnd-scaleplusObject (...) – extend the selection of objects in the listprocedure: procedureName, ... – start a procedure definitionrandomBernoulli (p) – Bernoulli-distributed random deviate (0 or 1)randomBernoulli# (n, p) – n independent Bernoulli-distributed zeroes and onesrandomGamma (shape, rate) – gamma-distributed random deviaterandomGamma# (n, shape, rate) – n independent gamma-distributed random numbersrandomGamma# (vector#, shape, rate) – duplicate vector#, and replace all elements with independent gamma-distributed random numbersrandomGamma## (nrow, ncol, shape, rate) – nrow × ncol independent gamma-distributed random numbersrandomGamma## (matrix##, shape, rate) – duplicate matrix##, and replace all cells with independent gamma-distributed random numbersrandomGauss (mu, sigma) – normally distributed random deviaterandomGauss# (n, mu, sigma) – n independent normally distributed random numbersrandomGauss# (vector#, mu, sigma) – duplicate vector#, and replace all elements with independent normally distributed random numbersrandomGauss## (nrow, ncol, mu, sigma) – nrow × ncol independent normally distributed random numbersrandomGauss## (matrix##, mu, sigma) – duplicate matrix##, and replace all cells with independent normally distributed random numbersrandomInteger (min, max) – uniformly distributed integer random deviaterandomInteger# (n, min, max) – n independent uniformly distributed random integersrandomInteger# (vector#, min, max) – duplicate vector#, and replace all elements with independent uniformly distributed random integersrandomInteger## (nrow, ncol, min, max) – nrow × ncol independent uniformly distributed random integersrandomInteger## (matrix##, min, max) – duplicate matrix##, and replace all cells with independent uniformly distributed random integersrandomPoisson (mean) – Poisson-distributed random deviaterandomPoisson# (n, mean) – n independent Poisson-distributed random numbersrandomPoisson# (vector#, mean) – duplicate vector#, and replace all elements with independent Poisson-distributed random numbersrandomPoisson## (nrow, ncol, mean) – nrow × ncol independent Poisson-distributed random numbersrandomPoisson## (matrix##, mean) – duplicate matrix##, and replace all cells with independent Poisson-distributed random numbersrandomUniform (min, max) – uniformly distributed random deviaterandomUniform# (n, min, max) – n independent uniformly distributed random numbersrandomUniform# (vector#, min, max) – duplicate vector#, and replace all elements with independent uniformly distributed random numbersrandomUniform## (nrow, ncol, min, max) – nrow × ncol independent uniformly distributed random numbersrandomUniform## (matrix##, min, max) – duplicate matrix##, and replace all cells with independent uniformly distributed random numbersrandom_initializeSafelyAndUnpredictably ( ) – undoes the effects of the following functionrandom_initializeWithSeedUnsafelyButPredictably (seed) – reproducible sequence of random numbersreadFile (filePath$) – read a number from a text filereadFile$ (filePath$) – read a whole text file into a stringreadFile# (filePath$) – read a vector from a text filereadFile## (filePath$) – read a matrix from a text filereadLinesFromFile$# (filePath$) – read all lines from a text filerectify (x) – set to zero if negative (no change if positive)rectify# (vector#) – rectify each element of vector#rectify## (matrix##) – rectify each cell of matrix##removeObject (...) – remove objects from the list, by ID and/or namerepeat# (v#, n) – repeat the whole sequence of elements of v# n timesreplace$ (a$, b$, c$, n) – within a$, replace the first n occurrences of b$ with c$, or all if n = 0replace_regex$ (a$, b$, c$, n) – within a$, replace the first n matches of regular expression b$ with the regular expression c$, or all if n = 0right$ (string$, n) – the n last characters in string$rindex (string$, part$) – look up a substring from the end, or 0 if not foundrindex (strings$#, s$) – look up whether and where s$ last occurs in strings$#rindex_caseInsensitive (string$, part$) – look up a substring from the end, or 0 if not foundrindex_caseInsensitive (strings$#, s$) – look up whether and where s$ last occurs in strings$#rindex_regex (string$, regex$) – determine whether and where string$ last matches regex$round (x) – nearest integerround# (vector#) – nearest integer of each element of vector#round## (matrix##) – nearest integer of each cell of matrix##row – the row number (of the current cell) in a Formula commandrow$ [i] – the name of row i of an objectrow# (matrix##, rowNumber) - extract one row from a matrixrowSums# (matrix##)runScript (filePath$, ...) – run a script with the given argumentsrunSubprocess (executableFilePath$, ...) – run an external program with the given argumentsrunSubprocess$ (executableFilePath$, ...) – run an external program with the given arguments, and return its outputrunSystem (...) – run a system command line with the given arguments concatenatedrunSystem$ (...) – run a system command line with the given arguments concatenated, and return its outputselected ( ) – the ID of the topmost selected objectselected (i) – the ID of the ith selected object (as counted from the top, or from the bottom if negative)selected (type$) – the ID of the topmost selected object of type type$selected (type$, i) – the ID of the ith selected object of type type$ (as counted from the top, or from the bottom if negative)selected$ ( ) – the full name (type + given name) of the topmost selected objectselected$ (i) – the full name (type + given name) of the ith selected object (as counted from the top, or from the bottom if negative)selected$ (type$) – the given name of the topmost selected object of type type$selected$ (type$, i) – the given name of the ith selected object of type type$ (as counted from the top, or from the bottom if negative)selected# ( ) – the IDs of all selected objectsselected# (type$) – the IDs of all selected objects of type type$selected$# ( ) – the full names of all selected objectsselected$# (type$) – the given names of all selected objects of type type$selectObject (...) – select object(s) in the list by ID and/or full namesemitonesToHertz (x) – from logarithmic scale re 100 Hz to acoustic frequencysigmoid (x) – 1 / (1 + e-x)sigmoid# (vector#) – sigmoid of each element of vector#sigmoid## (matrix##) – sigmoid of each cell of matrix##sin (x) – sinesin# (vector#) – sine of each element of vector#sin## (matrix##) – sine of each cell of matrix##sinc (x) – sinus cardinalis: sin (x) / xsincpi (x) – sin (πx) / (πx)sinh (x) – hyperbolic sinesinh# (vector#) – hyperbolic sine of each element of vector#sinh## (matrix##) – hyperbolic sine of each cell of matrix##size (v#) – number of elementsshuffle# (vector#) – randomize ordershuffle$# (stringVector$#) – randomize ordersleep (duration) – pause script for duration secondssoftmax# (vector#)softmaxPerRow## (matrix##)solve# (a##, y#) – find x for which A · x = ysolve## (a##, y##) – find X for which A · X = YsolveNonnegative# (a##, y# [, x], maximumNumberOfIterations, tolerance, infoLevel)solveSparse# (a##, y# [, x], maximumNumberOfNonzeros, maximumNumberOfIterations, tolerance, infoLevel)solveWeaklyConstrained# (a##, y#, alpha, delta)sort# (vector#) – reshuffle in increasing ordersort$# (stringVector$#) – reshuffle in Unicode-alphabetical ordersort_numberAware$# (stringVector$#) – reshuffle in Unicode-alphabetical order, with special attention to numberssplitByWhitespace$# (string$) – split a string into inkssqrt (x) – square rootsqrt# (vector#) – square root of each element of vector#sqrt## (matrix##) – square root of each cell of matrix##startsWith (string$, part$) – determine whether string$ starts with part$startsWith_caseInsensitive (string$, part$) – determine whether string$ starts with part$stdev (v#) – standard deviation of the elements of a vectorstopwatch – give the current value of the timer, which is then immediately reset to zero (note: no parentheses)string$ (number) – format a number as a stringstudentP (t, df) – area under the Student T curve up to tstudentQ (t, df) – area under the Student T curve after tsum (v#) – sum the elementssumOver (loopVariable to n, numericExpressionOptionallyUsingLoopVariable) – Σtan (x) – tangenttan# (vector#) – tangent of each element of vector#tan## (matrix##) – tangent of each cell of matrix##tanh (x) – hyperbolic tangenttanh# (vector#) – hyperbolic tangent of each element of vector#tanh## (matrix##) – hyperbolic tangent of each cell of matrix##to# (n) – the integers 1 through ntranspose## (matrix##) – flip matrix along its diagonaltruncateLeft$ (string$, newMaximumWidth [, pad$]) – left truncation of string$truncateRight$ (string$, newMaximumWidth [, pad$]) – right truncation of string$tryToAppendFile (filePath$) – check whether a file can be appended totryToWriteFile (filePath$) – check whether a file can be written (destructive!)unicode (c$) – the Unicode codepoint number that corresponds to character c$unicode$ (n) – the character that corresponds to Unicode codepoint nunicodeToBackslashTrigraphs$ (string$) – convert e.g. ɔ to \ctupperCaseAppName$ ( ) – the name of the app in upper camel case, e.g. Praat or PraatForHospitalsvariableExists (variableName$) – does the variable variableName$ exist?vertical$ (stringArray$#) – format a string array verticallywriteFile (filePath$, ...) – create a new text file, and write texts, numbers, vectors and so on into itwriteFileLine (filePath$, ...) – create a new text file, write texts, numbers, vectors and so on into it, followed by a newlinewriteInfo (...) – write texts, numbers, vectors and so on, to a clear Info windowwriteInfoLine (...) – write texts, numbers, vectors and so on, followed by a newline, to a clear Info windowx – the horizontal place (in world coordinates) of the current cell in a Formula commandxmax – the top of the horizontal domain of an objectxmin – the bottom of the horizontal domain of an objecty – the vertical place (in world coordinates) of the current cell in a Formula commandymax – the top of the vertical domain of an objectymin – the bottom of the vertical domain of an objectzero# (n) – vector with n elements that are all 0zero## (nrow, ncol) – matrix with nrow × ncol elements that are all 0© Paul Boersma 2022-2024