Csound Csound-dev Csound-tekno Search About

[Csnd-dev] WINDAT issue.. min and max members are always 0?

Date2016-02-04 10:27
FromRory Walsh
Subject[Csnd-dev] WINDAT issue.. min and max members are always 0?
Attachmentsdispfft.cpp  dispfft.csd  
The WINDAT struct looks like this:

struct windat_ {
    uintptr_t windid;           /* set by MakeGraph() */
    MYFLT   *fdata;             /* data passed to DrawGraph */
    int32    npts;               /* size of above array */
    char    caption[CAPSIZE];   /* caption string for graph */
    int16   waitflg;            /* set =1 to wait for ms after Draw */
    int16   polarity;           /* controls positioning of X axis */
    MYFLT   max, min;           /* workspace .. extrema this frame */
    MYFLT   absmax;             /* workspace .. largest of above */
    MYFLT   oabsmax;            /* Y axis scaling factor */
    int     danflag;            /* set to 1 for extra Yaxis mid span */
  int     absflag;             /* set to 1 to skip abs check */
};

I assumed that min and max might report the min and max FFT bin when using dispfft, but they are always 0. Attached is a simple test and accompanying csd file. I would love to be able to access the min and max FFT bins. 


Date2016-02-06 12:17
FromRory Walsh
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
Bump? Should I file an issue on github, or is this expected behavior? 

On 4 February 2016 at 10:27, Rory Walsh <rorywalsh@ear.ie> wrote:
The WINDAT struct looks like this:

struct windat_ {
    uintptr_t windid;           /* set by MakeGraph() */
    MYFLT   *fdata;             /* data passed to DrawGraph */
    int32    npts;               /* size of above array */
    char    caption[CAPSIZE];   /* caption string for graph */
    int16   waitflg;            /* set =1 to wait for ms after Draw */
    int16   polarity;           /* controls positioning of X axis */
    MYFLT   max, min;           /* workspace .. extrema this frame */
    MYFLT   absmax;             /* workspace .. largest of above */
    MYFLT   oabsmax;            /* Y axis scaling factor */
    int     danflag;            /* set to 1 for extra Yaxis mid span */
  int     absflag;             /* set to 1 to skip abs check */
};

I assumed that min and max might report the min and max FFT bin when using dispfft, but they are always 0. Attached is a simple test and accompanying csd file. I would love to be able to access the min and max FFT bins. 



Date2016-02-06 12:50
FromVictor Lazzarini
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
Myself, I don't know what the behaviour is supposed to be.

On 6 Feb 2016, at 12:17, Rory Walsh <rorywalsh@EAR.IE> wrote:

Bump? Should I file an issue on github, or is this expected behavior? 

On 4 February 2016 at 10:27, Rory Walsh <rorywalsh@ear.ie> wrote:
The WINDAT struct looks like this:

struct windat_ {
    uintptr_t windid;           /* set by MakeGraph() */
    MYFLT   *fdata;             /* data passed to DrawGraph */
    int32    npts;               /* size of above array */
    char    caption[CAPSIZE];   /* caption string for graph */
    int16   waitflg;            /* set =1 to wait for ms after Draw */
    int16   polarity;           /* controls positioning of X axis */
    MYFLT   max, min;           /* workspace .. extrema this frame */
    MYFLT   absmax;             /* workspace .. largest of above */
    MYFLT   oabsmax;            /* Y axis scaling factor */
    int     danflag;            /* set to 1 for extra Yaxis mid span */
  int     absflag;             /* set to 1 to skip abs check */
};

I assumed that min and max might report the min and max FFT bin when using dispfft, but they are always 0. Attached is a simple test and accompanying csd file. I would love to be able to access the min and max FFT bins. 



Date2016-02-06 14:09
FromRory Walsh
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
Thanks Victor. Perhaps John has some idea. 

On 6 February 2016 at 12:50, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Myself, I don't know what the behaviour is supposed to be.

On 6 Feb 2016, at 12:17, Rory Walsh <rorywalsh@EAR.IE> wrote:

Bump? Should I file an issue on github, or is this expected behavior? 

On 4 February 2016 at 10:27, Rory Walsh <rorywalsh@ear.ie> wrote:
The WINDAT struct looks like this:

