pitch: Pitch a Sample Object

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/sound.R

Description

Change the pitch of a Sample object or a wav file.

Usage

1
pitch(s, semitones)

Arguments

s

a Sample object, or a string giving the name of a wav file.

semitones

a double giving the number of semitones to be pitched.

Details

Pitching +12 semitones (+1 octave) means to double the frequencies. Negative values of semitones are used to lower the frequencies.

Note that this transformation changes the actual data of the sample. Since pitching a sample is equivalent to playing it at a different speed, the length of the Sample object will also change.

Value

a Sample object.

Note

Future versions of this command may use a different algorithm to increase the quality of the returned sample.

Author(s)

Author: Matthias Heymann <mail@MatthiasHeymann.de>

Maintainer: Stefan Langenberg <langenberg@uni-bonn.de>

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
s <- Sine(440,1)
# Now play it 12 semitones = 1 octave deeper,
# that is half the frequencies and twice the length,
# or played at half speed.
play(pitch(s,-12)) # is the same as...
play(Sine(220,2))

## End(Not run)

sound documentation built on May 2, 2019, 2:10 a.m.

Related to pitch in sound...