View source: R/writeClickWave.R
writeClickWave | R Documentation |
Write a wave file for a synthesized delphinid click
writeClickWave(
fileName,
outDir,
signalLength,
clickLength,
clicksPerSecond,
frequency,
sampleRate,
silence = c(0, 0),
gainFactor = 0.1
)
createClickWave(
signalLength,
clickLength,
clicksPerSecond,
frequency,
sampleRate,
silence = c(0, 0),
gainFactor = 0.1
)
fileName |
name of the file to write. If missing, the file be named usign signalLength, clickLength, clicksPerSecond, frequency, and sampleRate |
outDir |
directory to write wave files to |
signalLength |
length of signal to create in seconds |
clickLength |
length of each click in microseconds |
clicksPerSecond |
number of clicks per second |
frequency |
frequency of the clicks |
sampleRate |
sample rate for the wave file to create |
silence |
silence to pad before and after signal in seconds |
gainFactor |
scaling factor between 0 and 1. Low numbers are recommended (default 0.1) |
This code is based on Matlab code by Julie Oswald (2004). Clicks are simulated as an exponentially damped sinusoid.
writeClickWave
invisibly returns the file name, createClickWave
returns a Wave class object
Taiki Sakai taiki.sakai@noaa.gov
tmpFile <- file.path(tempdir(), 'tempWav.wav')
writeClickWave(tmpFile, signalLength = 1, clickLength = 100, clicksPerSecond = 200,
frequency = 30000, sampleRate = 100000)
file.remove(tmpFile)
clickWave <- createClickWave(signalLength = 1, clickLength = 100, clicksPerSecond = 200,
frequency = 30e3, sampleRate = 100e3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.