<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
0dbfs = 1.0

instr 1
    isource_fn = p4
    idestination_fn = p5
    iscale = p6

    if isource_fn == idestination_fn then
        prints "WARNING!! Source and destination must use different function\n"
        prints "table numbers. Skipping GEN scale.\n"
        turnoff
    endif
    
    isize = ftlen(isource_fn)    
    itemp ftgen idestination_fn, 0, isize, 10, 0

    iwrite_value = 0
    i_index = 0
    
    loop_start:
        iread_value tab_i i_index, isource_fn
        iwrite_value = iread_value * iscale
        tabw_i iwrite_value, i_index, idestination_fn

    loop_lt i_index, 1, isize, loop_start    
    
    turnoff
endin

instr 2
    ifn = p4
    isize = ftlen(ifn)    
    prints "Index\tValue\n"
    
    i_index = 0
    loop_start:
        ivalue tab_i i_index, ifn
        prints "%d:\t%f\n", i_index, ivalue

    loop_lt i_index, 1, isize, loop_start    
    
    turnoff
endin

</CsInstruments>
<CsScore>
f 1 0 8 10 1

i 1 0 1 1 2 3.333
i 2 0 1 1
i 2 0 1 2
</CsScore>
</CsoundSynthesizer>

