View source: R/scoreMatrices.R
scoreMatrices | R Documentation |
This convenience function creates score matrices (for use
in createPerformance
with the instruments
included with the csound package.
scoreMatrices(nFM = 0, nsubtractive = 0)
nFM |
The number of rows (each representing a note) desired for the FM synthesis instrument. |
nsubtractive |
The number of rows (each representing a note) desired for the subtractive synthesis instrument. |
There are currently two instruments included with the csound package: a basic FM synthesis instrument and a subtractive synthesis instrument.
A list of two matrices: $FM
, the score events for
the FM instrument, and $subtractive
, the score
events for the subtractive synthesis instrument. These
can be used as the i
argument to
createPerformance()
.
The columns of the returned matrices are parameters that Csound uses to render each note. The two instruments share several parameters:
The instrument number.
scoreMatrices()
fills this in for you and users
should not need to alter this.
The starting time of the note (in seconds).
The duration of the note (in seconds).
The volume of the note, as a proportion between 0 and 1, where 1 is the maximum volume. Note that a multiple notes that happen at the same time could add up to more than one, causing distortion an clipping.
The stereo placement of the note; 0 means entirely on the left speaker, and 1 means entirely on the right.
The proportion of the note's length devoted to the initial (linear) attack.
The proportion of the note's length devoted to the (linear) decay.
The FM instrument has these additional parameters:
The frequency of the carrier tone (in Hertz).
The modulating frequency, given as a multiple of the carrier tone.
The index of modulation.
The subtractive synthesis instrument has these additional parameters:
The central frequency of the band-pass filter (in Hertz).
The bandwidth of the band-pass filter (in Hertz).
When using the built-in instruments with
createPerformance()
, these matrices can be
used as the i
argument and no f
argument is
needed.
sndcheck <- scoreMatrices(5, 5)
sndcheck
sndcheck$FM[, "start"] <- 0:4
sndcheck$FM[, "dur"] <- 0.5
sndcheck$FM[, "amp"] <- 0.5
sndcheck$FM[, "pan"] <- (0:4)/4
sndcheck$FM[, c("attkp", "decayp")] <- 0.01
sndcheck$FM[, "cps"] <- (1:5)*110
sndcheck$FM[, "mod"] <- (1:5)/2
sndcheck$FM[, "indx"] <- 4:0
sndcheck$subtractive[, "start"] <- 0:4 + 0.5
sndcheck$subtractive[, "dur"] <- 0.1
sndcheck$subtractive[, "amp"] <- 0.05
sndcheck$subtractive[, "pan"] <- (4:0)/4
sndcheck$subtractive[, c("attkp", "decayp")] <- 0.01
sndcheck$subtractive[, "cntr"] <- (5:1)*500
sndcheck$subtractive[, "bw"] <- (5:1)*500
sndcheck
## Not run: createPerformance(sndcheck)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.