Sine

0th

Percentile

Create Sample Objects for the Basic waveforms

Create a Sample object with a sine, sawtooth, or square waveform, silence, or noise.

Keywords
sysdata
Usage
Sine(freq, dur, rate=44100, bits=16, channels=1)
Sawtooth(freq, dur, rate=44100, bits=16, channels=1, reverse=FALSE)
Square(freq, dur, rate=44100, bits=16, channels=1, upPerc=50)
Silence(dur, rate=8000, bits=8, channels=1)
Noise(dur, rate=44100, bits=16, channels=1)
Arguments
freq

the frequency (a double).

dur

the duration in seconds (a double).

rate

the sampling rate, an integer between 1000 and 48000.

bits

the sampling quality in bits per sample, 8 or 16.

channels

1 for mono, or 2 for stereo.

reverse

logical. If TRUE, the waveform will be mirrored vertically.

upPerc

a number between 0 and 100 giving the percentage of the waveform with value +1.

Details

If channels=2, left and right side of the sample will be the same for Sine, Sawtooth and Square. For Noise, both sides will be generated separately, using runif.

Value

a Sample object.

See Also

as.Sample, loadSample, nullSample

Aliases
  • Sine
  • Sawtooth
  • Square
  • Silence
  • Noise
Examples
# NOT RUN {
s1 <- Sine(440,1)
play(s1)

s2 <- Sawtooth(440,1)
play(s2)

play(Noise(1))
# }
Documentation reproduced from package sound, version 1.4.5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.