Reproducing a sine wave using rsound

I wrote this code after reading the rsound documentation in Racket:

#lang racket
(provide (all-defined-out))
(require rsound)


(define (sunet)
  (sine-wave 880))

(signal-play sunet)

(stop)

I used the sine wave function at 880 Hz and saved it in the sunet function. Then I applied the signal-to-play function on it, which reproduces the signals as sound. I got this error:

application: not a procedure;
 expected a procedure that can be applied to arguments
  given: #<network/s>
  arguments.:
   880
> 

Is it not a “sinusoidal” function and does it take frequency as an argument?

+4
source share
2 answers

I read more rsound documentation and read about networks. Apparently, you need to create a network with an input signal and an output signal that goes to something like a signal.

, :

(define sunet
  (network ()
       [A5 <= sine-wave 880]
       [out = A5]))

(signal-play sunet)

(sleep 3)

(stop)

powerchord:

(define sunet
  (network ()
       [E2 <= sine-wave 82]
       [B2 <= sine-wave 123]
       [out = (+ E2 B2)]))
(signal-play sunet)
(sleep 3)
(stop)

, .

+3

, . sine-wave , . .

    #lang racket
    (require rsound)

    (define s (network ()
                 [a <= sine-wave 880]
                 [out = a]))
    (signal-play s)

, :

    #lang racket
    (require rsound)

    (define s (network ()
                 [out = sine-wave 880]))
    (signal-play s)
0

Source: https://habr.com/ru/post/1624844/


All Articles