snd.write: snd.write

Description Usage Arguments See Also Examples

View source: R/snd.R

Description

Saves Sound object to a file. snd is a list with $sig and $fs members at least. If $nBits is not present, default value of 16 bits is used. Vector $t is ignored. If the sound signal is 2-channel (stereo), $sig must be a two-column matrix (1st column corresponds to the left channel, 2nd column to the right channel). If the sound is 1-channel (mono), $sig can be either a numeric vector or a one-column matrix. optional $t, $nChannels, $nSamples, $duration vectors are ignored.

Usage

1
snd.write(snd, fileNameSound)

Arguments

snd

Sound object (with $sig, $nBits and $fs members)

fileNameSound

file name to be created

See Also

snd.read

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
snd <- snd.sample()
snd.plot(snd)
snd.write(snd, "temp1.wav")

signal <- 0.8*sin(seq(0, 2*pi*440, length.out = 8000))
snd.write(list(sig = signal, fs = 8000, nBits = 16), "temp2.wav")

left  <- 0.3*sin(seq(0, 2*pi*440, length.out = 4000))
right <- 0.5*sin(seq(0, 2*pi*220, length.out = 4000))
snd.write(list(sig = matrix(c(left, right), ncol = 2), fs = 8000, nBits = 16), "temp3.wav")

## End(Not run)

rPraat documentation built on Feb. 28, 2021, 1:06 a.m.