Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Odd k-rate array thing

Date2016-12-04 23:48
FromOeyvind Brandtsegg
Subject[Csnd-dev] Odd k-rate array thing
Hi,

I have an example where this segfaults:
kSpread[] = kArrF-kcentroid

but this does not:
kSpread[] = kArrF+kcentroid

and even this works ok
kSpread[] = kArrF+(kcentroid*-1)

Tested wiith the recent 6.08 release on Windows,
also tested with my own compiled version of Oct 4 (behaves the same)

full csd below
Oeyvind







    0dbfs = 1
    gifftsize = 1024
    giSine ftgen 0, 0, 65536, 10, 1
    giFftTabSize = (gifftsize / 2)+1
    gifna ftgen 1 ,0, giFftTabSize, 7, 0, giFftTabSize, 0
    gifnf ftgen 2 ,0, giFftTabSize, 7, 0, giFftTabSize, 0

    instr 1
        a1 rnd31 1, 1
kArrA[] init giFftTabSize
kArrF[] init giFftTabSize
        fsin pvsanal a1, gifftsize, gifftsize/2, gifftsize, 1
kflag pvsftw fsin,gifna,gifnf
        if (kflag > 0) then
        copyf2array kArrA, gifna
        copyf2array kArrF, gifnf
        kcentroid pvscent fsin
        ;kSpread[] = kArrF-kcentroid ; segfaults
;kSpread[] = kArrF+kcentroid ; ok
kSpread[] = kArrF+(kcentroid*-1) ; ok
        endif
     out a1
    endin



i1      0       .1
e






-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://www.partikkelaudio.com/
http://crossadaptive.hf.ntnu.no
http://gdsp.hf.ntnu.no/
http://soundcloud.com/brandtsegg
http://flyndresang.no/

Date2016-12-05 13:31
Fromjpff
SubjectRe: [Csnd-dev] Odd k-rate array thing
Works for me (on Linux)
....
ftable 1:       512 points, scalemax 0.000
ftable 2:
ftable 2:       512 points, scalemax 0.000
orch now loaded
audio buffered in 256 sample-frame blocks
writing 512-byte blks of shorts to test.wav (WAV)
SECTION 1:
new alloc for instr 1:
B  0.000 ..  0.100 T  0.100 TT  0.100 M:  0.99993
Score finished in csoundPerform().
inactive allocs returned to freespace
end of score.              overall amps:  0.99993
            overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.006s, CPU: 0.005s

Date2016-12-05 18:26
FromOeyvind Brandtsegg
SubjectRe: [Csnd-dev] Odd k-rate array thing
oh, I realize I commented out the offending line in the example,
terribly sorry,
Of these three lines, try to uncomment one at a time.

;kSpread[] = kArrF-kcentroid ; segfaults
;kSpread[] = kArrF+kcentroid ; ok
kSpread[] = kArrF+(kcentroid*-1) ; ok

The one with kArrF-kcentroid gives a segfault.

Was this what you tried on Linux, John?

best
Oeyvind

2016-12-05 5:31 GMT-08:00 jpff :
> Works for me (on Linux)
> ....
> ftable 1:       512 points, scalemax 0.000
> ftable 2:
> ftable 2:       512 points, scalemax 0.000
> orch now loaded
> audio buffered in 256 sample-frame blocks
> writing 512-byte blks of shorts to test.wav (WAV)
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  0.100 T  0.100 TT  0.100 M:  0.99993
> Score finished in csoundPerform().
> inactive allocs returned to freespace
> end of score.              overall amps:  0.99993
>            overall samples out of range:        0
> 0 errors in performance
> Elapsed time at end of performance: real: 0.006s, CPU: 0.005s
> 256 512 sample blks of shorts written to test.wav (WAV)



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://www.partikkelaudio.com/
http://crossadaptive.hf.ntnu.no
http://gdsp.hf.ntnu.no/
http://soundcloud.com/brandtsegg
http://flyndresang.no/

Date2016-12-05 19:02
FromJohn ff
SubjectRe: [Csnd-dev] Odd k-rate array thing
No. I unconnected the line with subtraction

Sent from TypeApp
On 5 Dec 2016, at 18:37, Oeyvind Brandtsegg <oyvind.brandtsegg@NTNU.NO> wrote:
oh, I realize I commented out the offending line in the example,
terribly sorry,
Of these three lines, try to uncomment one at a time.

;kSpread[] = kArrF-kcentroid ; segfaults
;kSpread[] = kArrF+kcentroid ; ok
kSpread[] = kArrF+(kcentroid*-1) ; ok

The one with kArrF-kcentroid gives a segfault.

Was this what you tried on Linux, John?

best
Oeyvind

2016-12-05 5:31 GMT-08:00 jpff <jpff@codemist.co.uk>:
Works for me (on Linux)
....
ftable 1: 512 points, scalemax 0.000
ftable 2:
ftable 2: 512 points, scalemax 0.000
orch now loaded
audio buffered in 256 sample-frame bl ocks
writing 512-byte blks of shorts to test.wav (WAV)
SECTION 1:
new alloc for instr 1:
B 0.000 .. 0.100 T 0.100 TT 0.100 M: 0.99993
Score finished in csoundPerform().
inactive allocs returned to freespace
end of score. overall amps: 0.99993
overall samples out of range: 0
0 errors in performance
Elapsed time at end of performance: real: 0.006s, CPU: 0.005s
256 512 sample blks of shorts written to test.wav (WAV)