[CM] float-vectors

James Hearon j_hearon at hotmail.com
Thu Jun 15 11:14:06 PDT 2017


Hi,

I'm still struggling with this a bit.

I'm trying to understand more about float-vectors and output to be able to debug them.


How would you go about putting float-vector values on the output, or do they always need a generator of some sort?


   ex. (I'm imagining) something like...

    (map-channel (lambda (y) (myfloatvector)))

   or

   if snd object is already open

    (testme (channel->float-vector 0 fsize snd 0))

   then

    (map-channel (lambda (y) (testme)))

   or open from a file...

    (im (make-float-vector mysize))

    (mus-sound-read "test.wav"  0 mysize 2 im)

   then

    (do ((i 0 (+ i 1)))
        ((= i 22050))
      (outa i (im)))

I can't seem to find what I'm looking for in the documentation to work with just the numbers for freq, amp, and phase for testing as audio.  I know that's a bit spartan, so seems I need to work thru a generator such as maybe use table lookup, for ex. then apply the vocoder.


Thank You,

Jim





________________________________
From: cmdist-bounces at ccrma.Stanford.EDU <cmdist-bounces at ccrma.Stanford.EDU> on behalf of cmdist-request at ccrma.Stanford.EDU <cmdist-request at ccrma.Stanford.EDU>
Sent: Friday, May 26, 2017 7:00 PM
To: cmdist at ccrma.Stanford.EDU
Subject: Cmdist Digest, Vol 109, Issue 4

Send Cmdist mailing list submissions to
        cmdist at ccrma.stanford.edu

To subscribe or unsubscribe via the World Wide Web, visit
        https://cm-mail.stanford.edu/mailman/listinfo/cmdist
Cmdist Info Page - Center for Computer Research in Music ...<https://cm-mail.stanford.edu/mailman/listinfo/cmdist>
cm-mail.stanford.edu
Common Music, Common Lisp Music, Common Music Notation and Snd mailing list. To see the collection of prior postings to the list, visit the Cmdist Archives.


or, via email, send a message with subject or body 'help' to
        cmdist-request at ccrma.stanford.edu

You can reach the person managing the list at
        cmdist-owner at ccrma.stanford.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cmdist digest..."


Today's Topics:

   1. make-pvocoder (James Hearon)
   2. Re: make-pvocoder (bil at ccrma.Stanford.EDU)


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

Message: 1
Date: Thu, 25 May 2017 19:00:15 +0000
From: James Hearon <j_hearon at hotmail.com>
To: "cmdist at ccrma.Stanford.EDU" <cmdist at ccrma.Stanford.EDU>
Subject: [CM] make-pvocoder
Message-ID:
        <BN6PR1001MB206736A3CF55B6980475A01CE5FF0 at BN6PR1001MB2067.namprd10.prod.outlook.com>

Content-Type: text/plain; charset="iso-8859-1"

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-0001.html>

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

Message: 2
Date: Thu, 25 May 2017 14:40:33 -0700
From: bil at ccrma.Stanford.EDU
To: James Hearon <j_hearon at hotmail.com>
Cc: "cmdist at ccrma.Stanford.EDU" <cmdist at ccrma.Stanford.EDU>
Subject: Re: [CM] make-pvocoder
Message-ID: <6940b572444d077c52c1342ced6d1baf at ccrma.stanford.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Your instrument fills all the vocoder arrays
with noise, so you get noise as the output.
Are you trying to do additive synthesis?



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

_______________________________________________
Cmdist mailing list
Cmdist at ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
Cmdist Info Page - Center for Computer Research in Music ...<https://cm-mail.stanford.edu/mailman/listinfo/cmdist>
cm-mail.stanford.edu
Common Music, Common Lisp Music, Common Music Notation and Snd mailing list. To see the collection of prior postings to the list, visit the Cmdist Archives.




End of Cmdist Digest, Vol 109, Issue 4
**************************************

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


More information about the Cmdist mailing list