struct windat_ {
    uintptr_t windid;           /* set by MakeGraph() */
    MYFLT   *fdata;             /* data passed to DrawGraph */
    int32    npts;               /* size of above array */
    char    caption[CAPSIZE];   /* caption string for graph */
    int16   waitflg;            /* set =1 to wait for ms after Draw */
    int16   polarity;           /* controls positioning of X axis */
    MYFLT   max, min;           /* workspace .. extrema this frame */
    MYFLT   absmax;             /* workspace .. largest of above */
    MYFLT   oabsmax;            /* Y axis scaling factor */
    int     danflag;            /* set to 1 for extra Yaxis mid span */
  int     absflag;             /* set to 1 to skip abs check */
};

I assumed that min and max might report the min and max FFT bin when using dispfft, but they are always 0. Attached is a simple test and accompanying csd file. I would love to be able to access the min and max FFT bins. 




Date2016-02-06 20:11
Fromjpff
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
It is some years since I looked at tis ciode but i wil investigate.
I notce tese fields are marked as workspace which is suspciiois.
==John


On Sat, 6 Feb 2016, Rory Walsh wrote:

> Thanks Victor. Perhaps John has some idea. 
> 
> On 6 February 2016 at 12:50, Victor Lazzarini 
> wrote:
> Myself, I don't know what the behaviour is supposed to be.
> 
> On 6 Feb 2016, at 12:17, Rory Walsh  wrote:
>
>       Bump? Should I file an issue on github, or is this expected
>       behavior? 
> 
> On 4 February 2016 at 10:27, Rory Walsh  wrote:
>       The WINDAT struct looks like this:
> struct windat_ {
>     uintptr_t windid;           /* set by MakeGraph() */
>     MYFLT   *fdata;             /* data passed to DrawGraph
> */
>     int32    npts;               /* size of above array */
>     char    caption[CAPSIZE];   /* caption string for graph
> */
>     int16   waitflg;            /* set =1 to wait for ms
> after Draw */
>     int16   polarity;           /* controls positioning of X
> axis */
>     MYFLT   max, min;           /* workspace .. extrema this
> frame */
>     MYFLT   absmax;             /* workspace .. largest of
> above */
>     MYFLT   oabsmax;            /* Y axis scaling factor */
>     int     danflag;            /* set to 1 for extra Yaxis
> mid span */
>   int     absflag;             /* set to 1 to skip abs check
> */
> };
> 
> I assumed that min and max might report the min and max FFT
> bin when using dispfft, but they are always 0. Attached is a
> simple test and accompanying csd file. I would love to be
> able to access the min and max FFT bins. 
> 
> 
> 
> 
>

Date2016-02-06 20:23
Fromjpff
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
First investigation suggests it is set in displaying tables and such.
As far as I can see the display of ffts does not use the WINDAT structure 
at all.  I could be wrong though, so will look further

Date2016-02-07 14:44
Fromjpff
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
Programmer error.  max and min cannot be known until te data is available 
in te drawing callback, not the initialisation.  In Rory's example there 
is still a question why tee is no perf-time calls to display.  Still 
investigating.
==John

On Sat, 6 Feb 2016, Rory Walsh wrote:

> Thanks Victor. Perhaps John has some idea. 
> 
> On 6 February 2016 at 12:50, Victor Lazzarini 
> wrote:
> Myself, I don't know what the behaviour is supposed to be.
> 
> On 6 Feb 2016, at 12:17, Rory Walsh  wrote:
>
>       Bump? Should I file an issue on github, or is this expected
>       behavior? 
> 
> On 4 February 2016 at 10:27, Rory Walsh  wrote:
>       The WINDAT struct looks like this:
> struct windat_ {
>     uintptr_t windid;           /* set by MakeGraph() */
>     MYFLT   *fdata;             /* data passed to DrawGraph
> */
>     int32    npts;               /* size of above array */
>     char    caption[CAPSIZE];   /* caption string for graph
> */
>     int16   waitflg;            /* set =1 to wait for ms
> after Draw */
>     int16   polarity;           /* controls positioning of X
> axis */
>     MYFLT   max, min;           /* workspace .. extrema this
> frame */
>     MYFLT   absmax;             /* workspace .. largest of
> above */
>     MYFLT   oabsmax;            /* Y axis scaling factor */
>     int     danflag;            /* set to 1 for extra Yaxis
> mid span */
>   int     absflag;             /* set to 1 to skip abs check
> */
> };
> 
> I assumed that min and max might report the min and max FFT
> bin when using dispfft, but they are always 0. Attached is a
> simple test and accompanying csd file. I would love to be
> able to access the min and max FFT bins. 
> 
> 
> 
> 
>

