find_noise: Detect energy peaks in recordings with non-relevant events

View source: R/find_noise.R

find_noiseR Documentation

Detect energy peaks in recordings with non-relevant events

Description

Detects the temporal position of the desired number of energy peaks in a recording exclusively with non-relevant events.

Usage

find_noise(recording, nmax = 1, plot = FALSE)

Arguments

recording

Object of class "rc".

nmax

Integer indicating the maximum number of peaks to detect in the recording.

plot

Logical. If TRUE a plot showing the peak(s) is returned.

Value

A vector with the temporal position of the identified peak(s), in samples.

Author(s)

Bruno Silva

Examples

# Create a sample wav file in a temporary directory
recording <- tuneR::noise(duration = 44100)
temp_dir <- tempdir()
rec_path <- file.path(temp_dir, "recording.wav")
tuneR::writeWave(recording, filename = rec_path)
# Import the sample wav file
new_rec <- import_audio(rec_path, butt = FALSE, tx = 1)
find_noise(new_rec, nmax = 1, plot = FALSE)
file.remove(rec_path)

soundClass documentation built on May 30, 2022, 1:07 a.m.