Returns the number of samples loaded into stored function table number x by GEN01. This is useful when a sample is shorter than the power-of-two function table that holds it. New in Csound version 3.49.
Here is an example of the nsamp opcode. It uses the files nsamp.orc, nsamp.sco, and mary.wav.
Example 240. Example of the nsamp opcode.
/* nsamp.orc */ ; Initialize the global variables. sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Instrument #1. instr 1 ; Print out the size (in samples) of Table #1. isz = nsamp(1) print isz endin /* nsamp.orc */
/* nsamp.sco */ ; Table #1: Use an audio file. f 1 0 262144 1 "mary.wav" 0 0 0 ; Play Instrument #1 for 1 second. i 1 0 1 e /* nsamp.sco */
Since the audio file “mary.wav” has 154390 samples, its output should include a line like this:
instr 1: isz = 154390.000