loscilxSignal Generators:Sample Playbackloscilxloscilx
Read multi-channel sampled sound from a table.
Description
Read sampled sound (up to 16 channels) from a table, with
optional sustain and release looping.
Syntaxar1 [, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9, ar10, ar11, ar12, ar13, ar14, \
ar15, ar16] loscilx xamp, kcps, ifn \
[, iwsize, ibas, istrt, imod, ibeg, iend]ar[] loscilx xamp, kcps, ifn \
[, iwsize, ibas, istrt, imod, ibeg, iend]Initializationifn -- function table number, typically
denoting an sampled sound segment with prescribed looping points
loaded using GEN01. The source
file may have up to 16 channels.
iwsize (optional) -- window size used in interpolation.
iwsize (optional, defaults to zero) -- interpolation window size, in samples. Can be one of the following:
1: round to nearest sample (no interpolation, for kpitch=1)2: linear interpolation4: cubic interpolation>= 8: iwsize point sinc interpolation with anti-aliasing (slow)
Zero or negative values select the default, which is cubic interpolation.
ibas (optional) -- base frequency in
Hz of the recorded sound. This optionally
overrides the frequency given in the audio file, but is required
if the file did not contain one. The default value is 261.626
Hz, i.e. middle C. (New in Csound 4.03). If this value is not
known or not present, use 1 here and in
kcps.
istrt (optional, default 0) -- Frame to
start reading the data. If this is not an integer the the data is
interpolated (see iwsize).
imod (optional, default -1) -- play mode
for the sustain and release loops. A value of 1 denotes normal
looping, 2 denotes forward & backward looping, 0 denotes no
looping. The default value (-1) will defer to the mode and the
looping points given in the source file. Make sure you select an
appropriate mode if the file does not contain this information.
ibeg, iend (optional, depending on
imod) -- begin and end points of the sustain
and release loops. These are measured in sample
frames from the beginning of the file. If no loop
points are specified, and a looping mode
(imod is given, the file will be looped for
the whole length.
Performancear1, ar2, ... ar[] -- the output at audio-rate.
The number of outputs must match the number of channels in the
sample file.
xamp -- the amplitude of the output signal.
kcps -- the factor to read the file. For
example, a value of 1 has no pitch change, 1.5 is up a fifth and
2 an octave.
loscilx samples the ftable audio at a rate
determined by kcps, then multiplies the
result by xamp. The sampling increment for
kcps is dependent on the table's base-note
frequency ibas, and is automatically
adjusted if the orchestra sr value differs
from that at which the source was recorded. In this unit, ftable
is always sampled with interpolation.
If sampling reaches the sustain loop
endpoint and looping is in effect, the point of sampling will be
modified and loscil will continue reading
from within that loop segment. Once the instrument has received
a turnoff signal (from the score or from a
MIDI noteoff event), the next sustain endpoint encountered will
be ignored and sampling will continue towards the
release loop end-point, or towards the last
sample (henceforth to zeros).
If you want to loop the whole file, specify a looping mode in
imod and do not enter any values for
ibeg and iend.
Examples
Here is an example of the loscilx opcode. It uses the files
loscil.csd
and drumsSlp.wav.
Example of the loscilx opcode.See the sections Real-time
Audio and Command Line
Flags for more information on using command
line flags.See alsoSample PlaybackCreditsWritten by &nameistvan;.2006New in Csound 5.03Array version new in Csound 6.13 (February 2019)