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
|
## Wed
|
||||||
|
|
||||||
- envelopes
|
- [ ] envelopes
|
||||||
* learn how envgen works.
|
* learn how envgen works.
|
||||||
* make preset envelopes?
|
* make preset envelopes?
|
||||||
|
|
||||||
- load samples
|
- [x] load samples
|
||||||
|
|
||||||
- sequencing (at)
|
- [ ] sequencing (at)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,15 @@ Example:
|
||||||
(play-sample synth-hit1 2)
|
(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
|
### Envelopes
|
||||||
|
|
|
@ -2,20 +2,10 @@
|
||||||
|
|
||||||
(require rsc3 rhs/rhs)
|
(require rsc3 rhs/rhs)
|
||||||
|
|
||||||
(reset)
|
|
||||||
(send-msg (dump-osc 1))
|
|
||||||
|
|
||||||
;; load a smple in a buffer
|
(provide load-sample
|
||||||
; (send-async-msg (b-alloc-read 42 "./Samples/Synth Hits/Synth Hit 01.wav" 0 0))
|
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))
|
(struct sample (buf len))
|
||||||
|
|
||||||
|
@ -33,54 +23,24 @@
|
||||||
(sample id 0))))
|
(sample id 0))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define sample-player-ugen
|
(define sample-player-ugen
|
||||||
(letc ([buf 0]
|
(letc ([buf 0]
|
||||||
[bus 0]
|
[bus 0]
|
||||||
[rate 1])
|
[rate 1])
|
||||||
(out bus (play-buf 2 buf rate 1 0 0))))
|
(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])
|
(define (play-sample smpl [rate 1])
|
||||||
(send-msg (s-new2 "sample-player" -1 1 1
|
(send-msg (s-new2 "sample-player" -1 1 1
|
||||||
"buf" (sample-buf smpl)
|
"buf" (sample-buf smpl)
|
||||||
"rate" rate)))
|
"rate" rate)))
|
||||||
|
|
||||||
|
;; send sample-player synthdef
|
||||||
|
|
||||||
|
|
||||||
#;(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.
|
|
||||||
(with-sc3 (lambda (fd)
|
(with-sc3 (lambda (fd)
|
||||||
(send-synth fd "sample-player" sample-player-ugen)))
|
(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