[CM] make-pvocoder

James Hearon j_hearon at hotmail.com
Thu May 25 12:00:15 PDT 2017


Hi,

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.


Thank you,

Jim

(with-sound (:srate 22050 :statistics #t)
  (let ((pv (make-phase-vocoder
             (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 (phase-vocoder pv)))))

--------------------


(with-sound (:reverb nrev :srate 48000 :channels 2 :header-type  mus-riff :statistics #t :output "/myTest.wav" :play #t )
  (let* ((samps (* 2 (mus-sound-framples "/Sample1.wav")))
         (hop 512)
         (jsampvec (make-float-vector hop))  ;create empty vectors
         (jsampincvec (make-float-vector hop))
         (jsfreqvec (make-float-vector hop))
         (jsphasevec (make-float-vector hop))
         (jsphaseincvec (make-float-vector hop))
             (pv (make-phase-vocoder
         (make-readin "/Sample1.wav")
             512 4  128  1.75    ;fft-size, overlap, interp, pitch
              #f ; no change to analysis
             #f ; no change to edit
             (lambda (gen) ; *attempt resynthesis function*
                  (do ((i 0 (+ i 1)))
              ((= i hop))
                  (set! (jsampvec i) (mus-random .02) ) ;fill vectors with numbers
                  (set! (jsampincvec i) (mus-random .05) )
                  (set! (jsfreqvec i) (mus-random 500) )
                  (set! (jsphasevec i) (mus-random 360) )
                  (set! (jsphaseincvec i) (mus-random .02) )
                  ) ;end do

           (float-vector-add! jsampvec jsampincvec)  ;add the vectors
           (float-vector-add! jsphaseincvec  jsfreqvec)
           (float-vector-add! jsphasevec  jsphaseincvec)

           (let ((sum 0.0)
                     (n hop))
         (do ((k 0 (+ k 1)))
             ((= k n))
   (set! sum (+ sum (* (jsampvec k)(sin (* 0.5 (jsphasevec k)))))) ;create waveform
                   )
         sum)
             )))
    (do ((i 0 (+ i 1)))
       ((= i samps))
      (outa i (* 4 (phase-vocoder pv)))
      (outb i (* 4 (phase-vocoder pv)))
      )))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20170525/8c447611/attachment.html>


More information about the Cmdist mailing list