small changes
This commit is contained in:
parent
12a9447ef4
commit
d4eb5691c1
6 changed files with 65 additions and 52 deletions
|
@ -2,21 +2,34 @@
|
||||||
|
|
||||||
(require oregano)
|
(require oregano)
|
||||||
|
|
||||||
|
(display "start\n")
|
||||||
#|
|
|
||||||
(define my-note (play-note "sin-inst" 440))
|
(define my-note (play-note "sin-inst" 440))
|
||||||
(sleep 1)
|
(sleep 1)
|
||||||
;; stop playing note
|
;; stop playing note
|
||||||
(note-off my-note)
|
(note-off my-note)
|
||||||
|
(display "end note1\n")
|
||||||
|
|
||||||
|
(define my-note2 (play-note "saw-inst" 880))
|
||||||
|
(sleep 2)
|
||||||
|
(note-off my-note2)
|
||||||
|
(display "end note2\n")
|
||||||
|
|
||||||
|
(sleep 1)
|
||||||
|
|
||||||
|
(define my-note3 (play-note "sin-inst" 500))
|
||||||
|
(sleep 1)
|
||||||
|
;; stop playing note
|
||||||
|
(note-off my-note3)
|
||||||
|
|
||||||
|
|
||||||
|
#;(
|
||||||
(define my-note2 (make-note "sin-inst" 880))
|
(define my-note2 (make-note "sin-inst" 880))
|
||||||
(note-on my-note2)
|
(note-on my-note2)
|
||||||
(sleep 1)
|
(sleep 1)
|
||||||
(note-off my-note2)
|
(note-off my-note2)
|
||||||
|#
|
)
|
||||||
|
|
||||||
|
#|
|
||||||
(make-instrument "my-inst" ([freq 500] [mod 20])
|
(make-instrument "my-inst" ([freq 500] [mod 20])
|
||||||
(mul (sin-osc ar mod 0)
|
(mul (sin-osc ar mod 0)
|
||||||
(sin-osc ar freq 0)))
|
(sin-osc ar freq 0)))
|
||||||
|
@ -26,4 +39,6 @@
|
||||||
(lambda (val)
|
(lambda (val)
|
||||||
(set-note-param weird-note "mod" val)))
|
(set-note-param weird-note "mod" val)))
|
||||||
|
|
||||||
(show-gui)
|
(show-gui)
|
||||||
|
|
||||||
|
|#
|
|
@ -67,13 +67,9 @@
|
||||||
[callback (lambda (element event)
|
[callback (lambda (element event)
|
||||||
(func (gui:send element get-value)))]))
|
(func (gui:send element get-value)))]))
|
||||||
|
|
||||||
#;(new gui:check-box%
|
(define (note-button the-note name)
|
||||||
[label "note-on"]
|
(new gui:button% [parent frame]
|
||||||
[parent frame]
|
[label name]
|
||||||
[value #f]
|
[callback (lambda (s event)
|
||||||
[callback (lambda (element event)
|
(display event))]))
|
||||||
(if (gui:send element get-value)
|
|
||||||
(send-msg (n-run1 1001 1))
|
|
||||||
(send-msg (n-run1 1001 0))))])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
|
|
||||||
(require rsc3)
|
(require rsc3 "system.rkt")
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
(all-from-out rsc3))
|
(all-from-out rsc3))
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
;; TODO - remove. using "signal-slider" for testing
|
;; TODO - remove. using "signal-slider" for testing
|
||||||
(require "gui.rkt")
|
(require "gui.rkt")
|
||||||
|
|
||||||
|
(run-super-collider)
|
||||||
|
|
||||||
|
|
||||||
(define current-node-id 1000)
|
(define current-node-id 1000)
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
(letc ([bus 0]
|
(letc ([bus 0]
|
||||||
[freq 440])
|
[freq 440])
|
||||||
(out bus (mul 0.2 (wave-func ar freq 0)))))
|
(out bus (mul 0.2 (wave-func ar freq 0)))))
|
||||||
|
|
||||||
(define sin-instrument
|
(define sin-instrument
|
||||||
(letc ([bus 0]
|
(letc ([bus 0]
|
||||||
[freq 440])
|
[freq 440])
|
||||||
|
@ -47,15 +48,15 @@
|
||||||
(mul (saw ar freq) 0.1)
|
(mul (saw ar freq) 0.1)
|
||||||
(mouse-y kr 200 30000 1 0.1) 3 0))))
|
(mouse-y kr 200 30000 1 0.1) 3 0))))
|
||||||
|
|
||||||
;; TODO
|
;; other way
|
||||||
#;(define (make-instrument name graph)
|
#;(define (make-instrument name graph)
|
||||||
(let ([sd (letc ([bus 0])
|
(let ([sd (letc ([bus 0])
|
||||||
(out bus ugen))]
|
(out bus ugen))]
|
||||||
;[name (format "synth~a" current-node-id)]
|
;[name (format "synth~a" current-node-id)]
|
||||||
)
|
)
|
||||||
(with-sc3 (lambda (fd)
|
(with-sc3 (lambda (fd)
|
||||||
(send-synth fd name sd)))
|
(send-synth fd name sd)))
|
||||||
))
|
))
|
||||||
|
|
||||||
(define-syntax-rule (make-instrument inst-name ([argname argdefault] ...) ugen)
|
(define-syntax-rule (make-instrument inst-name ([argname argdefault] ...) ugen)
|
||||||
(let ([sd (letc ([bus 0]
|
(let ([sd (letc ([bus 0]
|
||||||
|
@ -68,8 +69,8 @@
|
||||||
|
|
||||||
;; example of definst macro like overtone's definst
|
;; example of definst macro like overtone's definst
|
||||||
#;(define-syntax-rule (define-instrument inst-name [[argname argdefault] ...] ugen)
|
#;(define-syntax-rule (define-instrument inst-name [[argname argdefault] ...] ugen)
|
||||||
(define (inst-name [argname argdefault] ...)
|
(define (inst-name [argname argdefault] ...)
|
||||||
(+ argname ...)))
|
(+ argname ...)))
|
||||||
|
|
||||||
(define perset-instrument-map
|
(define perset-instrument-map
|
||||||
`(("sin-inst" ,sin-instrument)
|
`(("sin-inst" ,sin-instrument)
|
||||||
|
@ -77,34 +78,33 @@
|
||||||
("moog-inst" ,moog-instrument)))
|
("moog-inst" ,moog-instrument)))
|
||||||
|
|
||||||
;; send synthdefs
|
;; send synthdefs
|
||||||
(map (lambda (pair)
|
(for ([pair perset-instrument-map])
|
||||||
(with-sc3 (lambda (fd)
|
(with-sc3 (lambda (fd)
|
||||||
(send-synth fd (first pair) (second pair)))))
|
(send-synth fd (first pair) (second pair)))))
|
||||||
perset-instrument-map)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; === user note funcs ===
|
; === user note funcs ===
|
||||||
|
|
||||||
(struct note (id [freq #:mutable]))
|
(struct note (id [freq #:mutable]) #:transparent)
|
||||||
|
|
||||||
(define (create-synth name play-on-start)
|
(define (create-synth name play-on-start)
|
||||||
(define node-id (gen-node-id))
|
(define node-id (gen-node-id))
|
||||||
(send-msg (s-new0 name node-id 1 1))
|
(send-msg (s-new0 name node-id 1 1))
|
||||||
|
;; TODO - send in bundle. it run 0 may be sent after
|
||||||
; don't make sound upon creation
|
; don't make sound upon creation
|
||||||
(if play-on-start
|
(if play-on-start
|
||||||
empty
|
empty
|
||||||
(send-msg (n-run1 node-id 0)))
|
(send-msg (n-run1 node-id 0)))
|
||||||
node-id)
|
node-id)
|
||||||
|
|
||||||
#;(define (preset-instrument name)
|
|
||||||
(let ([node-id (gen-node-id)])
|
|
||||||
(create-synth name node-id)))
|
|
||||||
|
|
||||||
(define (make-note/option inst-name freq play-on-start)
|
(define (make-note/option inst-name freq play-on-start)
|
||||||
(define node-id (create-synth inst-name play-on-start))
|
(define id (create-synth inst-name play-on-start))
|
||||||
(note node-id freq))
|
(send-msg (n-set1 id "freq" freq))
|
||||||
|
(note id freq))
|
||||||
|
|
||||||
(define (play-note inst-name freq)
|
(define (play-note inst-name freq)
|
||||||
(make-note/option inst-name freq #t))
|
(make-note/option inst-name freq #t))
|
||||||
|
@ -117,30 +117,33 @@
|
||||||
(define (note-on the-note)
|
(define (note-on the-note)
|
||||||
;(send-msg (n-set1 inst "bus" track)) ; TODO
|
;(send-msg (n-set1 inst "bus" track)) ; TODO
|
||||||
(send-msg (n-run1 (note-id the-note) 1))
|
(send-msg (n-run1 (note-id the-note) 1))
|
||||||
(send-msg (n-set1 (note-id the-note) "freq" (note-freq the-note))))
|
(send-msg (n-set1 (note-id the-note) "freq" (note-freq the-note)))
|
||||||
|
(void))
|
||||||
|
|
||||||
(define (note-off the-note)
|
(define (note-off the-note)
|
||||||
(send-msg (n-run1 (note-id the-note) 0)))
|
(send-msg (n-run1 (note-id the-note) 0))
|
||||||
|
(void))
|
||||||
|
|
||||||
|
|
||||||
(define (set-note-param the-note name val)
|
(define (set-note-param the-note name val)
|
||||||
(if (eq? name "freq")
|
(if (eq? name "freq")
|
||||||
(set-note-freq! the-note val)
|
(set-note-freq! the-note val)
|
||||||
empty)
|
empty)
|
||||||
(send-msg (n-set1 (note-id the-note) name val)))
|
(send-msg (n-set1 (note-id the-note) name val))
|
||||||
|
(void))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#|
|
#|
|
||||||
|
|
||||||
- to stop/run:
|
- to stop/run:
|
||||||
(send-msg (n-run1 1001 1))
|
(send-msg (n-run1 1001 1))
|
||||||
|
|
||||||
|#
|
|#
|
||||||
|
|
||||||
|
|
||||||
;; ======== example useage ===========
|
;; ======== example useage ===========
|
||||||
#|
|
#|
|
||||||
(define my-sin (preset-instrument "sin-inst"))
|
(define my-sin (preset-instrument "sin-inst"))
|
||||||
|
|
||||||
(param-slider "change frequency" 300 1000 400
|
(param-slider "change frequency" 300 1000 400
|
||||||
|
@ -162,3 +165,4 @@
|
||||||
; (note-off my-sin)
|
; (note-off my-sin)
|
||||||
|
|
||||||
|#
|
|#
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
|
|
||||||
(require "instrument.rkt"
|
(require "instrument.rkt"
|
||||||
"gui.rkt"
|
"gui.rkt"
|
||||||
"sample.rkt"
|
"sample.rkt"
|
||||||
|
@ -9,7 +8,8 @@
|
||||||
;; setup
|
;; setup
|
||||||
(require rsc3)
|
(require rsc3)
|
||||||
|
|
||||||
|
;; FIXME - not running
|
||||||
|
(display "Hello! from main.rkt\n")
|
||||||
(run-super-collider)
|
(run-super-collider)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,4 @@ sleep 1
|
||||||
jack_connect -s default SuperCollider:out_1 system:playback_1
|
jack_connect -s default SuperCollider:out_1 system:playback_1
|
||||||
jack_connect -s default SuperCollider:out_2 system:playback_2
|
jack_connect -s default SuperCollider:out_2 system:playback_2
|
||||||
|
|
||||||
# go to scsynth
|
|
||||||
fg
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
|
|
||||||
;; run scsynth
|
;; run scsynth
|
||||||
(define (run-super-collider)
|
(define (run-super-collider)
|
||||||
|
(display "in run-super-collider\n")
|
||||||
(match (system-type 'os)
|
(match (system-type 'os)
|
||||||
('unix (if (system "ps -e | grep scsynth > /dev/null")
|
('unix (if (system "ps -e | grep scsynth > /dev/null")
|
||||||
(display "SuperCollider Running\n")
|
(display "SuperCollider Running\n")
|
||||||
(begin
|
(begin
|
||||||
(display "Starting SuperCollider...")
|
(display "Starting SuperCollider...")
|
||||||
(process "./start_server_linux.sh")
|
(process "./start_server_linux.sh")
|
||||||
(sleep 0.3)
|
(sleep 0.5)
|
||||||
(if (system "ps -e | grep scsynth > /dev/null")
|
(if (system "ps -e | grep scsynth > /dev/null")
|
||||||
(display "OK")
|
(display "OK")
|
||||||
(display "Error")))))
|
(display "Error")))))
|
||||||
|
|
Loading…
Reference in a new issue