From: David R. Sky <davidsky@sh...>  20060804 17:51:39

Hi, I got a 'division by zero' error message when trying to run the following plugin, but I haven't been able to figure out where my error is. Plugin is first then specific Nyquist error message. In a program I have to check WordPerfect 5.1 macros, it tells the line number of the incorrect macro form  is there a way to incorporate a line number report into the Nyquist debug option in Audacity? Thanks, David ;nyquist plugin ;version 2 ;type process ;name "Time shifter on acid..." ;action "Time shifting stereo tracks in a warped fashion..." ;info "by David R. Sky, thanks to Jimi Photon for suggestion\nReleased under terms of GNU Public License" # Time shifter on Acid by David R. Sky, August 4, 2006 Thanks to Jimi Photon for plugin suggestion Released under terms of the GNU Public License http://www.opensource.org/licenses/gpllicense.php # ;control l "Left channel time shift  ms" int "" 0 1000 1000 ;control r "Right channel time shift  ms" int "" 0 1000 1000 ;control ldepth "Left channel warp depth  percent" int "" 25 0 100 ;control rdepth "Right channel warp depth  percent" int "" 25 0 100 ;control maxf "Maximum warp frequency  hz" real "" 0.2 0.01 10 ; determine selection duration in seconds (setf dur (/ len *soundsrate*)) ; time shift function (defun shift (sound dur time) (if (< time 0) ; if time<0 (extractabs ( time) dur sound) ; otherwise... (sim (srest time) (atabs time (cue sound)) ) ; end sim ) ; end if ) ; end defun ; convert integer time to float time (setf l (/ (float l) (float 1000))) (setf r (/ (float r) (float 1000))) ; normalize function (defun normalize (level signal) (setf x (peak signal ny:all)) (scale (/ level x) signal) ) ; end defun normalize ; applying time shift (let ; define the two random signals for l & r channel warping ((lnoise (normalize (* ldepth 0.01) (lowpass2 (noise dur) max f))) (rnoise (normalize (* rdepth 0.01) (lowpass2 (noise dur) maxf)))) (vector (shift (sndtapv (aref s 0) 0.25 lnoise 0.5) dur l) (shift (sndtapv (aref s 1) 0.25 rnoise 0.5) dur r) ) ; end vector ) ; end let error: division by zero Function: #<Subr/: #13515d8> Arguments: 0.25 0 Function: #<ClosureNORMALIZE: #13916e8> Arguments: 0.25 #<Sound: #2052768> Function: #<FSubrLET: #1351cc8> Arguments: ((LNOISE (NORMALIZE (* LDEPTH 0.01) (LOWPASS2 (NOISE DUR) MAX F))) (RNOISE (NORMALIZE (* RDEPTH 0.01) (LOWPASS2 (NOISE DUR) MAXF)))) (VECTOR (SHIFT (SNDTAPV (AREF S 0) 0.25 LNOISE 0.5) DUR L) (SHIFT (SNDTAPV (AREF S 1) 0.25 RNOISE 0.5) DUR R)) 1> [ gc: total 18640, 3529 free; samples 3KB, 1KB free ] 
From: Steven Jones <plewto@gm...>  20060804 21:15:55

I haven't looked at this in detail but what is the value of x in the normilize function ? ; normalize function (defun normalize (level signal) (setf x (peak signal ny:all)) (scale (/ level x) signal) ) ; end defun normalize 
From: David R. Sky <davidsky@sh...>  20060804 23:08:24

Hi Steve, x (from the normalize function) is the peak signal of a lowpass2 filtered noise of dur duration; I've used this function in other plugins without a problem. The signals being examined for peak values are lnoise and rnoise: (defun normalize (level signal) (setf x (peak signal ny:all)) (scale (/ level x) signal) ) ; end defun normalize (let ; define the two random signals for l & r channel warping ((lnoise (normalize (* ldepth 0.01) (lowpass2 (noise dur) maxf))) ; random signal for l channel (rnoise (normalize (* rdepth 0.01) (lowpass2 (noise dur) maxf)))) ; random signal for r channel ... ) ; end let Thanks David On Fri, 4 Aug 2006, Steven Jones wrote: > I haven't looked at this in detail but what is the value of x in the > normilize function ? > > ; normalize function > (defun normalize (level signal) > (setf x (peak signal ny:all)) > (scale (/ level x) signal) > ) ; end defun normalize > >  > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys  and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Audacitynyquist mailing list > Audacitynyquist@... > https://lists.sourceforge.net/lists/listinfo/audacitynyquist > 
From: Steven Jones <plewto@gm...>  20060805 04:23:44

I'm Sorry, I should have been more explicit. What I meant was could x be zero? If the selected audio has zero amplitude normalize will fail. On 8/4/06, David R. Sky <davidsky@...> wrote: > Hi Steve, > > x (from the normalize function) is the peak signal of a lowpass2 > filtered noise of dur duration; I've used this function in other > plugins without a problem. The signals being examined for peak > values are lnoise and rnoise: > > (defun normalize (level signal) > (setf x (peak signal ny:all)) > (scale (/ level x) signal) > ) ; end defun normalize > > (let > ; define the two random signals for l & r channel warping > ((lnoise (normalize (* ldepth 0.01) (lowpass2 (noise dur) > maxf))) ; random signal for l channel > (rnoise (normalize (* rdepth 0.01) (lowpass2 (noise dur) > maxf)))) ; random signal for r channel > > ... > ) ; end let > > Thanks > > David > > > On Fri, 4 Aug 2006, Steven Jones wrote: > > > I haven't looked at this in detail but what is the value of x in the > > normilize function ? > > > > ; normalize function > > (defun normalize (level signal) > > (setf x (peak signal ny:all)) > > (scale (/ level x) signal) > > ) ; end defun normalize > > > >  > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share your > > opinions on IT & business topics through brief surveys  and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Audacitynyquist mailing list > > Audacitynyquist@... > > https://lists.sourceforge.net/lists/listinfo/audacitynyquist > > > >  > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys  and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Audacitynyquist mailing list > Audacitynyquist@... > https://lists.sourceforge.net/lists/listinfo/audacitynyquist > 
From: David R. Sky <davidsky@sh...>  20060805 05:57:46

There wasn't a problem with my code Steve  it was the way I created a stereo track in audacity! *groan* I thought that first creating a stereo track under project menu, then generating a tone would create a stereo track. (The screen did indicate "stereo"). However, when applying the plug to that signal, I did get the 'division by zero' msg. I needed to do a 'quick mix' after the above  i.e., there was indeed one channel with a signal, the other channel had none, which seems to have created the zero x value. The code works, it just needs numeric tweaking... Thanks! David On Fri, 4 Aug 2006, Steven Jones wrote: > I'm Sorry, I should have been more explicit. What I meant was could x > be zero? If the selected audio has zero amplitude normalize will > fail. 