Date2016-02-07 14:50
FromRory Walsh
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
Thanks John. I should have thought to check that. 

On 7 February 2016 at 14:44, jpff <jpff@codemist.co.uk> wrote:
Programmer error.  max and min cannot be known until te data is available in te drawing callback, not the initialisation.  In Rory's example there is still a question why tee is no perf-time calls to display.  Still investigating.
==John

On Sat, 6 Feb 2016, Rory Walsh wrote:

Thanks Victor. Perhaps John has some idea. 

On 6 February 2016 at 12:50, Victor Lazzarini <Victor.Lazzarini@nuim.ie>
wrote:
Myself, I don't know what the behaviour is supposed to be.

On 6 Feb 2016, at 12:17, Rory Walsh <rorywalsh@EAR.IE> wrote:

      Bump? Should I file an issue on github, or is this expected
      behavior? 

On 4 February 2016 at 10:27, Rory Walsh <rorywalsh@ear.ie> wrote:
      The WINDAT struct looks like this:
struct windat_ {
    uintptr_t windid;           /* set by MakeGraph() */
    MYFLT   *fdata;             /* data passed to DrawGraph
*/
    int32    npts;               /* size of above array */
    char    caption[CAPSIZE];   /* caption string for graph
*/
    int16   waitflg;            /* set =1 to wait for ms
after Draw */
    int16   polarity;           /* controls positioning of X
axis */
    MYFLT   max, min;           /* workspace .. extrema this
frame */
    MYFLT   absmax;             /* workspace .. largest of
above */
    MYFLT   oabsmax;            /* Y axis scaling factor */
    int     danflag;            /* set to 1 for extra Yaxis
mid span */
  int     absflag;             /* set to 1 to skip abs check
*/
};

I assumed that min and max might report the min and max FFT
bin when using dispfft, but they are always 0. Attached is a
simple test and accompanying csd file. I would love to be
able to access the min and max FFT bins. 






Date2016-02-07 15:25
Fromjpff
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
I still have a problem in understanding your example.  It cals init on the 
display opcode but destroys instr 1 before calling perf.  This may be 
intended but I do not see how it happens.


On Sun, 7 Feb 2016, Rory Walsh wrote:

> Thanks John. I should have thought to check that. 
> 
> On 7 February 2016 at 14:44, jpff  wrote:
>       Programmer error.  max and min cannot be known until te data is
>       available in te drawing callback, not the initialisation.  In
>       Rory's example there is still a question why tee is no perf-time
>       calls to display.  Still investigating.
>       ==John
>

Date2016-02-07 15:33
FromRory Walsh
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
How does it kill instr1 before calling perf? I don't understand? You mean this code, which runs for 5 seconds?

instr 1
a1 vco2 1, 200
dispfft a1, .1, 2048, 0, 0, 0, 12, 1024
endin

I didn't think to look at the perf time stuff as min and max are i-rate arguments 

On 7 February 2016 at 15:25, jpff <jpff@codemist.co.uk> wrote:
I still have a problem in understanding your example.  It cals init on the display opcode but destroys instr 1 before calling perf.  This may be intended but I do not see how it happens.



On Sun, 7 Feb 2016, Rory Walsh wrote:

Thanks John. I should have thought to check that. 

On 7 February 2016 at 14:44, jpff <jpff@codemist.co.uk> wrote:
      Programmer error.  max and min cannot be known until te data is
      available in te drawing callback, not the initialisation.  In
      Rory's example there is still a question why tee is no perf-time
      calls to display.  Still investigating.
      ==John


Date2016-02-07 16:48
Fromjpff
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
The example I have is display rather than dispfft, but it runs an init 
phase on instr 1, and then decides the score has finished, and never calls 
the perf functions for display.  It seems to be looking at realtime events 
but I can see no reason that it is

--Csound version 6.07 (double samples) Feb  7 2016
graphics suppressed, ascii substituted
0dBFS level = 32768.0
orch now loaded
audio buffered in 256 sample-frame blocks
writing 512-byte blks of shorts to test.wav (WAV)
SECTION 1:
STARTING FILE
Skipping 
Creating orchestra
Creating score
WARNING: system constants can only be set once

