Learn R Programming

sequenceR (version 1.0.1)

oscillator_square: Square oscillator

Description

Creates a soundSample using a square oscillator.

Usage

oscillator_square(freq = 440, duration = 1, phase = 0, rate = 44100)

Value

An object of class 'soundSample'.

Arguments

freq

Numeric, note frequency in Hz

duration

Numeric, note duration in second

phase

Numeric, phase in radians (typically between 0 and 2*pi)

rate

Numeric, sampling rate in Hz

Examples

Run this code
sam <- oscillator_square(freq=220,duration=0.1)
plot(sam)
if (FALSE) {
# This line of code is wrapped in \dontrun{} since it relies
# on an external audio player to listen to the audio sample.
# See ?tuneR::setWavPlayer for setting a default player.
listen(sam)}

Run the code above in your browser using DataLab