<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p>I'm working thru snd make-pvocoder, clm make-phase-vocoder trying to find more info on the analyze, edit, and synthesize methods, such as the one below the manual which shows a lambda func for the synthesis or resynthesis method. Most of what I've been
able to find is based on a gen from readin of a file or input samples to access spectral data. I know this is a bit odd, but I was trying to create designer spectra, by filling empty vectors with various numbers etc, as opposed to getting the data from a
readin generator. So far mine just sounds like noise, so I don't have it quite right. I'm wondering if I'm on the right track by using original vectors in the analyze, edit, and synthesize methods. Or maybe I should just be creating sound files using something
like infinite sums, for example, and sticking with the readin generator to analyze those sounds? I've looked at at the moving-spectrum and pins insts too.</p>
<p><br>
</p>
<p>Thank you,<br>
</p>
<p>Jim<br>
</p>
<p></p>
<pre class="indented"><span style="font-size: 9pt;">(with-sound (:srate 22050 :statistics #t)
(let ((pv (</span><em class="red"><span style="font-size: 9pt;">make-phase-vocoder</span></em><span style="font-size: 9pt;">
         (make-readin "oboe.snd")
         512 4 128 1.0
         #f ; no change to analysis method
         #f ; no change to spectrum
         (lambda (gen) ; resynthesis function
         (float-vector-add! (phase-vocoder-amps gen) (phase-vocoder-amp-increments gen))
         (float-vector-add! (phase-vocoder-phase-increments gen) (phase-vocoder-freqs gen))
         (float-vector-add! (phase-vocoder-phases gen) (phase-vocoder-phase-increments gen))
         (let ((sum 0.0)
                 (n (length (phase-vocoder-amps gen))))
                 (do ((k 0 (+ k 1)))
                 ((= k n))
                 (set! sum (+ sum (* (float-vector-ref (phase-vocoder-amps gen) k)
                                 (sin (* 0.5 (float-vector-ref (phase-vocoder-phases gen) k)))))))
                 sum)))))
(do ((i 0 (+ i 1)))
((= i 44100))
(outa i (</span><em class="red"><span style="font-size: 9pt;">phase-vocoder</span></em><span style="font-size: 9pt;"> pv)))))</span></pre>
--------------------
<p></p>
<p><br>
</p>
<p></p>
<div><span style="font-size: 11pt;">(with-sound (:reverb nrev :srate 48000 :channels 2 :header-type mus-riff :statistics #t :output "/myTest.wav" :play #t ) </span><br>
<span style="font-size: 11pt;"> (let* ((samps (* 2 (mus-sound-framples "/Sample1.wav")))</span><br>
<span style="font-size: 11pt;"> (hop 512) </span><br>
<span style="font-size: 11pt;"> (jsampvec (make-float-vector hop)) ;create empty vectors</span><br>
<span style="font-size: 11pt;"> (jsampincvec (make-float-vector hop)) </span>
<br>
<span style="font-size: 11pt;"> (jsfreqvec (make-float-vector hop)) </span>
<br>
<span style="font-size: 11pt;"> (jsphasevec (make-float-vector hop))</span><br>
<span style="font-size: 11pt;"> (jsphaseincvec (make-float-vector hop)) </span><br>
<span style="font-size: 11pt;"> (pv (make-phase-vocoder </span><br>
<span style="font-size: 11pt;"> (make-readin "/Sample1.wav")</span><br>
<span style="font-size: 11pt;"> 512 4 128 1.75 ;fft-size, overlap, interp, pitch</span><span style="font-size: 11pt;"></span><br>
<span style="font-size: 11pt;"> #f ; no change to analysis</span><br>
<span style="font-size: 11pt;"> #f ; no change to edit</span><span style="font-size: 11pt;"></span><br>
<span style="font-size: 11pt;"> (lambda (gen) ; *attempt resynthesis function*</span><br>
<span style="font-size: 11pt;"> (do ((i 0 (+ i 1)))</span><br>
<span style="font-size: 11pt;"> ((= i hop))</span><br>
<span style="font-size: 11pt;"> (set! (jsampvec i) (mus-random .02) ) ;fill vectors with numbers</span><br>
<span style="font-size: 11pt;"> (set! (jsampincvec i) (mus-random .05) )</span><br>
<span style="font-size: 11pt;"> (set! (jsfreqvec i) (mus-random 500) )</span><br>
<span style="font-size: 11pt;"> (set! (jsphasevec i) (mus-random 360) )</span><br>
<span style="font-size: 11pt;"> (set! (jsphaseincvec i) (mus-random .02) )</span><br>
<span style="font-size: 11pt;"> ) ;end do</span><br>
<br>
<span style="font-size: 11pt;"> (float-vector-add! jsampvec jsampincvec) ;add the vectors</span><br>
<span style="font-size: 11pt;"> (float-vector-add! jsphaseincvec jsfreqvec)</span><br>
<span style="font-size: 11pt;"> (float-vector-add! jsphasevec jsphaseincvec)</span><br>
<br>
<span style="font-size: 11pt;"> (let ((sum 0.0)</span><span style="font-size: 11pt;"></span><br>
<span style="font-size: 11pt;"> (n hop))</span><br>
<span style="font-size: 11pt;"> (do ((k 0 (+ k 1)))</span><br>
<span style="font-size: 11pt;"> ((= k n))</span><br>
<span style="font-size: 11pt;"> (set! sum (+ sum (* (jsampvec k)(sin (* 0.5 (jsphasevec k)))))) ;create waveform</span><br>
<span style="font-size: 11pt;"> ) </span><br>
<span style="font-size: 11pt;"> sum) </span><br>
<span style="font-size: 11pt;"> )))</span><span style="font-size: 11pt;"></span><span style="font-size: 11pt;"></span><span style="font-size: 11pt;"></span><span style="font-size: 11pt;"></span><br>
<span style="font-size: 11pt;"> (do ((i 0 (+ i 1)))</span><br>
<span style="font-size: 11pt;"> ((= i samps))</span><br>
<span style="font-size: 11pt;"> (outa i (* 4 (phase-vocoder pv)))</span><br>
<span style="font-size: 11pt;"> (outb i (* 4 (phase-vocoder pv)))</span><br>
<span style="font-size: 11pt;"> ))) </span></div>
<br>
<p></p>
</div>
</body>
</html>