beat | R Documentation |
Generates percussive sounds from clicks through drum-like beats to sliding
tones. The principle is to create a sine wave with rapid frequency modulation
and to add a fade-out. No extra harmonics or formants are added. For this
specific purpose, this is vastly faster and easier than to tinker with
soundgen
settings, especially since percussive syllables tend
to be very short.
beat(
nSyl = 10,
sylLen = 200,
pauseLen = 50,
pitch = c(200, 10),
samplingRate = 16000,
fadeOut = TRUE,
play = FALSE
)
nSyl |
the number of syllables to generate |
sylLen |
average duration of each syllable, ms |
pauseLen |
average duration of pauses between syllables, ms |
pitch |
fundamental frequency, Hz - a vector or data.frame(time = ..., value = ...) |
samplingRate |
sampling frequency, Hz |
fadeOut |
if TRUE, a linear fade-out is applied to the entire syllable |
play |
if TRUE, plays the synthesized sound using the default player on
your system. If character, passed to |
Returns a non-normalized waveform centered at zero.
soundgen
generateNoise
fart
playback = c(TRUE, FALSE)[2]
# a drum-like sound
s = beat(nSyl = 1, sylLen = 200,
pitch = c(200, 100), play = playback)
# plot(s, type = 'l')
# a dry, muted drum
s = beat(nSyl = 1, sylLen = 200,
pitch = c(200, 10), play = playback)
# sci-fi laser guns
s = beat(nSyl = 3, sylLen = 300,
pitch = c(1000, 50), play = playback)
# machine guns
s = beat(nSyl = 10, sylLen = 10, pauseLen = 50,
pitch = c(2300, 300), play = playback)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.