Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3c19dc9
Showing
81 changed files
with
9,294 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Package: praatpicture | ||
Title: 'Praat Picture' Style Plots of Acoustic Data | ||
Version: 1.0.0 | ||
Authors@R: | ||
person("Rasmus", "Puggaard-Rode", | ||
email = "r.puggaard@phonetik.uni-muenchen.de", | ||
role = c("aut", "cre", "cph"), | ||
comment = c(ORCID = "0000-0003-4522-9987")) | ||
Description: Quickly and easily generate plots of acoustic data aligned with transcriptions similar to those made in 'Praat' using either derived signals generated directly in R with 'wrassp' or imported derived signals from 'Praat'. Provides easy and fast out-of-the-box solutions but also a high extent of flexibility. Also provides options for embedding audio in figures and animating figures. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
RoxygenNote: 7.2.3 | ||
Imports: av (>= 0.9.0), crayon (>= 1.5.2), emuR (>= 2.4.2), gifski (>= | ||
1.12.0.2), graphics (>= 4.3.2), grDevices (>= 4.3.2), gsignal | ||
(>= 0.3.5), ipa (>= 0.1.0), phonTools (>= 0.2.2.2), rPraat (>= | ||
1.3.2.1), rstudioapi (>= 0.15.0), soundgen (>= 2.6.2), tuneR | ||
(>= 1.4.6), utils (>= 4.3.2), wrassp (>= 1.0.4) | ||
URL: https://github.com/rpuggaardrode/praatpicture | ||
BugReports: https://github.com/rpuggaardrode/praatpicture/issues | ||
NeedsCompilation: no | ||
Packaged: 2024-02-24 12:54:36 UTC; rasmu | ||
Author: Rasmus Puggaard-Rode [aut, cre, cph] | ||
(<https://orcid.org/0000-0003-4522-9987>) | ||
Maintainer: Rasmus Puggaard-Rode <r.puggaard@phonetik.uni-muenchen.de> | ||
Repository: CRAN | ||
Date/Publication: 2024-03-07 09:40:02 UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
YEAR: 2023 | ||
COPYRIGHT HOLDER: praatpicture authors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
f0c96ebda03268b4fe79d6ebc0898bb6 *DESCRIPTION | ||
f57034ff052bdb61a2a9f5188e57b1a5 *LICENSE | ||
6f94fbe2bb1cba64b5434baac3cf74e0 *NAMESPACE | ||
d8ad7ece1d598fe676a3f154d2a64b91 *NEWS.md | ||
da3a347438c7b61caa49c09f2d8e8b4a *R/conv2sc.R | ||
d0fb66fe1607bbb4e44063dfe0a78708 *R/draw_arrow.R | ||
aaa376dfc78e354b652f70033838f875 *R/draw_rectangle.R | ||
2e70bdaed578f2f9790a339482784e99 *R/emupicture.R | ||
0a431164449b9e65a85e6417233722e9 *R/formantplot.R | ||
bf5160a281c7860ba43d9aa31ebfbe0f *R/intensityplot.R | ||
e99936293a13c718b280d007f34e2499 *R/make_TextGrid.R | ||
0f6b63571beadb2c7f68cd65ac6a8359 *R/make_annot.R | ||
2e75f2584018674c8812162b5c47a985 *R/pitchplot.R | ||
081037cf65f504db63248ddd329c0ee7 *R/praatanimation.R | ||
75bb3fc65719b0128c808bd01f8c3def *R/praatpicture.R | ||
d3e5dbca801e66957d4f2d1d7aea9dae *R/specplot.R | ||
41fc827a982e9cc138247c6f6fd49523 *R/talking_praatpicture.R | ||
6cbc37be0411b759635c85a77c78e598 *R/tg_createTier.R | ||
a6c30fbda32ab4fd7a2bc9948164397e *R/tg_stylize.R | ||
601c673bcf54ae1434106bfc6483d23d *R/tgplot.R | ||
9d38c5c2332581c65b713ea32ae6d2f8 *R/waveplot.R | ||
68623fee712819ab1f8e169bb9ef43af *README.md | ||
8e4370f22a3c01dcc5d89ea028377df0 *inst/extdata/1.Formant | ||
2c4cb1bb6fb7d02c2c5874d26ed52d24 *inst/extdata/1.IntensityTier | ||
c0bc92747b44b3ded08bf6aa9ddf0656 *inst/extdata/1.PitchTier | ||
9ee0ffb3e2bfe34bda2b07edc0d928e6 *inst/extdata/1.TextGrid | ||
1f0df1fcaaaf31e986909fb7ce0204e6 *inst/extdata/1.wav | ||
ae2ea2569e89b68d74098f27a006f315 *inst/extdata/2.wav | ||
2afe6d07c1c283d7dddbf811398670af *inst/extdata/3.TextGrid | ||
1f0df1fcaaaf31e986909fb7ce0204e6 *inst/extdata/3.wav | ||
dd69f39f46f1019319a394c87117d4cb *man/conv2sc.Rd | ||
1810e2fd477c3c019f61e013285ece8a *man/draw_arrow.Rd | ||
4dc0b0ce5deffa92cba74fb3f3f3ab64 *man/draw_rectangle.Rd | ||
c63cace69f736735e50670af40f2d22b *man/emupicture.Rd | ||
0a040716a833e0daadc6620557217d9a *man/figures/README-unnamed-chunk-10-1.png | ||
56816737af0df1137d64bda39f184027 *man/figures/README-unnamed-chunk-11-1.png | ||
47b3459d371de8ca67789c86bde605fc *man/figures/README-unnamed-chunk-12-1.png | ||
76d6807431b1ad42d6a887f5fcd1fad0 *man/figures/README-unnamed-chunk-13-1.png | ||
e7250f9a5827695db7caa47f8cd2a6e4 *man/figures/README-unnamed-chunk-14-1.png | ||
fa337688e4df12db599d297ebfff888a *man/figures/README-unnamed-chunk-15-1.png | ||
0eba73f86456aece2ad91758cb4ffbdd *man/figures/README-unnamed-chunk-16-1.png | ||
d752bb7e780cef1fdd29072cdf45700a *man/figures/README-unnamed-chunk-17-1.png | ||
09a3005f6eda2cdedb2d0365ceefec9c *man/figures/README-unnamed-chunk-18-1.png | ||
c72d72a742629a647fd5a0a1c3dd073b *man/figures/README-unnamed-chunk-19-1.png | ||
4cb510078d6e95d22b3f12b831bb6389 *man/figures/README-unnamed-chunk-20-1.png | ||
047d52d3e59420ade1137be027cec856 *man/figures/README-unnamed-chunk-21-1.png | ||
a0685b39fbe833180d37e7370bb79d9a *man/figures/README-unnamed-chunk-22-1.png | ||
6c6f5ab9661f1b7205cb3fe1e6376cb7 *man/figures/README-unnamed-chunk-23-1.png | ||
35562c56ff910beef7f857ce1b425962 *man/figures/README-unnamed-chunk-24-1.png | ||
51172744d61513e65b97825c56fb3b13 *man/figures/README-unnamed-chunk-25-1.png | ||
f735f6956af2a82bbf6be728359a5baf *man/figures/README-unnamed-chunk-26-1.png | ||
babc6f009edd1e03013d0896219e1d79 *man/figures/README-unnamed-chunk-27-1.png | ||
d34ab5979332dc64ab6ab42ea45d5d6d *man/figures/README-unnamed-chunk-28-1.png | ||
c20c65701a74e94da71c098516641d1f *man/figures/README-unnamed-chunk-29-1.png | ||
28aa7d0c1070f2c4ef8df584146c9957 *man/figures/README-unnamed-chunk-30-1.png | ||
2eeab02c31459ced056d9db4b94684f8 *man/figures/README-unnamed-chunk-31-1.png | ||
60eb54cc0c9af572dc188f9091a2b9d8 *man/figures/README-unnamed-chunk-32-1.png | ||
5b387dbf8bb1938275502913f22afc30 *man/figures/README-unnamed-chunk-34-1.png | ||
3f862df1dc4ad9cf0f43e6ee8ce53f13 *man/figures/README-unnamed-chunk-35-1.png | ||
f350e26b428050ee84c703f4da115786 *man/figures/README-unnamed-chunk-36-1.png | ||
5d188445cc5bf28ce046421f1278f15f *man/figures/README-unnamed-chunk-37-1.png | ||
aa02f0886fd8ded94700c0261fb3844e *man/figures/README-unnamed-chunk-4-1.png | ||
868a25b4100cca15d696136f26a62b38 *man/figures/README-unnamed-chunk-5-1.png | ||
86f7f47a9e50e4cd157ae9cfa89d8d57 *man/figures/README-unnamed-chunk-6-1.png | ||
074538154972b7795a4182dd79efb1a1 *man/figures/README-unnamed-chunk-7-1.png | ||
788695af0271af75fbdf6ec9336d8d87 *man/figures/README-unnamed-chunk-8-1.png | ||
57875f670d8ecc5af69a2c286ec20334 *man/figures/README-unnamed-chunk-9-1.png | ||
c83503123d22b27ae36a35b42ba20cb6 *man/formantplot.Rd | ||
7d6d55bdffc94f1f1826d3b27076b69f *man/intensityplot.Rd | ||
6e72acf8a7096fab75e056d72de5cead *man/make_TextGrid.Rd | ||
f800a96b066aff5be56fd88521a137f8 *man/make_annot.Rd | ||
58ad183d360559c7fc1dff96ebcfeaa4 *man/pitchplot.Rd | ||
ee0f96502c1629295ec29d2df946864b *man/praatanimation.Rd | ||
35d56ffaaf01bcebbd9bc824e77cce8c *man/praatpicture.Rd | ||
315fce9333c85a2b5d3e6ea7cd205889 *man/specplot.Rd | ||
34a179bda0924dbce0279d5994ed6fce *man/talking_praatpicture.Rd | ||
ba60d13b83432e16883802cf484833c5 *man/tg_createTier.Rd | ||
e7f553ca1a55b558cc7d4de7c8f54af1 *man/tg_stylize.Rd | ||
0d2a2b22c68f4796f88ab7e1941a39a7 *man/tgplot.Rd | ||
b7350f0cb6d237482b23e597c2a33828 *man/waveplot.Rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(conv2sc) | ||
export(draw_arrow) | ||
export(draw_rectangle) | ||
export(emupicture) | ||
export(formantplot) | ||
export(intensityplot) | ||
export(make_TextGrid) | ||
export(make_annot) | ||
export(pitchplot) | ||
export(praatanimation) | ||
export(praatpicture) | ||
export(specplot) | ||
export(talking_praatpicture) | ||
export(tg_createTier) | ||
export(tg_stylize) | ||
export(tgplot) | ||
export(waveplot) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# praatpicture 1.0.0 | ||
|
||
# praatpicture 0.6.1 | ||
|
||
* Initial CRAN submission. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#' Convert capital letters to Unicode small caps | ||
#' | ||
#' Helper function to convert capital letters into Unicode small caps. | ||
#' May not work for all font families. Note that there's no Unicode small cap | ||
#' 'X', so 'X' will just be converted to 'x'. | ||
#' | ||
#' @param x A string where all capital letters should be converted to small | ||
#' caps. | ||
#' | ||
#' @return A string where all capital letters have been converted to small caps. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' my_string <- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | ||
#' conv2sc(my_string) | ||
conv2sc <- function(x) { | ||
x <- gsub('A', '\u1d00', x) | ||
x <- gsub('B', '\u0299', x) | ||
x <- gsub('C', '\u1d04', x) | ||
x <- gsub('D', '\u1d05', x) | ||
x <- gsub('E', '\u1d07', x) | ||
x <- gsub('F', '\u0493', x) | ||
x <- gsub('G', '\u0262', x) | ||
x <- gsub('H', '\u029c', x) | ||
x <- gsub('I', '\u026a', x) | ||
x <- gsub('J', '\u1d0a', x) | ||
x <- gsub('K', '\u1d0b', x) | ||
x <- gsub('L', '\u029f', x) | ||
x <- gsub('M', '\u1d0d', x) | ||
x <- gsub('N', '\u0274', x) | ||
x <- gsub('O', '\u1d0f', x) | ||
x <- gsub('P', '\u1d18', x) | ||
x <- gsub('Q', '\u01eb', x) | ||
x <- gsub('R', '\u0280', x) | ||
x <- gsub('S', '\ua731', x) | ||
x <- gsub('T', '\u1d1b', x) | ||
x <- gsub('U', '\u1d1c', x) | ||
x <- gsub('V', '\u1d20', x) | ||
x <- gsub('W', '\u1d21', x) | ||
x <- gsub('X', 'x', x) | ||
x <- gsub('Y', '\u028f', x) | ||
x <- gsub('Z', '\u1d22', x) | ||
return(x) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#' Draw arrow on praatpicture plot component | ||
#' | ||
#' Helper function for drawing arrows on plot components made with | ||
#' praatpicture. Do not use directly, instead use [praatpicture] with the | ||
#' `draw_arrow` argument. | ||
#' | ||
#' @param plot_component String giving the name of the plot component to | ||
#' draw on. | ||
#' @param args A list of vectors giving arguments used for drawing | ||
#' arrows. See [praatpicture] documentation. | ||
#' | ||
#' @return No return values, called internally by [praatpicture] and sibling | ||
#' functions. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' # Don't use directly | ||
#' datapath <- system.file('extdata', package='praatpicture') | ||
#' soundFile <- paste0(datapath, '/1.wav') | ||
#' praatpicture(soundFile, draw_arrow=c('spectrogram', 0.1, 500, 0.4, 2000)) | ||
draw_arrow <- function(plot_component, args) { | ||
r <- which(sapply(args, '[[', 1) == plot_component) | ||
for (i in r) { | ||
params <- args[[i]] | ||
params <- as.list(params[2:length(params)]) | ||
for (p in 1:4) params[[p]] <- as.numeric(params[[p]]) | ||
do.call(eval(parse(text='graphics::arrows')), params) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#' Draw rectangle on praatpicture plot component | ||
#' | ||
#' Helper function for drawing rectangles on plot components made with | ||
#' praatpicture. Do not use directly, instead use [praatpicture] with the | ||
#' `draw_rectangle` argument. | ||
#' | ||
#' @param plot_component String giving the name of the plot component to | ||
#' draw on. | ||
#' @param args A list of vectors giving arguments used for drawing | ||
#' rectangles. See [praatpicture] documentation. | ||
#' | ||
#' @return No return values, called internally by [praatpicture] and sibling | ||
#' functions. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' # Don't use directly | ||
#' datapath <- system.file('extdata', package='praatpicture') | ||
#' soundFile <- paste0(datapath, '/1.wav') | ||
#' praatpicture(soundFile, draw_rectangle=c('spectrogram', 0.1, 500, 0.4, 2000)) | ||
draw_rectangle <- function(plot_component, args) { | ||
r <- which(sapply(args, '[[', 1) == plot_component) | ||
for (i in r) { | ||
params <- args[[i]] | ||
params <- as.list(params[2:length(params)]) | ||
do.call(eval(parse(text='graphics::rect')), params) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#' Make Praat Picture style plots in EMU | ||
#' | ||
#' Generate plots in the style of Praat Pictures from sound files and annotations | ||
#' in an EMU database. | ||
#' | ||
#' @param db_handle The handle of an EMU database loaded into R. | ||
#' @param session String giving the name of the session where the sound file | ||
#' to plot is located. | ||
#' Default is `0000`. | ||
#' @param bundle String giving the name of the bundle with the sound file to plot. | ||
#' @param pitch_ssffExt String giving the file extension for an SSFF track with | ||
#' pitch data to plot. Default is `NULL`. | ||
#' @param formant_ssffExt String giving the file extension for an SSFF track | ||
#' with formant data to plot. Default is `NULL`. | ||
#' @param intensity_ssffExt | ||
#' String giving the file extension for an SSFF track with intensity data to | ||
#' plot. Default is `NULL`. | ||
#' @param ... Further arguments passed to `praatpicture`. | ||
#' | ||
#' @seealso See [praatpicture] for more details on how to customize plots. | ||
#' @return No return value, produces a plot. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' \donttest{ | ||
#' # Create demo data and load demo database | ||
#' emuR::create_emuRdemoData(tempdir()) | ||
#' db_path <- paste0(tempdir(), '/emuR_demoData/ae_emuDB') | ||
#' db <- emuR::load_emuDB(db_path) | ||
#' | ||
#' emuR::list_bundles(db) | ||
#' emupicture(db, bundle='msajc003', tg_tiers=c('Text', 'Tone')) | ||
#' | ||
#' # Plot SSFF track data | ||
#' | ||
#' emuR::list_ssffTrackDefinitions(db) | ||
#' emupicture(db, bundle='msajc003', frames=c('sound', 'formant'), | ||
#' proportion=c(30,70), formant_ssffExt='fms') | ||
#' } | ||
emupicture <- function(db_handle, session='0000', bundle, | ||
pitch_ssffExt=NULL, formant_ssffExt=NULL, | ||
intensity_ssffExt=NULL, ...) { | ||
tg <- FALSE | ||
args <- list(...) | ||
if ('frames' %in% names(args) & 'TextGrid' %in% args$frames) tg <- TRUE | ||
if (!'frames' %in% names(args)) tg <- TRUE | ||
if (tg) { | ||
emuR::export_TextGridCollection(db_handle, targetDir='.', | ||
sessionPattern=session, | ||
bundlePattern=bundle, verbose=F) | ||
fn <- paste0(session, '/', bundle, '.wav') | ||
} else { | ||
fn <- paste0(db_handle$basePath, '/', session, '_ses/', bundle, '_bndl/', | ||
bundle, '.wav') | ||
} | ||
|
||
if (!is.null(pitch_ssffExt)) { | ||
pfn <- paste0(db_handle$basePath, '/', session, '_ses/', bundle, '_bndl/', | ||
bundle, '.', pitch_ssffExt) | ||
wpt <- wrassp::read.AsspDataObj(pfn) | ||
} else { | ||
wpt <- NULL | ||
} | ||
if (!is.null(formant_ssffExt)) { | ||
ffn <- paste0(db_handle$basePath, '/', session, '_ses/', bundle, '_bndl/', | ||
bundle, '.', formant_ssffExt) | ||
wft <- wrassp::read.AsspDataObj(ffn) | ||
} else { | ||
wft <- NULL | ||
} | ||
if (!is.null(intensity_ssffExt)) { | ||
ifn <- paste0(db_handle$basePath, '/', session, '_ses/', bundle, '_bndl/', | ||
bundle, '.', intensity_ssffExt) | ||
wit <- wrassp::read.AsspDataObj(ifn) | ||
} else { | ||
wit <- NULL | ||
} | ||
|
||
praatpicture(fn, tg_specialChar=FALSE, | ||
pitch_ssff=wpt, formant_ssff=wft, intensity_ssff=wit, ...) | ||
if (tg) unlink(session, recursive=T) | ||
} |
Oops, something went wrong.