[racket] RSound trouble with rs-write
On Oct 24, 2013, at 3:20 AM, Robert Matovinovic wrote:
> Hello,
> I’m experimenting with the rsound package and ran into a problem. I can play the sound but I can’t write it into a wav file with rs-write.
> Here a little code to reproduce the error on my machine Thinkpad, Windows 7, 64bit.
How embarrassing! I had lots of tests, but none for rs-write on a sound with inexact frame rate... which make-tone now generates.
Fixed and pushed.
BUT!
Current development of RSound uses Racket's new "package" system, which replaces PLaneT. Versions of DrRacket prior to 5.3.5 do not support this system. So (apologies if this isn't the case) I'm going to assume that you're using at least v5.3.5.
Also, in 5.3.5 and 5.3.6, the support for installing dependencies is a bit rough, so you must install portaudio first, and then rsound second.
In order to install the rsound package from within DrRacket: Choose File > Install Package... , and then enter
portaudio
... and click OK. This should finish successfully in less than two minutes. Then, repeat the process for the package named
rsound
. For some reason, version 5.3.5 and 5.3.6 seem occasionally to hang while building docs for rsound... if this happens to you (it says it's building docs, nothing's appeared in the install window for two or three minutes), just click "abort installation", and you should find that it's installed successfully.
Phew!
Following this, you should be able to run this version of your code:
#lang racket
(require rsound)
; setting of host-api for sound otherwise no sound is heard
(host-api 'paMME)
; sample rate for host-api set in OS settings
(define frame-rate 44100)
(define tone (make-tone 440 1 frame-rate))
tone
(play tone)
(rs-write tone "test-tone")
... note that the 'require' line no longer specifies a planet package.
Let me know if you have any trouble!
John Clements