scoreMatrices: Create blank score matrices for the built-in instruments

View source: R/scoreMatrices.R

scoreMatricesR Documentation

Create blank score matrices for the built-in instruments

Description

This convenience function creates score matrices (for use in createPerformance with the instruments included with the csound package.

Usage

  scoreMatrices(nFM = 0, nsubtractive = 0)

Arguments

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.

Details

There are currently two instruments included with the csound package: a basic FM synthesis instrument and a subtractive synthesis instrument.

Value

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().

Parameters for built-in instruments

The columns of the returned matrices are parameters that Csound uses to render each note. The two instruments share several parameters:

instr

The instrument number. scoreMatrices() fills this in for you and users should not need to alter this.

start

The starting time of the note (in seconds).

dur

The duration of the note (in seconds).

amp

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.

pan

The stereo placement of the note; 0 means entirely on the left speaker, and 1 means entirely on the right.

attkp

The proportion of the note's length devoted to the initial (linear) attack.

decayp

The proportion of the note's length devoted to the (linear) decay.

The FM instrument has these additional parameters:

cps

The frequency of the carrier tone (in Hertz).

mod

The modulating frequency, given as a multiple of the carrier tone.

indx

The index of modulation.

The subtractive synthesis instrument has these additional parameters:

cntr

The central frequency of the band-pass filter (in Hertz).

bw

The bandwidth of the band-pass filter (in Hertz).

Note

When using the built-in instruments with createPerformance(), these matrices can be used as the i argument and no f argument is needed.

Examples

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)

statisfactions/csound documentation built on Jan. 27, 2024, 1:33 p.m.