writeClickWave: Write Click Waveform

View source: R/writeClickWave.R

writeClickWaveR Documentation

Write Click Waveform

Description

Write a wave file for a synthesized delphinid click

Usage

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
)

Arguments

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)

Details

This code is based on Matlab code by Julie Oswald (2004). Clicks are simulated as an exponentially damped sinusoid.

Value

writeClickWave invisibly returns the file name, createClickWave returns a Wave class object

Author(s)

Taiki Sakai taiki.sakai@noaa.gov

Examples


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)


PAMmisc documentation built on June 22, 2024, 9:37 a.m.