From j_hearon at hotmail.com Thu Aug 11 10:33:35 2016 From: j_hearon at hotmail.com (James Hearon) Date: Thu, 11 Aug 2016 17:33:35 +0000 Subject: [CM] scheme, larger structures In-Reply-To: References: Message-ID: Hi, I had written about a scheme method to do something similar to CLM's with-mix for larger compositional structures using multiple instruments and Bill had replied... "If you want to concatenate several with-sounds into one, just concatenate the instrument calls, with some variable holding the section's start time." I tried several ways to concatenate definstrument calls and place those with the body of with-sound, but nothing seems to work. It seems like ws.scm just wants a direct call to a definstrument in the body part. I gave up and tried concatenating with-sound blocks instead, and it works after a fashion but the creation of separate audio files means those still have to be stitched together at some point. At least this is getting closer to what I was after. regards, Jim (load "/opt/snd-16/CM_patterns.scm") (define (round-off z n) (let ((power (expt 10 n))) (/ (round (* power z)) power))) (definstrument (examp1 start-time duration frequency amplitude) (let* ((beg (seconds->samples start-time)) (end (+ beg (seconds->samples duration))) (sine-wave (make-oscil :frequency frequency))) (do ((i beg (+ i 1))) ((= i end)) (let ((x (* amplitude (oscil sine-wave)))) (outa i x) (outb i x))))) (definstrument (examp2 start-time duration frequency amplitude) (let* ((beg (seconds->samples start-time)) (end (+ beg (seconds->samples duration))) (gen (make-polywave :frequency frequency :partials '(1 1.69 3 5)))) (do ((i beg (+ i 1))) ((= i end)) (let ((x (* amplitude (polywave gen)))) (outa i x) (outb i x) )))) (let ((var '()) (aaa (make-heap '(360 800.345 1200 600))) ;freq (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;dur (ccc (make-heap '(241 840.345 1000 960 500))) ;freq (ddd (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;dur ) (set! var (cons (with-sound (:reverb nrev :output "Test1.wav" :srate 48000 :channels 2 :header-type mus-riff :statistics #t :play #t) (let ((i 0)) (do ((k 0 (+ k 1))) ((>= k 25)) (let ((v (next bbb))) (examp1 i v (next aaa) .3) (set! i (+ (round-off i 2) v)) )))) ;;end of with-sound (with-sound (:output "Test2.wav" :srate 48000 :channels 2 :header-type mus-riff :statistics #t :play #t) (let ((j 1)) (do ((k 0 (+ k 1))) ((>= k 25)) (let ((v (next ddd))) (examp2 j v (next ccc) .1) (set! j (+ (round-off j 2) v)) )))) ;;end of with-sound ) ;end var ) ;end set! var ) ;end let -------------- next part -------------- An HTML attachment was scrubbed... URL: From andersvi at notam02.no Tue Aug 16 06:20:50 2016 From: andersvi at notam02.no (andersvi at notam02.no) Date: Tue, 16 Aug 2016 15:20:50 +0200 Subject: [CM] scheme, larger structures References: Message-ID: <87ziocvoi5.fsf@bek.no> Hi James. >>>>> "J" == James Hearon writes: J> I gave up and tried concatenating with-sound blocks instead, and J> it works after a fashion but the creation of separate audio files J> means those still have to be stitched together at some point. At J> least this is getting closer to what I was after. What do you mean stitch together? Do you want something like: (with-sound (options) (calls-for-first-section) (calls-for-second-section)) ? You can take the body of each of your two with-sound calls and place within one single with-sound: (let ((var '()) (aaa (make-heap '(360 800.345 1200 600))) ;freq (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;dur (ccc (make-heap '(241 840.345 1000 960 500))) ;freq (ddd (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;dur ) (with-sound (:reverb nrev :output "Test1.wav" :srate 48000 :channels 2 :header-type mus-riff :statistics #t :play #t) ;; BODY OF CALL 1: (let ((i 0)) (do ((k 0 (+ k 1))) ((>= k 25)) (let ((v (next bbb))) (examp1 i v (next aaa) .3) (set! i (+ (round-off i 2) v))))) ;; BODY OF CALL 2: (let ((j 1)) (do ((k 0 (+ k 1))) ((>= k 25)) (let ((v (next ddd))) (examp2 j v (next ccc) .1) (set! j (+ (round-off j 2) v))))))) I'm 100% sure what you want to do is possible. If the above doesn't come close, please try to be more explicit as to what you want to achieve, perhaps detail in words. Cheers, -anders From j_hearon at hotmail.com Mon Aug 22 10:47:53 2016 From: j_hearon at hotmail.com (James Hearon) Date: Mon, 22 Aug 2016 17:47:53 +0000 Subject: [CM] scheme, larger structures In-Reply-To: References: Message-ID: anders wrote... You can take the body of each of your two with-sound calls and place within one single with-sound: (let ((var '()) (aaa (make-heap '(360 800.345 1200 600))) ;freq (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;dur (ccc (make-heap '(241 840.345 1000 960 500))) ;freq (ddd (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;dur ) (with-sound (:reverb nrev :output "Test1.wav" :srate 48000 :channels 2 :header-type mus-riff :statistics #t :play #t) ;; BODY OF CALL 1: (let ((i 0)) (do ((k 0 (+ k 1))) ((>= k 25)) (let ((v (next bbb))) (examp1 i v (next aaa) .3) (set! i (+ (round-off i 2) v))))) ;; BODY OF CALL 2: (let ((j 1)) (do ((k 0 (+ k 1))) ((>= k 25)) (let ((v (next ddd))) (examp2 j v (next ccc) .1) (set! j (+ (round-off j 2) v))))))) I'm 100% sure what you want to do is possible. If the above doesn't come close, please try to be more explicit as to what you want to achieve, perhaps detail in words. Cheers, -anders ------------------------------ Hi, Yes, this is coming along better now. Bill gave me a couple of pointers too. I'm finding myself using Snd more for help with composing than audio editing these days, but takes a while to get used to scheme. Regards, Jim (load "/opt/snd-16/CM_patterns.scm") (define (round-off z n) (let ((power (expt 10 n))) (/ (round (* power z)) power))) (definstrument (examp1 start-time duration frequency amplitude) (let* ((beg (seconds->samples start-time)) (end (+ beg (seconds->samples duration))) (sine-wave (make-oscil :frequency frequency))) (do ((i beg (+ i 1))) ((= i end)) (let ((x (* amplitude (oscil sine-wave)))) (outa i x) (outb i x))))) (definstrument (examp2 start-time duration frequency amplitude) (let* ((beg (seconds->samples start-time)) (end (+ beg (seconds->samples duration))) (gen (make-polywave :frequency frequency :partials '(1 1.69 3 5)))) (do ((i beg (+ i 1))) ((= i end)) (let ((x (* amplitude (polywave gen)))) (outa i x) (outb i x) )))) (let ((aaa (make-heap '(360 800.345 1200 600))) ;freqs (bbb (make-cycle '(1 1 .75 .25 .20 .15 .10 .10 .10 .10))) ;durs (ccc (make-heap '(500 440 880 1620 591.23))) ;freqs (ddd '(600 700 800 900) ) ;just freqs, no pattern (eee (make-cycle '(.2 1.25 .75 .25 .20 .15 .10 .10 .50 .10 .50))) ;durs (var1 '() ) (var2 '() ) ) (set! var1 (append (next aaa #t) (next ccc #t) )) (set! var2 (append var1 ddd) ) (let ((var3 (make-heap var1)) (var4 (make-heap var2)) ) (with-sound (:reverb nrev :output "/home/test.wav" :srate 48000 :channels 2 :header-type mus-riff :statistics #t :play #t) (let ((i 0)) (do ((k 0 (+ k 1))) ((>= k 4)) (let ((v (next bbb))) (examp1 i v (next var3) .3) (set! i (+ (round-off i 2) v)) ))) (let ((j 4)) (do ((k 0 (+ k 1))) ((>= k 15)) (let ((v (next eee))) (examp2 j v (next var4) .05) (set! j (+ (round-off j 2) v)) ))) ))) ;;end of with-sound ________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: