Csound Csound-dev Csound-tekno Search About

multiplying values in an ftables

Date2007-10-15 12:22
Frompeiman
Subjectmultiplying values in an ftables
Dear list,

I was wandering if there is a way to multiply one ftable with another:
assuming that two tables have exactly the same size and number of index
entries (there is a value for every index), is there a way to multiply the
value of each index in the first table with the corresponding indexes in a
second table? This is to make an instrument that can read fsig data into a
table and scale each bin individually using a second table. Is this
possible? If not could an opcode be implemented easily?

Many Thanks
Peiman 
-- 
View this message in context: http://www.nabble.com/multiplying-values-in-an-ftables-tf4626540.html#a13210855
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-10-15 13:20
FromAlex Weiss
SubjectRe: multiplying values in an ftables
You could obtain the values of both tables for a given index with the  
table opcode or a similar opcode (depending on whether you want  
interpolated values or not), perform all necessary calculations, and  
use tablew to write the results back into a table. Like so (I used k- 
rate variables, i-rate should work as well):

kval1 table kindex, 1
kval2 table kindex, 2
tablew kval1*kval2, kindex, 3		; save it to a third table

If you want to process the whole table that way, you could use a loop.

- Alex


On Oct 15, 2007, at 1:22 PM, peiman wrote:

>
> Dear list,
>
> I was wandering if there is a way to multiply one ftable with another:
> assuming that two tables have exactly the same size and number of  
> index
> entries (there is a value for every index), is there a way to  
> multiply the
> value of each index in the first table with the corresponding  
> indexes in a
> second table? This is to make an instrument that can read fsig data  
> into a
> table and scale each bin individually using a second table. Is this
> possible? If not could an opcode be implemented easily?
>
> Many Thanks
> Peiman
> -- 
> View this message in context: http://www.nabble.com/multiplying- 
> values-in-an-ftables-tf4626540.html#a13210855
> Sent from the Csound - General mailing list archive at Nabble.com.
>
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Date2007-10-15 14:21
FromTim Mortimer
SubjectRe: multiplying values in an ftables
theres also vmultv opcode, but i've never used it.

otherwise as alex said 'd be the way i'd go.

ibins init 1024

kindex = 0

binloop:

kval1 table kindex, 1
kval2 table kindex, 2
tablew kval1*kval2, kindex, 3	

kindex = kindex+1

if kindex < ibins kgoto binloop

then apply to the fsig on each kpass.....


Alex Weiss-3 wrote:
> 
> You could obtain the values of both tables for a given index with the  
> table opcode or a similar opcode (depending on whether you want  
> interpolated values or not), perform all necessary calculations, and  
> use tablew to write the results back into a table. Like so (I used k- 
> rate variables, i-rate should work as well):
> 
> kval1 table kindex, 1
> kval2 table kindex, 2
> tablew kval1*kval2, kindex, 3		; save it to a third table
> 
> If you want to process the whole table that way, you could use a loop.
> 
> - Alex
> 
> 
> On Oct 15, 2007, at 1:22 PM, peiman wrote:
> 
>>
>> Dear list,
>>
>> I was wandering if there is a way to multiply one ftable with another:
>> assuming that two tables have exactly the same size and number of  
>> index
>> entries (there is a value for every index), is there a way to  
>> multiply the
>> value of each index in the first table with the corresponding  
>> indexes in a
>> second table? This is to make an instrument that can read fsig data  
>> into a
>> table and scale each bin individually using a second table. Is this
>> possible? If not could an opcode be implemented easily?
>>
>> Many Thanks
>> Peiman
>> -- 
>> View this message in context: http://www.nabble.com/multiplying- 
>> values-in-an-ftables-tf4626540.html#a13210855
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>> -- 
>> Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
> 
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
> 
> 

-- 
View this message in context: http://www.nabble.com/multiplying-values-in-an-ftables-tf4626540.html#a13212621
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-10-15 15:12
Frompeiman
SubjectRe: multiplying values in an ftables
Tim and Alex,
Thanks for the replies. I just tried this but it doesn't work with the pvs
signals (I just get glitches in the outfile) I think the looping operation
basically disrupts the timing for pvs resynthesis. I have tried using 256
vmult opcodes typed in by hand and it works even in realtime very nicely.
But is there no other way to do it without looping operations or typing an
opcode for every bin? would be nice to have a table opcode that would do
this internally. Or am I getting it wrong? This is what I have:

fsigin1 	pvsanal	 ain1, 512, 512/4, 512*2, 0 
fsigin2 	pvsanal	 ain2, 512, 512/4, 512*2, 0 

kflag    pvsftw     fsigin1,itable1, itable2          ; export  amps to
table
kflag1    pvsftw     fsigin2,itable11, itable22          ; export  amps to
table


kindex = 0

loop:
kval1 table kindex, itable3
kval2 table kindex, itable2
tablew kval1*kval2, kindex, itable4

kindex = kindex+1

if kindex < 256 kgoto loop

pvsftr      fsigin1,itable1, itable4
pvsftr      fsigin2,itable11, itable4

if      kflag==0   kgoto contin   ; only proc when frame is ready
if      kflag1==0   kgoto contin1   ; only proc when frame is ready
	
contin is basically a pvsadsyn resynthesis.

Thanks
Peiman


Tim Mortimer wrote:
> 
> theres also vmultv opcode, but i've never used it.
> 
> otherwise as alex said 'd be the way i'd go.
> 
> ibins init 1024
> 
> kindex = 0
> 
> binloop:
> 
> kval1 table kindex, 1
> kval2 table kindex, 2
> tablew kval1*kval2, kindex, 3	
> 
> kindex = kindex+1
> 
> if kindex < ibins kgoto binloop
> 
> then apply to the fsig on each kpass.....
> 
> 
> Alex Weiss-3 wrote:
>> 
>> You could obtain the values of both tables for a given index with the  
>> table opcode or a similar opcode (depending on whether you want  
>> interpolated values or not), perform all necessary calculations, and  
>> use tablew to write the results back into a table. Like so (I used k- 
>> rate variables, i-rate should work as well):
>> 
>> kval1 table kindex, 1
>> kval2 table kindex, 2
>> tablew kval1*kval2, kindex, 3		; save it to a third table
>> 
>> If you want to process the whole table that way, you could use a loop.
>> 
>> - Alex
>> 
>> 
>> On Oct 15, 2007, at 1:22 PM, peiman wrote:
>> 
>>>
>>> Dear list,
>>>
>>> I was wandering if there is a way to multiply one ftable with another:
>>> assuming that two tables have exactly the same size and number of  
>>> index
>>> entries (there is a value for every index), is there a way to  
>>> multiply the
>>> value of each index in the first table with the corresponding  
>>> indexes in a
>>> second table? This is to make an instrument that can read fsig data  
>>> into a
>>> table and scale each bin individually using a second table. Is this
>>> possible? If not could an opcode be implemented easily?
>>>
>>> Many Thanks
>>> Peiman
>>> -- 
>>> View this message in context: http://www.nabble.com/multiplying- 
>>> values-in-an-ftables-tf4626540.html#a13210855
>>> Sent from the Csound - General mailing list archive at Nabble.com.
>>>
>>> -- 
>>> Send bugs reports to this list.
>>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> 
>> -- 
>> Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/multiplying-values-in-an-ftables-tf4626540.html#a13213743
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-10-15 15:58
Frompeiman
SubjectRe: multiplying values in an ftables
Hi Again,

I take that back! it's working beautifully. The glitches where due to my
system freezing (as a result of a previous csd I had rendered). I restarted
and the loop operation is working just find. Thanks for your helps again.

Best
Peiman

Tim Mortimer wrote:
> 
> theres also vmultv opcode, but i've never used it.
> 
> otherwise as alex said 'd be the way i'd go.
> 
> ibins init 1024
> 
> kindex = 0
> 
> binloop:
> 
> kval1 table kindex, 1
> kval2 table kindex, 2
> tablew kval1*kval2, kindex, 3	
> 
> kindex = kindex+1
> 
> if kindex < ibins kgoto binloop
> 
> then apply to the fsig on each kpass.....
> 
> 
> Alex Weiss-3 wrote:
>> 
>> You could obtain the values of both tables for a given index with the  
>> table opcode or a similar opcode (depending on whether you want  
>> interpolated values or not), perform all necessary calculations, and  
>> use tablew to write the results back into a table. Like so (I used k- 
>> rate variables, i-rate should work as well):
>> 
>> kval1 table kindex, 1
>> kval2 table kindex, 2
>> tablew kval1*kval2, kindex, 3		; save it to a third table
>> 
>> If you want to process the whole table that way, you could use a loop.
>> 
>> - Alex
>> 
>> 
>> On Oct 15, 2007, at 1:22 PM, peiman wrote:
>> 
>>>
>>> Dear list,
>>>
>>> I was wandering if there is a way to multiply one ftable with another:
>>> assuming that two tables have exactly the same size and number of  
>>> index
>>> entries (there is a value for every index), is there a way to  
>>> multiply the
>>> value of each index in the first table with the corresponding  
>>> indexes in a
>>> second table? This is to make an instrument that can read fsig data  
>>> into a
>>> table and scale each bin individually using a second table. Is this
>>> possible? If not could an opcode be implemented easily?
>>>
>>> Many Thanks
>>> Peiman
>>> -- 
>>> View this message in context: http://www.nabble.com/multiplying- 
>>> values-in-an-ftables-tf4626540.html#a13210855
>>> Sent from the Csound - General mailing list archive at Nabble.com.
>>>
>>> -- 
>>> Send bugs reports to this list.
>>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> 
>> -- 
>> Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/multiplying-values-in-an-ftables-tf4626540.html#a13214332
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-10-15 17:26
From"Andres Cabrera"
SubjectRe: multiplying values in an ftables
AttachmentsNone