Contributing to pladdrr
Source:.github/CONTRIBUTING.md
Thanks for taking the time to contribute. This document covers what you need to know to get a working build, because pladdrr is not a pure-R package: it compiles a curated subset of the Praat C++ sources and exposes them through Rcpp modules.
Everyone participating is expected to follow the Code of Conduct.
Ways to contribute
-
Bug reports — open an issue at https://github.com/humlab-speech/pladdrr/issues. Please include a reprex, the output of
sessionInfo(), and — if the bug is a numeric discrepancy — the equivalent Praat script and the value Praat produces. Faithfulness to Praat is the package’s core contract, so a Praat reference value turns a vague report into a fixable one. - Feature requests — open an issue describing the Praat functionality you need. Praat object types that are not yet wrapped generally require new C++ wrapper code; say which Praat menu commands or functions you are after.
- Pull requests — see below.
Please open an issue before starting a large pull request, so we can agree on the approach before you invest the effort.
Setting up a development environment
1. Clone
Both src/praat.github.io/ (the vendored Praat sources) and src/pocketfft/ (the FFT backend) are ordinary tracked directories, not git submodules. A plain clone or remotes::install_github() pulls in everything needed to build.
Things that will bite you
-
src/Makevarsis generated. Theconfigurescript regenerates it fromsrc/Makevars.inon every install. Always edit both files, or your change will silently disappear on the next install. Windows uses a separate, hand-maintainedsrc/Makevars.win; keep it in sync too. -
-ffp-contract=offis deliberate. It disables floating-point FMA contraction so compiled DSP routines reproduce Praat’s output bit-for-bit. Do not remove it as an “optimisation”. -
Do not define
__APPLE__-style macros globally. Praat uses themacintoshmacro; defining it globally pulls in Objective-C headers. -
Benchmarks must be run against a release build.
devtools::load_all()compiles at-O0, which makes every timing 2–7x slower than reality.
Making changes
Create a branch off
main.Write or update tests in
tests/testthat/. Anything touching a numeric result also needs a faithfulness assertion — seetests/testthat/test-praat-faithfulness.Randtests/testthat/faithfulness/.-
Document exported functions with roxygen2 comments, then regenerate:
devtools::document()Never hand-edit
NAMESPACEor files inman/. Add a bullet to
NEWS.mdunder a new or existing top heading, describing the change from the user’s point of view.-
Run the checks:
devtools::test()Note that
R CMD checkmust be run on the built tarball, not on the source directory — checking the directory reports a spurious “Required fields missing: Author, Maintainer”, because those fields are generated fromAuthors@Rat build time. Open the pull request against
main. CI runsR CMD checkon Linux, macOS, and Windows, plus test coverage.
Code style
- Follow the tidyverse style guide: snake_case for functions and arguments,
<-for assignment, two-space indentation. Praat object classes keep their upstream CamelCase names (Sound,TextGrid,KlattGrid) so that Praat scripts translate readably. - Keep user-facing output in
message()/warning()so it can be suppressed.cat()belongs inprint.*andformat.*methods only. - Do not modify global state from package code — no
options(), noSys.setenv(), no writing outsidetempdir().
Third-party code
Changes under src/praat.github.io/ and src/pocketfft/ are vendored upstream sources. Patches there must be recorded in inst/PRAAT_MODIFICATIONS.md so the delta against upstream stays auditable, and any new bundled component must be added to inst/COPYRIGHTS and to the cph entries in Authors@R.
Release checklist
- Bump
VersionandDateinDESCRIPTION, and the version ininst/CITATIONandCITATION.cff. - Regenerate
codemeta.json(codemetar::write_codemeta()). - Move the released section of
NEWS.mdand archive older entries inNEWS-archive.md. - Update
cran-comments.mdwith the current check results.