vpow_i — Raises each element of a vector to a scalar power
ifn - number of the table hosting the vectorial signal to be processed
ielements - number of elements of the vector
ival - scalar value to which the elements of ifn will be raised
idstoffset - index offset for the destination table
vpow_i elevates each element of the vector contained in the table ifn to the power of ival, starting from table index idstoffset. This enables you to process a specific section of a table by specifying the offset and the number of elements to be processed. Offset is counted starting from 0, so if no offset is specified (or set to 0), the table will be modified from the beginning.
This opcode runs only on initialization, there is a k-rate version of this opcode called vpow.
Negative values for idstoffset are valid. Elements from the vector that are outside the table, will be discarded, and they will not wrap around the table.
In all these opcodes, the resulting vectors are stored in ifn, overriding the intial vectors. If you want to keep initial vector, use vcopy or vcopy_i to copy it in another table. All these operators are designed to be used together with other opcodes that operate with vectorial signals such as vcella, adsynt, adsynt2, etc. They can also be useful in conjunction with the spectral opcodes pvsftw and pvsftr.
Here is an example of the vpow_i opcode. It uses the file vpow_i.csd.
Example 1213. Examples of the vpow_i 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 ; Audio out Audio in -odac -iadc ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o cigoto.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr=44100 ksmps=128 nchnls=2 instr 1 ifn1 = p4 ival = p5 ielements = p6 idstoffset = p7 kval init 25 vpow_i ifn1, ival, ielements, idstoffset endin instr 2 ;Printtable itable = p4 isize = ftlen(itable) kcount init 0 kval table kcount, itable printk2 kval if (kcount == isize) then turnoff endif kcount = kcount + 1 endin </CsInstruments> <CsScore> f 1 0 16 -7 1 16 17 i2 0.0 0.2 1 i1 0.4 0.01 1 2 3 4 i2 0.8 0.2 1 i1 1.0 0.01 1 0.5 5 -3 i2 1.2 0.2 1 i1 1.4 0.01 1 1.5 10 12 i2 1.6 0.2 1 e </CsScore> </CsoundSynthesizer>
Here is another example of the vpow_i opcode. It uses the file vpow_i-2.csd.
Example 1214.
<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 vpow_i-2.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 gifil ftgen 1, 0, 0, 1, "fox.wav", 0, 0, 1 instr 1 ival = p4 ;different distortion settings ielements = p5 idstoffset = p6 ;index offset vpow_i 1, ival, ielements, idstoffset asig lposcil 1, 1, 0, 0, 1 outs asig, asig endin </CsInstruments> <CsScore> i1 0 2.7 .5 70000 0 ;no offset i1 3 2.7 .01 50000 70000 ;add another period of distortion, starting at sample 70000 e </CsScore> </CsoundSynthesizer>