Creates a Pitch object using the new Rcpp Modules architecture. This is the constructor function for Pitch objects in pladdrr 2.0.
Details
Pitch objects are typically created via `Sound$to_pitch()` rather than directly. The returned object provides methods for querying pitch values, statistics, and conversions.
Methods
- `get_value_at_time(time, unit, interpolate)`
Get pitch at time
- `get_mean(from_time, to_time, unit)`
Get mean pitch
- `get_standard_deviation(from_time, to_time, unit)`
Get pitch SD
- `get_minimum(from_time, to_time, unit, interpolate)`
Get min pitch
- `get_maximum(from_time, to_time, unit, interpolate)`
Get max pitch
- `count_voiced_frames()`
Count voiced frames
- `as_data_frame(include_strength, include_intensity)`
Convert to data.frame
Properties
- `duration`
Duration in seconds
- `nx`
Number of frames
- `dx`
Time step between frames
- `xmin`, `xmax`
Start and end times
- `ceiling`
Pitch ceiling (Hz)
Examples
sound <- Sound$create_tone(frequency = 150, duration = 0.5)
pitch <- sound$to_pitch()
# Properties
pitch$duration
#> function (...)
#> method(x, ...)
#> <bytecode: 0x557399060af8>
#> <environment: 0x55739d344ba8>
pitch$nx
#> function (...)
#> method(x, ...)
#> <bytecode: 0x557399060af8>
#> <environment: 0x55739d37bb18>
# Query methods
pitch$get_mean(0, 0, "hertz") # Mean F0 in Hz
#> [1] 150.0017
pitch$count_voiced_frames()
#> [1] 47
# Export
df <- pitch$as_data_frame(FALSE, FALSE)