fitSampleParameters: Adjust Parameters of Two Sample Objects.

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/sound.R

Description

Adjust the parameters sampling rate, channels and bits/sample of two Sample objects.

Usage

1

Arguments

s1,s2

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

Details

The commands rate, channels and bits are used to transform copies of s1 and s2 to samples with the same parameters rate, channels and bits. Always the parameter with the better quality is chosen for the returned samples, that is the higher sampling rate, the larger number of channels and the larger number of bits per sample.

Value

a list containing the two transformed Samples as components.

Note

This routine is called before certain commands such as sum.Sample or appendSample are applied to Sample objects with different parameters.

Author(s)

Author: Matthias Heymann <mail@MatthiasHeymann.de>

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

See Also

rate, channels, bits

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
s1 <- Sine(440,1,rate=22050,channels=1,bits=16)
s2 <- Sawtooth(440,1,rate=44100,channels=2,bits=8)
play(s1)
play(s2)
l  <- fitSampleParameters(s1,s2)
t1 <- l[[1]]
t2 <- l[[2]]
print(t1)
print(t2)  # both samples have the same parameters now
play(t1)
play(t2)   # none of the samples sounds different now,
           # since only parameters with higher quality were chosen

## End(Not run)

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