writeClickWave: Write Click Waveform

Description Usage Arguments Details Value Author(s) Examples

View source: R/writeClickWave.R

Description

Write a wave file for a synthesized delphinid click

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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

1
2
3
4
5
6
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 Oct. 8, 2021, 9:08 a.m.