dumpk3 — Periodically writes three orchestra control-signal values to an external file.
Periodically writes three orchestra control-signal values to a named external file in a specific format.
ifilname -- character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory
iformat -- specifies the output data format:
1 = 8-bit signed char(high order 8 bits of a 16-bit integer
4 = 16-bit short integers
5 = 32-bit long integers
6 = 32-bit floats
7 = ASCII long integers
8 = ASCII floats (2 decimal places)
Note that A-law and U-law output are not available, and that all formats except the last two are binary. The output file contains no header information.
iprd -- the period of ksig output in seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.
ksig1, ksig2, ksig3 -- control-rate signals
This opcode allows three generated control signal values to be saved in a named external file. The file contains no self-defining header information. But it contains a regularly sampled time series, suitable for later input or analysis. There may be any number of dumpk3 opcodes in an instrument or orchestra but each must write to a different file.
Here is an example of the dumpk3 opcode. Play dumpk3.csd Note that the example must be run from a directory for which the user has write access.
Example 256. Example of the dumpk3 opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -odac ;;;realtime audio out ;-iadc ;;;uncomment -iadc if realtime audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o dumpk3.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 giSine ftgen 0, 0, 2^10, 10, 1 instr 1 ;writes three control signals to a file kfreq randh 100, 1, 2, 1, 500 ;generates one random number between 400 and 600 per second kdb randh 12, 1, 2, 1, -12 ;amplitudes in dB between -24 and 0 kpan randh .5, 1, 2, 1, .5 ;panning between 0 and 1 dumpk3 kfreq, kdb, kpan, "dumpk3.txt", 8, 1 ;writes the control signals prints "WRITING:\n" printks "kfreq = %f, kdb = %f, kpan = %f\n", 1, kfreq, kdb, kpan ;prints them endin instr 2 ;reads the file written by instr 1 kf,kdb,kp readk3 "dumpk3.txt", 8, 1 prints "READING:\n" printks "kfreq = %f, kdb = %f, kpan = %f\n", 1, kf, kdb, kp ;prints again kdb lineto kdb, .1 ;smoothing amp transition kp lineto kp, .1 ;smoothing pan transition aout poscil ampdb(kdb), kf, giSine aL, aR pan2 aout, kp outs aL, aR endin </CsInstruments> <CsScore> i 1 0 5 i 2 5 5 e </CsScore> </CsoundSynthesizer>
The output should include lines like these:
WRITING: kfreq = 473.352855, kdb = -15.197657, kpan = 0.366764 kfreq = 473.352855, kdb = -15.197657, kpan = 0.366764 kfreq = 441.426368, kdb = -19.026206, kpan = 0.207327 kfreq = 452.965140, kdb = -21.447486, kpan = 0.553270 kfreq = 585.106328, kdb = -11.903852, kpan = 0.815665 kfreq = 482.056760, kdb = -4.046744, kpan = 0.876537 READING: kfreq = 473.352900, kdb = -15.197700, kpan = 0.366800 kfreq = 473.352900, kdb = -15.197700, kpan = 0.366800 kfreq = 441.426400, kdb = -19.026200, kpan = 0.207300 kfreq = 452.965100, kdb = -21.447500, kpan = 0.553300 kfreq = 585.106300, kdb = -11.903900, kpan = 0.815700 kfreq = 482.056800, kdb = -4.046700, kpan = 0.876500