On Wed, Sep 28, 2016 at 11:45:11AM +0200, ander...@notam02.no wrote: > Hi Bill, others. > > I'm confused about (positive) offset argument to tap. > > Negative offsets yields perhaps expected results, but positive offsets > starts pulling values from what seems an odd offset into the line. > > (set! (*s7* 'print-length) 20) > > (define d1 (make-delay 10)) > > (do ((i 0 (+ 1 i))) > ((= i 10)) > (delay d1 i)) > > (mus-data d1) > => (float-vector 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0) > > (tap d1) > => 0.0 > (tap d1 1) > => 5.0 > (tap d1 -1) > => 1.0 > > (map (lambda (i) (tap d1 i)) '(0 1 2 3 4 5 6 7 8 9)) > => (0.0 5.0 4.0 3.0 2.0 1.0 0.0 9.0 8.0 7.0) > > (map (lambda (i) (tap d1 i)) '(-0 -1 -2 -3 -4 -5 -6 -7 -8 -9)) > => (0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0)
That's a bug with the modulus operator in c (int)-1 % (unsigned int)10 => 5 (int)-1 % (int)10 => -1 The follow patch seems ok: diff -ur snd-16~/clm.c snd-16/clm.c --- snd-16~/clm.c 2016-09-28 15:21:57.567364000 +0200 +++ snd-16/clm.c 2016-09-28 15:22:15.075143897 +0200 @@ -4382,7 +4382,7 @@ int taploc; if (gen->size == 0) return(gen->line[0]); if ((int)loc == 0) return(gen->line[gen->loc]); - taploc = (int)(gen->loc - (int)loc) % gen->size; + taploc = (int)(gen->loc - (int)loc) % (int)gen->size; if (taploc < 0) taploc += gen->size; return(gen->line[taploc]); } _______________________________________________ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist