Generate wav Files from Spike Train(s)

Share:

Description

Given one or two spikeTrain object(s), trainWav generates a wav file containing the result of the convolution of the spike train(s) with the single period of a sine function.

Usage

1
2
3
trainWAV(leftCh, rightCh = NULL, filename, leftChFreq = 500,
         rightChFreq = 1000, rate = 10000, bits = 8, pan = 50,
         overwrite = FALSE)

Arguments

leftCh

a spikeTrain object or a numeric vector which can be coerced to such an object. The left channel of the resulting file if two channels are specified.

rightCh

a spikeTrain object or a numeric vector which can be coerced to such an object or NULL (default). The right channel of the resulting file if specified and not NULL.

filename

see saveSample.

leftChFreq

the frequency of the sine function convolved with leftCh.

rightChFreq

the frequency of the sine function convolved with rightCh.

rate

see as.Sample.

bits

see as.Sample.

pan

see stereo.

overwrite

see saveSample.

Details

The spikeTrain object(s) of leftCh and rightCh are viewed as sequence of Dirac delta function and are convovled with a single period of a sine function of a given frequency.

Value

Nothing is returned, the function is used for its side effect: a wav file is created.

Note

You have to install the sound package to use these functions.

Author(s)

Christophe Pouzat christophe.pouzat@gmail.com

See Also

as.spikeTrain, as.Sample, stereo, saveSample

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
## load spontaneous data of 4 putative projection neurons
## simultaneously recorded from the cockroach (Periplaneta
## americana) antennal lobe
data(CAL1S)
## convert data into spikeTrain objects
CAL1S <- lapply(CAL1S,as.spikeTrain)
## write train of neuron 1 to disk
trainWAV(CAL1S[[1]],,"n1spont.wav")
## write trains of neuron 1 and 2 to disk
trainWAV(CAL1S[[1]],CAL1S[[2]],"n1n2spont.wav")

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.