I have a nyquist script using snd-fft api which have a random beaviour on my computer
where floats are 32 bits and long 64 bits.
Each time I execute the script, result is different, when it should be about equal.
I 'd like to know if same random issue occur on 32 bits systems.
-------------8<--- Here after extracts of the debian source
-------------8<--- ./lib-src/libnyquist/nyquist/nyqsrc/fft.c
110 * in the block. Here, there are 4 more longs after the size, and
111 * then room for 3*len floats (assumes that floats and longs take
112 * equal space).
130 window = (float *) &(s->extra[OFFSET + 2 * len]);
141 samples = (float *) &(s->extra[OFFSET]);
142 temp_fft = samples + len;
143 window = temp_fft + len;
// Note that as s->extra seams to be long pointer while samples and temp_fft seams to
// be float pointers, I am not confident that windows from line 130 and 143 might overlap.
-------------8<--- Here after the bits processor detector
// long_and_float_size.c
void main ()
{
printf ("sizeof ( long ) = %d\n", sizeof(long) );
printf ("sizeof ( float ) = %d\n", sizeof(float) );
return sizeof(float) == sizeof(long);
}
// :~$ ./a.out
// sizeof ( long ) = 8
// sizeof ( float ) = 4
-------------8<--- Here after the nyquist script
;nyquist plug-in
;version 1
;type analyze
;categories "http://audacityteam.org/namespace#OnsetDetector"
;name "FFT ..."
;action "FFT tests..."
;info "Released under terms of the GNU General Public License version 2"
;control freq_basses2 "Filtre basses Hz" int "" 40 5 200
(setf s1 (if (arrayp s) (snd-add (aref s 0) (aref s 1)) s))
; ajout des canaux gaucHe et droite dans un canal unifie, s1
(defun signal_basses () (force-srate 1000 (lp s1 60.0 ) ) )
; Filtre des frequences inferieures à 60 Hz
(setq l NIL )
(setq result-fft NIL)
(setq result-fft (snd-fft (snd-copy (signal_basses) ) 128 0 NIL ) )
(do ( (n 0) (X 1.0) )
( (> n 60) NIL )
(print (list n (aref result-fft (* 2 n ) ) ) )
(setq n ( + 1 n ) )
)
(setq label "toto")
(setq l (cons (list 0.0 label) l))
l