vmult

vmult — Performs multiplication between a vectorial control signal and a scalar control signal

Description

Performs multiplication between a vectorial control signal and a scalar control signal

Syntax

vmult  ifn, kval, ielements

Initialization

ifn - number of the table hosting the vectorial signal to be processed

ielements - number of elements of the vector

Performance

kval - scalar operand to be processed

vmult multiplies each elements of the vector contained in the table ifn by kval operand.

These opcodes (vadd, vmult, vpow, vexp) perform numeric operations between a vectorial control signal (hosted by the table ifn), and a scalar signal (kval). Result is a new vector that overrides old values of ifn. All these opcodes work at k-rate.

In all these opcodes, the resulting vectors are stored in ifn, overriding the intial vectors. If you want to keep initial vector, use vcopy opcode 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 bmscan, vcella, adsynt, adsynt2 etc.

Example

Here is an example of the vmult opcode. It uses the files vmult.csd.

Example 416. Example of the vmult opcode.

<CsoundSynthesizer>
<CsOptions>
-odac -B441 -b441
</CsOptions>
<CsInstruments>


sr=44100
kr=4410
ksmps=10
nchnls=2

	instr 1 ;table playback
ar lposcil 1, 1, 0, 262144, 1
out ar,ar
	endin    

	instr 2
vcopy 2, 1, 40000 ;copy vector from sample to empty table
vmult 5, 10000, 262144 ;scale noise to make it audible
vcopy 1, 5, 40000 ;put noise into sample
turnoff
	endin

	instr 3
vcopy 1, 2, 40000 ;put original information back in
turnoff
	endin

</CsInstruments>
<CsScore>
f1  0 262144   -1 "beats.aiff" 0 4 0
f2  0 262144   2  0

f5  0 262144   21  3 30000

i1 0 4
i2 3 1

s
i1 0 4
i3 3 1
s

i1 0 4

</CsScore>
</CsoundSynthesizer>

        

Credits

Written by Gabriel Maldonado.

Example by Andres Cabrera.

New in Csound 5 (Previously available only on CsoundAV)