sound (version 1.4.5)

cutSample: Cut Sample Objects

Description

Cut a part out of a Sample object.

Usage

cutSample(s, start, end)
# S3 method for Sample
[(s,i)

Value

the specified part of the given sample as a new Sample object.

Arguments

s

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

start

the start position in seconds.

end

the end position in seconds.

i

a vector of integers giving the numbers of the columns in the waveform matrix to be used.

Author

Author: tools:::Rd_package_author("sound")

Maintainer: tools:::Rd_package_maintainer("sound")

Details

Only the intersection of [start,end] with [0,duration(s)] is returned. Similarly, in the second form the intersection of v with 1:sampleLength(s) is returned.

See Also

sound for direct access to the waveform matrix,

cutSampleEnds and noSilence for special cutoff techniques.

Examples

Run this code
if (FALSE) {
s <- appendSample(Sine(330,1),Sine(440,1))
play(cutSample(s,.8,1.8))
play(s[(44100*.8):(44100*1.8)])  # the same
}

Run the code above in your browser using DataCamp Workspace