provide sample funcs, update todo & tut
This commit is contained in:
parent
895ed4cb55
commit
ce122871eb
3 changed files with 15 additions and 46 deletions
|
@ -2,13 +2,13 @@
|
|||
|
||||
## Wed
|
||||
|
||||
- envelopes
|
||||
- [ ] envelopes
|
||||
* learn how envgen works.
|
||||
* make preset envelopes?
|
||||
|
||||
- load samples
|
||||
- [x] load samples
|
||||
|
||||
- sequencing (at)
|
||||
- [ ] sequencing (at)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -184,6 +184,15 @@ Example:
|
|||
(play-sample synth-hit1 2)
|
||||
```
|
||||
|
||||
### Play a note in the future
|
||||
|
||||
Currently not working, or the start-time syntax is wrong.
|
||||
|
||||
`(play-note start-time duration instrument frequency)`
|
||||
|
||||
`(play-note-at 2 1 "sin-inst" 440)`
|
||||
|
||||
|
||||
|
||||
---
|
||||
### Envelopes
|
||||
|
|
|
@ -2,20 +2,10 @@
|
|||
|
||||
(require rsc3 rhs/rhs)
|
||||
|
||||
(reset)
|
||||
(send-msg (dump-osc 1))
|
||||
|
||||
;; load a smple in a buffer
|
||||
; (send-async-msg (b-alloc-read 42 "./Samples/Synth Hits/Synth Hit 01.wav" 0 0))
|
||||
(provide load-sample
|
||||
play-sample)
|
||||
|
||||
(define fname "./Samples/Synth Hits/Synth Hit 01.wav")
|
||||
|
||||
#|
|
||||
(send-async-msg (b-alloc 0 16380 2))
|
||||
(send-async-msg (b-read 0 fname 0 -1 0 1))
|
||||
|
||||
(audition (out 0 (disk-in 2 ar 0)))
|
||||
|#
|
||||
|
||||
(struct sample (buf len))
|
||||
|
||||
|
@ -33,54 +23,24 @@
|
|||
(sample id 0))))
|
||||
|
||||
|
||||
|
||||
(define sample-player-ugen
|
||||
(letc ([buf 0]
|
||||
[bus 0]
|
||||
[rate 1])
|
||||
(out bus (play-buf 2 buf rate 1 0 0))))
|
||||
|
||||
(with-sc3 (lambda (fd)
|
||||
(send-synth fd "sample-player" sample-player-ugen)))
|
||||
|
||||
|
||||
(define (play-sample smpl [rate 1])
|
||||
(send-msg (s-new2 "sample-player" -1 1 1
|
||||
"buf" (sample-buf smpl)
|
||||
"rate" rate)))
|
||||
|
||||
|
||||
|
||||
|
||||
#;(with-sc3 (lambda (fd)
|
||||
(send-synth fd "sample-player"
|
||||
(letc ([buf 0]
|
||||
[bus 0])
|
||||
(out bus (disk-in 2 ar buf))))))
|
||||
|
||||
#|
|
||||
|
||||
; make a synth and free it.
|
||||
;; send sample-player synthdef
|
||||
(with-sc3 (lambda (fd)
|
||||
(send-synth fd "sample-player" sample-player-ugen)))
|
||||
|
||||
; (send-async-msg (b-alloc-read 3 "./Samples/Synth Hits/Synth Hit 01.wav" 0 0))
|
||||
(send-async-msg (b-alloc-read 3 "/home/pack/bass2.wav" 0 0))
|
||||
|
||||
(send-msg (s-new1 "sample-player" 1001 1 1 "buf" 3))
|
||||
|
||||
|
||||
> (audition (out 0 (disk-in 2 ar 3)))
|
||||
|
||||
---
|
||||
;; more civil
|
||||
(define s (load-sample "/home/pack/bass2.wav"))
|
||||
|
||||
(play-sample s)
|
||||
|
||||
|
||||
|
||||
|#
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue