[CM] tests

Heinrich Taube taube at uiuc.edu
Sun May 3 07:50:07 PDT 2009


ok i ran a few timing experiments between clm-3 and sndlib using cases  
of a few long notes and lots of short notes--  it seems that maybe any  
slowness in sndlib instrumts had more to do with the way the  
instrument is defined than anything else? when i tried 400 short notes  
using v.ins the two systems were almost equivalent, with-sound seems  
just as fast as with-threaded-sound in all cases (which might mean im  
not tweeiking the threading correctly im using default values on a mac  
intel core duo)

here is the 400 note comparison clm-3/sndlib using v.ins which is great

(load "env")
(load "v")

(with-sound (:output "/tmp/morph.wav" :srate 44100
		     :channels 2 :statistics #t)

   (let ((amp-env '(0 0 2 .5 3 .9 5 .6 75 .2 100 0))
	(spike-env '(0 .01 .2 .02 .3 .05 .35 .09
		       .4 .1 .425 .15 .45 .2 .5 2.5
		       .55 .2 .575 .15 .6 .1 .65 .09
		       .7 .05 .8 .02 1. .01))
	(trough-env '(0 9 .2 8 .3 5 .35 4 .45
			0 .5 0 .65 4 .96 8 1 9))
	(notes '(261.62 261.62 261.62 277.18 293.66
		 311.12 311.12 311.12 329.62 329.62
		 329.62 349.22 369.99 391.99 391.99
		 391.99 415.30 440.0 466.16 493.88
		 523.25 523.25 523.25))
	)
     (do ((len 400)
	 (amp .2)
	 (now 0 (+ now .1))
	 (l (length notes))
	 (n 0 (+ n 1)))
	((= n len)
	 )
       (fm-violin now
                (envelope-interp (/ n len) spike-env)
                (list-ref notes (random l))
                amp
                :amp-env amp-env
                :reverb-amount .1
                :fm-index
	       (envelope-interp (/ n len) trough-env)
                )))
   )

CLM-3:
     Compute time: 1.616, Compute ratio: 0.04

SNDLIB/WITH-SOUND:
     compute time: 2.367

SNDLIB/WITH-THREADED-SOUND:
     compute time: 2.141


wow!

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

then for trying long notes i used expandn.  the versions of expandn  
and the input sound file are on my directory at stanford:

	~hkt/expandn.ins
	~hkt/expandn.scm
	~hkt/strum1.aiff     (8 second input file)

i tried a small expansion (2x and a large one 18x). in both of these  
clm-3 is many times faster,  about the same as the piano case (3 sec  
vs 24 sec and 16 sec vs 68 sec) and the output sound quality is also  
better, which i havent started to track down yet
looking at the code i dont know what the difference is due to --  
neither are using closures that i can see and both are using vectors  
of generators.

;-------------
;; 2x expansion (infile 8s output 21s)

(load "expandn.scm")
;(progn (compile-file "expandn.ins" ) (load "expandn"))

(with-sound (:output "/tmp/aeolian.wav" :srate 44100
		     :channels 2 :statistics #t)
   (let (
	(infile "strum1.aiff")
	)

     (do ((rats '(1 16/9 128/81 4/3 32/27 9/8 3/2 2)
	       (cdr rats))
	 (amp .9)
	 (now 0 (+ now .5))
	 (fdur (mus-sound-duration infile)))
	((null? rats)
	 )
       (expandn now (* fdur (car rats)) infile amp
	       :expand 2
	       :srate (car rats)))))

CLM-3/SBCL:
   Compute time: 2.704, Compute ratio: 0.13

SNDLIB/WITH-SOUND:
   compute time: 24.233

SNDLIB/WITH-THREADED-SOUND:
   compute time: 24.465

;----------------------
;; 18x expansion (input 8s output 148s)

(with-sound (:output "/tmp/aeolian.wav" :srate 44100
		     :channels 2 :statistics #t)
   (let ((infile "strum1.aiff"))
     (do ((rats '(1 16/9 128/81 4/3 32/27 9/8 3/2 2)
	       (cdr rats))
	 (amp .6)
	 (stretch 8)
	 (now 0 (+ now 1.5))
	 (fdur (mus-sound-duration infile)))
	((null? rats)
	 )
       (expandn now (* fdur (car rats) stretch) infile amp
	       :expand (* fdur (car rats) stretch)
	       :srate (car rats)))))

CLM-3/SBCL:
   Compute time: 16.678, Compute ratio: 0.11

SNDLIB/WITH-SOUND:
   compute time: 66.430

SNDLIB/WITH-THREADED-SOUND:
  compute time: 66.067


i can try some fullmix and grani later for more soundfile mixing tests







More information about the Cmdist mailing list