test/test-make-tone.rkt
#lang racket

(require (planet clements/rsound)
         (planet clements/rsound/integral-cycles)
         rackunit)


;; tests of integral-cycles:
(check-equal? (cycles-to-use 441 44100.0) 1)
(check-equal? (cycles-to-use 440 44100.0) 22)
(check-equal? (cycles-to-use (* 440 (expt 2 1/12)) 44100.0) 103)

;; this is a performance test, to see whether
;; caching and caching of cycles is working correctly.

(define-values (dc t1 t2 t3)
  (time-apply
   (lambda ()
     (map
      (lambda (p) (apply make-tone p))
      '((130.8127826502993 91/1270 220040)
        (130.8127826502993 91/1270 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (130.8127826502993 10/127 220040)
        (146.8323839587038 89/1270 330290)
        (146.8323839587038 89/1270 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (146.8323839587038 10/127 330290)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 51/635 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 51/635 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (164.81377845643496 10/127 330290)
        (164.81377845643496 10/127 220040)
        (174.61411571650194 44/635 110020)
        (174.61411571650194 44/635 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (174.61411571650194 10/127 110020)
        (195.99771799087463 48/635 111168)
        (195.99771799087463 48/635 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 109790)
        (195.99771799087463 10/127 111168)
        (195.99771799087463 10/127 111168)
        (207.65234878997256 99/1270 109790)
        (207.65234878997256 99/1270 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (207.65234878997256 10/127 109790)
        (220 91/1270 220040)
        (220 91/1270 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (220 10/127 220040)
        (261.6255653005986 91/1270 220040)
        (261.6255653005986 99/1270 109790)
        (261.6255653005986 91/1270 220040)
        (261.6255653005986 99/1270 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (261.6255653005986 10/127 220040)
        (261.6255653005986 10/127 109790)
        (293.6647679174076 89/1270 330290)
        (293.6647679174076 89/1270 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (293.6647679174076 10/127 330290)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 51/635 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 51/635 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (329.6275569128699 10/127 330290)
        (329.6275569128699 10/127 220040)
        (349.2282314330039 44/635 110020)
        (349.2282314330039 44/635 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (349.2282314330039 10/127 110020)
        (391.99543598174927 48/635 111168)
        (391.99543598174927 48/635 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 109790)
        (391.99543598174927 10/127 111168)
        (391.99543598174927 10/127 111168)
        (415.3046975799451 99/1270 109790)
        (415.3046975799451 99/1270 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (415.3046975799451 10/127 109790)
        (440 91/1270 220040)
        (440 91/1270 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (440 10/127 220040)
        (523.2511306011972 99/1270 109790)
        (523.2511306011972 99/1270 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790)
        (523.2511306011972 10/127 109790))))
   (list)))

(check < t1 1000)