lisp-gui-examples icon indicating copy to clipboard operation
lisp-gui-examples copied to clipboard

Wrong formula for frequency->position

Open jn64 opened this issue 2 years ago • 0 comments

https://github.com/goober99/lisp-gui-examples/blob/90a76681ed27c378abc6a47ad563c72c114bed88/examples/racket/bleep.rkt#L41-L43

Taking the relevant portion from the racket example:

(/ (- (log freq) min-freq) (+ frequency-scale *min-position*))

should instead be:

(+ *min-position* (/ (- (log freq) min-freq) frequency-scale))

The bug can't be noticed in the example because *min-position* is always 0, so the wrong formula still gives the "correct" result. If *min-position* was >0, then the bug would be immediately apparent (all results would be abnormally small).

I have not checked the other language examples.

jn64 avatar Aug 26 '23 06:08 jn64