WARNING: system constants can only be set once

WARNING: system constants can only be set once

WARNING: system constants can only be set once

new alloc for instr 1:
Init Max:0.000000
Min:0.000000
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.              overall amps:      0.0
            overall samples out of range:        0
0 errors in performance

i have been tracing with gdb, and it never calls the Draw callback.

On Sun, 7 Feb 2016, Rory Walsh wrote:

> How does it kill instr1 before calling perf? I don't understand? You mean this
> code, which runs for 5 seconds?
> instr 1
> a1 vco2 1, 200
> dispfft a1, .1, 2048, 0, 0, 0, 12, 1024
> endin
> 
> I didn't think to look at the perf time stuff as min and max are i-rate
> arguments 
> 
> On 7 February 2016 at 15:25, jpff  wrote:
>       I still have a problem in understanding your example.  It cals
>       init on the display opcode but destroys instr 1 before calling
>       perf.  This may be intended but I do not see how it happens.
> 
>
>       On Sun, 7 Feb 2016, Rory Walsh wrote:
>
>             Thanks John. I should have thought to check that. 
>
>             On 7 February 2016 at 14:44, jpff
>              wrote:
>                   Programmer error.  max and min cannot be known
>             until te data is
>                   available in te drawing callback, not the
>             initialisation.  In
>                   Rory's example there is still a question why tee
>             is no perf-time
>                   calls to display.  Still investigating.
>                   ==John
> 
> 
> 
>

Date2016-02-07 20:58
Fromjpff
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
I found a bug in the graph display code which bnegated any cal ti displat 
and hence the DrawGrapCallback thing.  I admit this was my error and fotr 
that I apologise -- sorry.

==John

On Sun, 7 Feb 2016, Rory Walsh wrote:

> How does it kill instr1 before calling perf? I don't understand? You mean this
> code, which runs for 5 seconds?
> instr 1
> a1 vco2 1, 200
> dispfft a1, .1, 2048, 0, 0, 0, 12, 1024
> endin
> 
> I didn't think to look at the perf time stuff as min and max are i-rate
> arguments 
> 
> On 7 February 2016 at 15:25, jpff  wrote:
>       I still have a problem in understanding your example.  It cals
>       init on the display opcode but destroys instr 1 before calling
>       perf.  This may be intended but I do not see how it happens.
> 
>
>       On Sun, 7 Feb 2016, Rory Walsh wrote:
>
>             Thanks John. I should have thought to check that. 
>
>             On 7 February 2016 at 14:44, jpff
>              wrote:
>                   Programmer error.  max and min cannot be known
>             until te data is
>                   available in te drawing callback, not the
>             initialisation.  In
>                   Rory's example there is still a question why tee
>             is no perf-time
>                   calls to display.  Still investigating.
>                   ==John
> 
> 
> 
>

Date2016-02-07 22:57
FromRory Walsh
SubjectRe: [Csnd-dev] WINDAT issue.. min and max members are always 0?
No apologies necessary. I'm sure if anyone else had run into this issue before now they would have reported it. Thanks again for looking into it. 

On 7 February 2016 at 20:58, jpff <jpff@codemist.co.uk> wrote:
I found a bug in the graph display code which bnegated any cal ti displat and hence the DrawGrapCallback thing.  I admit this was my error and fotr that I apologise -- sorry.

==John


On Sun, 7 Feb 2016, Rory Walsh wrote:

How does it kill instr1 before calling perf? I don't understand? You mean this
code, which runs for 5 seconds?
instr 1
a1 vco2 1, 200
dispfft a1, .1, 2048, 0, 0, 0, 12, 1024
endin

I didn't think to look at the perf time stuff as min and max are i-rate
arguments 

On 7 February 2016 at 15:25, jpff <jpff@codemist.co.uk> wrote:
      I still have a problem in understanding your example.  It cals
      init on the display opcode but destroys instr 1 before calling
      perf.  This may be intended but I do not see how it happens.


      On Sun, 7 Feb 2016, Rory Walsh wrote:

            Thanks John. I should have thought to check that. 

            On 7 February 2016 at 14:44, jpff
            <jpff@codemist.co.uk> wrote:
                  Programmer error.  max and min cannot be known
            until te data is
                  available in te drawing callback, not the
            initialisation.  In
                  Rory's example there is still a question why tee
            is no perf-time
                  calls to display.  Still investigating.
                  ==John