Update of /cvsroot/audacity/audacity-src/plug-ins
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv20392
Modified Files:
clicktrack.ny
Log Message:
Updated version of plugin by David Sky, with layout changes by Richard Ash
Index: clicktrack.ny
===================================================================
RCS file: /cvsroot/audacity/audacity-src/plug-ins/clicktrack.ny,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- clicktrack.ny 2 Oct 2003 02:34:11 -0000 1.2
+++ clicktrack.ny 16 Sep 2007 14:16:25 -0000 1.3
@@ -3,33 +3,95 @@
;type generate
;name "Click Track..."
;action "Generating click track..."
-;info "Generates a simple click track at a given tempo and time signature"
-;control tempo "Tempo" int "beats/minute" 120 30 300
-;control sig "Beats per measure" int "beats" 4 1 20
-;control measures "Number of measures" int "measures" 32 10 1000
+;info "Generates a click track at the given tempo and time signature\n\nThe
sound to use for the click can be chosen below,\n which may or may not resemble
the sound of a metronome.\n\nWritten by Dominic Mazzoni, modified by David R.
Sky"
+
+;control tempo "Tempo [beats per minute]" int "" 120 30 300
+;control sig "Beats per measure (bar)" int "" 4 1 20
+;control measures "Number of measures (bars)" int "" 32 10 1000
+;control click-type "Click track sound type [0=sinewave 1=noise-based 2=drip
sound]" int "" 0 0 2
+;control q "Resonance for noise clicks [q] (higher gives more defined pitch)"
int "" 1 1 20
+;control high "Strong click MIDI pitch" int "" 92 48 96
+;control low "Weak click MIDI pitch" int "" 80 48 96
+
+; original clicktrack.ny, modified by David R. Sky September 12, 2007
+; to allow user to select accented and unaccented click MIDI pitches
+; and select between sinewave-based or noise-based click sounds.
+; The higher the q value for filtered noise-based clicks,
+; the more the click becomes discernable as having a definite pitch
+; [as specified by the user].
+; Original code kept 'as is', with additional code
+; for setting of accented and unaccented pitches,
+; addition of noise-based clicks,
+; normalization function for noise-based clicks,
+; and pwl to make for smoother fade-in and fade-out of clicks.
+
(setf measures (truncate measures))
(setf tempo (truncate tempo))
(setf sig (truncate sig))
-(setf ticklen 0.01)
+(setf ticklen 0.01) ; duration of 1 click
(setf beatlen (/ 60.0 tempo))
+; function to generate drip sound clicks
+; code by Paul Beach www.proviewlandscape.com/liss/
+(defun drip (p) ; p is pitch in hz
+(lp
+(stretch 1
+(mult (exp-dec 0 0.015 0.25)
+( sim
+(mult (hzosc (* 2.40483 p)) 0.5 )
+(mult (hzosc (* 5.52008 p)) 0.25 )
+(mult (hzosc (* 8.653 p)) 0.125 )
+(mult (hzosc (* 11.8 p)) 0.0625 )
+)
+)
+)
+440))
+
+
+
+; function to normalize noise-based clicks
+; this function is necessary because [resonant] filtering
+; changes amplitude of filtered noise clicks
+(defun normalize (sound)
+(setf peak-level (peak sound ny:all))
+(scale (/ 1.0 peak-level) sound))
+
; make one measure
-(setf measure (stretch-abs ticklen (scale 0.75 (osc 92)))) ;accented
+(setf measure (stretch-abs ticklen (mult 0.75
+; pwl is used to add fast [5ms] fade-in and fade-out of clicks
+(pwl 0 0 0.005 1 0.995 1 1 0 1)
+(cond
+((= click-type 0) ; tone-based accented clicks
+(osc high))
+((= click-type 1) ; noise-based accented clicks
+(normalize (lowpass2 (noise 1) (step-to-hz high) q)))
+((= click-type 2) ; drip sound accented clicks
+(normalize (drip (step-to-hz high))))
+)))) ;accented
(dotimes (x (- sig 1))
(setf measure (sim measure
(at (* beatlen (+ x 1)) ;unaccented
- (stretch-abs ticklen (scale 0.5 (osc 80)))))))
+ (stretch-abs ticklen (mult 0.5
+; again, pwl adds fast [5ms] fade-in and fade-out to clicks
+(pwl 0 0 0.005 1 0.995 1 1 0 1)
+(cond
+((= click-type 0) ; tone-based unaccented clicks
+(osc low))
+((= click-type 1) ; noise-based unaccented clicks
+(normalize (lowpass2 (noise 1) (step-to-hz low) q)))
+((= click-type 2) ; drip sound unaccented clicks
+(normalize (drip (step-to-hz low))))
+)))))))
; make the measure exactly the right length
(setf measure (sim measure
(stretch-abs (* sig beatlen) (const 0.0))))
-; loop measure n times
+; loop measure n [measures-1] times
(setf result measure)
(dotimes (x (- measures 1))
(setf result (seq result measure)))
-; return result
+; return [click track] result
result
; arch-tag: 73fbc0e9-548b-4143-b8ac-13437b9154a7
-
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs