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)
|
||||
|
||||
|
||||
#|
|
||||
(display "start\n")
|
||||
(define my-note (play-note "sin-inst" 440))
|
||||
(sleep 1)
|
||||
;; stop playing 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))
|
||||
(note-on my-note2)
|
||||
(sleep 1)
|
||||
(note-off my-note2)
|
||||
|#
|
||||
)
|
||||
|
||||
#|
|
||||
(make-instrument "my-inst" ([freq 500] [mod 20])
|
||||
(mul (sin-osc ar mod 0)
|
||||
(sin-osc ar freq 0)))
|
||||
|
@ -27,3 +40,5 @@
|
|||
(set-note-param weird-note "mod" val)))
|
||||
|
||||
(show-gui)
|
||||
|
||||
|#
|
|
@ -67,13 +67,9 @@
|
|||
[callback (lambda (element event)
|
||||
(func (gui:send element get-value)))]))
|
||||
|
||||
#;(new gui:check-box%
|
||||
[label "note-on"]
|
||||
[parent frame]
|
||||
[value #f]
|
||||
[callback (lambda (element event)
|
||||
(if (gui:send element get-value)
|
||||
(send-msg (n-run1 1001 1))
|
||||
(send-msg (n-run1 1001 0))))])
|
||||
|
||||
(define (note-button the-note name)
|
||||
(new gui:button% [parent frame]
|
||||
[label name]
|
||||
[callback (lambda (s event)
|
||||
(display event))]))
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#lang racket
|
||||
|
||||
|
||||
(require rsc3)
|
||||
(require rsc3 "system.rkt")
|
||||
|
||||
(provide
|
||||
(all-from-out rsc3))
|
||||
|
@ -11,6 +11,7 @@
|
|||
;; TODO - remove. using "signal-slider" for testing
|
||||
(require "gui.rkt")
|
||||
|
||||
(run-super-collider)
|
||||
|
||||
|
||||
(define current-node-id 1000)
|
||||
|
@ -47,7 +48,7 @@
|
|||
(mul (saw ar freq) 0.1)
|
||||
(mouse-y kr 200 30000 1 0.1) 3 0))))
|
||||
|
||||
;; TODO
|
||||
;; other way
|
||||
#;(define (make-instrument name graph)
|
||||
(let ([sd (letc ([bus 0])
|
||||
(out bus ugen))]
|
||||
|
@ -77,34 +78,33 @@
|
|||
("moog-inst" ,moog-instrument)))
|
||||
|
||||
;; send synthdefs
|
||||
(map (lambda (pair)
|
||||
(for ([pair perset-instrument-map])
|
||||
(with-sc3 (lambda (fd)
|
||||
(send-synth fd (first pair) (second pair)))))
|
||||
perset-instrument-map)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; === user note funcs ===
|
||||
|
||||
(struct note (id [freq #:mutable]))
|
||||
(struct note (id [freq #:mutable]) #:transparent)
|
||||
|
||||
(define (create-synth name play-on-start)
|
||||
(define node-id (gen-node-id))
|
||||
(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
|
||||
(if play-on-start
|
||||
empty
|
||||
(send-msg (n-run1 node-id 0)))
|
||||
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 node-id (create-synth inst-name play-on-start))
|
||||
(note node-id freq))
|
||||
(define id (create-synth inst-name play-on-start))
|
||||
(send-msg (n-set1 id "freq" freq))
|
||||
(note id freq))
|
||||
|
||||
(define (play-note inst-name freq)
|
||||
(make-note/option inst-name freq #t))
|
||||
|
@ -117,17 +117,20 @@
|
|||
(define (note-on the-note)
|
||||
;(send-msg (n-set1 inst "bus" track)) ; TODO
|
||||
(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)
|
||||
(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)
|
||||
(if (eq? name "freq")
|
||||
(set-note-freq! the-note val)
|
||||
empty)
|
||||
(send-msg (n-set1 (note-id the-note) name val)))
|
||||
(send-msg (n-set1 (note-id the-note) name val))
|
||||
(void))
|
||||
|
||||
|
||||
|
||||
|
@ -162,3 +165,4 @@
|
|||
; (note-off my-sin)
|
||||
|
||||
|#
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
#lang racket
|
||||
|
||||
|
||||
(require "instrument.rkt"
|
||||
"gui.rkt"
|
||||
"sample.rkt"
|
||||
|
@ -9,7 +8,8 @@
|
|||
;; setup
|
||||
(require rsc3)
|
||||
|
||||
|
||||
;; FIXME - not running
|
||||
(display "Hello! from main.rkt\n")
|
||||
(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_2 system:playback_2
|
||||
|
||||
# go to scsynth
|
||||
fg
|
||||
|
||||
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
|
||||
;; run scsynth
|
||||
(define (run-super-collider)
|
||||
(display "in run-super-collider\n")
|
||||
(match (system-type 'os)
|
||||
('unix (if (system "ps -e | grep scsynth > /dev/null")
|
||||
(display "SuperCollider Running\n")
|
||||
(begin
|
||||
(display "Starting SuperCollider...")
|
||||
(process "./start_server_linux.sh")
|
||||
(sleep 0.3)
|
||||
(sleep 0.5)
|
||||
(if (system "ps -e | grep scsynth > /dev/null")
|
||||
(display "OK")
|
||||
(display "Error")))))
|
||||
|
|
Loading…
Reference in a new issue