From ce122871ebb5a9ca4e0604dd74a3ed99f0013759 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Fri, 13 Jun 2014 16:41:36 -0700 Subject: [PATCH] provide sample funcs, update todo & tut --- oregano/TODO.md | 6 +++--- oregano/Tutorial.md | 9 +++++++++ oregano/sample.rkt | 46 +++------------------------------------------ 3 files changed, 15 insertions(+), 46 deletions(-) diff --git a/oregano/TODO.md b/oregano/TODO.md index 8427265..c6097e8 100644 --- a/oregano/TODO.md +++ b/oregano/TODO.md @@ -2,13 +2,13 @@ ## Wed -- envelopes +- [ ] envelopes * learn how envgen works. * make preset envelopes? -- load samples +- [x] load samples -- sequencing (at) +- [ ] sequencing (at) diff --git a/oregano/Tutorial.md b/oregano/Tutorial.md index 9610ad6..e1b521c 100644 --- a/oregano/Tutorial.md +++ b/oregano/Tutorial.md @@ -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 diff --git a/oregano/sample.rkt b/oregano/sample.rkt index 1ba5dea..0d858be 100644 --- a/oregano/sample.rkt +++ b/oregano/sample.rkt @@ -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) - - - -|# \ No newline at end of file