search_openresult_inpraat: Open a search result in 'Praat'

View source: R/search_openresult_inpraat.R

search_openresult_inpraatR Documentation

Open a search result in 'Praat'

Description

The function remote controls 'Praat' by using 'sendpraat' and a 'Praat' script. It opens a search result in the 'Praat' TextGrid Editor.

Usage

search_openresult_inpraat(
  x,
  s,
  resultNr,
  play = TRUE,
  closeAfterPlaying = FALSE,
  filterMediaFile = c(".*\\.(aiff|aif|wav)", ".*\\.mp3"),
  delayBeforeOpen = 0.5
)

Arguments

x

Corpus object.

s

Search object.

resultNr

Integer; Number of the search result (row in the data frame s@results) to be played.

play

Logical; If TRUE selection will be played.

closeAfterPlaying

Logical; If TRUE TextGrid editor will be closed after playing (Currently non functional!)

filterMediaFile

Vector of character strings; Each element of the vector is a regular expression. Expressions will be checked consecutively. The first match with an existing media file will be used for playing. The default checking order is uncompressed audio > compressed audio.

delayBeforeOpen

Double; Time in seconds before the section will be opened in Praat. This is useful if Praat opens but the section does not. In that case increase the delay.

Details

To make this function work you need to do two things first:

  • Install 'sendpraat' on your computer. To do so follow the instructions in the vignette 'installation-sendpraat'. Show the vignette with vignette("installation-sendpraat").

  • Set the path to the 'sendpraat' executable correctly by using 'options(act.path.sendpraat = ...)'.

Examples

library(act)

mysearch <- act::search_new(x=examplecorpus, pattern = "pero")

# You can only use this functions if you have installed and 
# located the 'sendpraat' executable properly in the package options.
## Not run: 
act::search_openresult_inpraat(x=examplecorpus, s=mysearch, resultNr=1, TRUE, TRUE)

## End(Not run)

act documentation built on June 7, 2023, 6:16 p.m.