Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example program from docs fails #33

Open
soegaard opened this issue Oct 5, 2017 · 1 comment
Open

Example program from docs fails #33

soegaard opened this issue Oct 5, 2017 · 1 comment

Comments

@soegaard
Copy link

soegaard commented Oct 5, 2017

On OS X the example program below from the docs fails.
The error message is:
s16vector-ref: bad index 88800 for s16vector bounds of 0..88199
DrRacket highlights the form:
(rs-ith/left waveform i)

I attempted this on a 6.7 (standard) and 6.90 (racket7 branch).

#lang racket
 
(require rsound)
 
(define waveform (synth-waveform "vgame" 4))
 
; wrap i around when it goes off the end:
(define (maybe-wrap i)
  (cond [(< i 48000) i]
        [else (- i 48000)]))
 
; a signal that plays from a waveform:
(define loop-sig
  (network (pitch)
    [i = (maybe-wrap (+ (prev i 0) (round pitch)))]
    [out = (rs-ith/left waveform i)]))
 
(signal-play
 (network ()
   [alternator <= square-wave 2]
   [s <= loop-sig (+ (* 200 (inexact->exact alternator)) 400)]
   [out = (* s 0.1)]))

@soegaard
Copy link
Author

Just checked. The same error occurs on 7.5.

The example is in this section:

https://docs.racket-lang.org/rsound/index.html#%28part._.Sample_.Code%29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant