Making Binary Point Templates
These examples explore the function arguments. You can also read the article.
Get clip, write to file
data(btnw)
tuneR::writeWave(btnw, 'btnw.wav')
Change amp.cutoff
template <- makeBinTemplate('btnw.wav', amp.cutoff = -45)
plot(template)
template <- makeBinTemplate('btnw.wav', amp.cutoff = -25)
plot(template)
Automatic point selection
Automatic is the default because it does not require interactivity and allows the package vignette and examples to build. In general use it is unlikely that users will build the most effective templates with the “auto” option.
template <- makeBinTemplate('btnw.wav', amp.cutoff=-35)
plot(template)
Change select to ‘rectangle’
template <- makeBinTemplate('btnw.wav', select='rectangle', amp.cutoff=-35)
Change select to ‘cell’
template <- makeBinTemplate('btnw.wav', select='cell', amp.cutoff=-35)
Change time limits
template <- makeBinTemplate('btnw.wav', t.lim = c(0.75, 2.25), amp.cutoff = -35)
plot(template)
Change frequency limits
template <- makeBinTemplate('btnw.wav', frq.lim = c(3, 7), amp.cutoff = -35)
plot(template)
Change buffer
template <- makeBinTemplate('btnw.wav', buffer = 4, amp.cutoff = -35)
plot(template)
Change selection density
template <- makeBinTemplate('btnw.wav', dens = 0.4, amp.cutoff = -35)
plot(template)
Change FFT parameters
template <- makeBinTemplate('btnw.wav', wl = 1024, ovlp = 75, amp.cutoff = -35)
plot(template)
Change template name
template <- makeBinTemplate('btnw.wav', name='btnw_typeB_5kHz', amp.cutoff = -35)
plot(template)
Intersection of two clips
btnw_2 <- c('btnw.wav', 'btnw2.wav')
viewSpec(btnw_2[1]) # The clip that comes with the package
viewSpec(btnw_2[2]) # Another song, ~800Hz higher frequency
template <- makeBinTemplate(btnw_2, t.lim = list(c(0.75, 2.25),c(1.5, 3.5)), frq.lim = c(3, 8), amp.cutoff = -35)
## Interactive clip alignment.
## Enter l, ll, ll, etc. for left shift,
## r, rr, rrr, etc. for right shift,
## or Enter to continue.
ll
lll
l
plot(template)
Combine templates
template1 <- makeBinTemplate('btnw.wav', name='btnw_typeB_5kHz', amp.cutoff = -35)
template2 <- makeBinTemplate('btnw2.wav', name='btnw_typeB_5.8kHz', amp.cutoff = -35)
templates <- combineBinTemplates(template1, template2)
plot(templates, ask=FALSE)