(require (planet clements/portaudio:3:1)
(define sample-rates '(44100.0 48000.0))
(define s16vec-len 24000)
(define s16vec (make-s16vector (* 2 s16vec-len)))
(for ([i s16vec-len])
(* 32767 (* 0.2 (sin (* i 440.0 2.0 pi (/ 1.0 44100.0))))))))
(s16vector-set! s16vec (* i 2) sample)
(s16vector-set! s16vec (add1 (* i 2)) sample))
(define host-apis (all-host-apis))
(printf "found ~s host API(s): ~s\n"
(printf "trying each one in turn.\n")
(for ([api host-apis])
(printf "trying api ~s:\n" api)
(for ([sr sample-rates])
(printf "trying to play at sample rate ~s:\n" sr)
"playing sound failed with message: ~s\n"
(s16vec-play s16vec 0 s16vec-len sr)
(sleep (+ 1.0 (/ s16vec-len sr)))
(printf "~a" followup-message))
If playback at 44100.0 failed and playback at another sample rate
succeeded using Windows 7, you probably need to manually set the
sample rate of that playback device to 44100 Hz, by right-clicking
on the volume icon and then digging through menus (properties, advanced).