Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Stevethefiddle <stevethefiddle@gm...>  20100609 00:28:40

I notice that the word "rate" can be used as a parameter with slider widgets; for example, the following plugin will display the current sample rate: ;nyquist plugin ;version 1 ;type generate ;name "ShowSampleRate..." ;action "show ..." ;info "Show Sample Rate" ;control n "Sample Rate" int "Hz" rate 0 1000000 Is this documented anywhere? Are there any other words that can be used in this way?  View this message in context: http://audacity.238276.n2.nabble.com/controlwidgetdocumentationtp5156108p5156108.html Sent from the audacitynyquist mailing list archive at Nabble.com. 
From: paul beach <sniffyraven@fa...>  20100611 18:44:37

Rate, Tempo, seem to be commands for Adagio Midi commands. It is not likely that I would use a plugin for music compostions. Computer music, change key, tempo etc., regarding a theme sounds like so: http://www.proviewlandscape.com/liss/rushes%20and%20swamp.mp3 Rate The !RATE command scales all times including those specified in hundredths of seconds. A rate of 100 means no change, 200 means twice as fast, and 50 means half as fast. For example, to make a piece play 10% faster, you can add the following command at the beginning of the score: !RATE 110 !RATE and !TEMPO commands combine, so !RATE 200 !TEMPO 70 will play 70 beats per minute at double the normal speed, or 140 beats per minute. Like !TEMPO, the time of the !RATE command is added to the time attribute of all following notes up to the next !TEMPO or !RATE command. On Tue, 8 Jun 2010 17:28:32 0700 (PDT), "Stevethefiddle" <stevethefiddle@...> said: > > I notice that the word "rate" can be used as a parameter with slider > widgets; > for example, the following plugin will display the current sample rate: > > ;nyquist plugin > ;version 1 > ;type generate > ;name "ShowSampleRate..." > ;action "show ..." > ;info "Show Sample Rate" > ;control n "Sample Rate" int "Hz" rate 0 1000000 > > Is this documented anywhere? > Are there any other words that can be used in this way? >  > View this message in context: > http://audacity.238276.n2.nabble.com/controlwidgetdocumentationtp5156108p5156108.html > Sent from the audacitynyquist mailing list archive at Nabble.com. > >  > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeekpromo > _______________________________________________ > Audacitynyquist mailing list > Audacitynyquist@... > https://lists.sourceforge.net/lists/listinfo/audacitynyquist  paul beach sniffyraven@... 
From: Stevethefiddle <stevethefiddle@gm...>  20100615 01:17:29

Thanks for your reply Paul, but in this context I do not think that it refers to Adagio. If you run the code that I posted you will see that "rate" when used in a ";control" line is equivalent to the current sample rate. My question is that I can find no documentation about this (I would be happy to write something up on the Audacity wiki if anyone is able to provide definitive information about it). I would also like to know if there are any other "keywords" that are specific to ";control". Perhaps there are some comments in the source code about this, but I don't know what part of the source code is responsible for this. I would have thought that someone must know the answer, but perhaps it was written by someone that is no longer involved with Audacity Nyquist. Any information would be much appreciated. Steve  View this message in context: http://audacity.238276.n2.nabble.com/controlwidgetdocumentationtp5156108p5180023.html Sent from the audacitynyquist mailing list archive at Nabble.com. 
From: paul beach <sniffyraven@fa...>  20100617 20:11:15

NyquistAudacity impliments some instructions that have a MIDI name. [rest, pitch = midi number, and so on]. This is limited, for example, SINE cannot be use like hzosc. I am trying rate, [ !rate 50 ] cuts the tempo in half, a half note should become a quarter note. (seq (rate 50 (sine 60 .2)) (sine 62 .1) ) error: unbound function  RATE if continued: try evaluating symbol again Function: #<FSubrLET*: #e40bd4> Arguments: ((FIRST%SOUND (RATE 50 (SINE 60 0.2))) (S%RATE (GETSRATES FIRST%SOUND))) (COND ((ARRAYP FIRST%SOUND) (SNDMULTISEQ (PROG1 FIRST%SOUND (SETF FIRST%SOUND NIL)) (FUNCTION (LAMBDA (T0) (FORMAT T "MULTISEQ's 2nd behavior: ~A~%" (QUOTE (SINE 62 0.1))) (WITH%ENVIRONMENT (QUOTE ((0 1 NIL) 1 1e+021 0 0 1e+021 2205 44100)) (ATABS T0 (FORCESRATES S%RATE (SINE 62 0.1)))))))) (T (SNDSEQ (PROG1 FIRST%SOUND (SETF FIRST%SOUND NIL)) (FUNCTION (LAMBDA (T0) (WITH%ENVIRONMENT (QUOTE ((0 1 NIL) 1 1e+021 0 0 1e+021 2205 44100)) (ATABS T0 (FORCESRATE S%RATE (SINE 62 0.1)))))))))  paul beach sniffyraven@... 
From: Roger Dannenberg <rbd@cs...>  20100617 21:18:13

paul beach wrote: > NyquistAudacity impliments some instructions that have a MIDI name. > [rest, pitch = midi number, and so on]. This is limited, for example, > SINE cannot be use like hzosc. > I don't understand your point. Very few functions in Nyquist are identical. How would you expect SINE and HZOSC to be alike and in what way do they fail to meet that expectation? > I am trying rate, [ !rate 50 ] cuts the tempo in half, a half note > should become a quarter note. > This notation comes from Adagio, an ascii notation for music that was introduced in the CMU Midi Toolkit and ported to Nyquist in connection with functions for standard MIDI file reading and writing. The rate notation in Adagio is unrelated to Nyquist or XLISP. > (seq > (rate 50 (sine 60 .2)) > (sine 62 .1) > ) > > > error: unbound function  RATE > if continued: try evaluating symbol again > Function: #<FSubrLET*: #e40bd4> > Arguments: > ((FIRST%SOUND (RATE 50 (SINE 60 0.2))) (S%RATE (GETSRATES > FIRST%SOUND))) > (COND ((ARRAYP FIRST%SOUND) (SNDMULTISEQ (PROG1 FIRST%SOUND (SETF > FIRST%SOUND NIL)) (FUNCTION (LAMBDA (T0) (FORMAT T "MULTISEQ's 2nd > behavior: ~A~%" (QUOTE (SINE 62 0.1))) (WITH%ENVIRONMENT (QUOTE ((0 1 > NIL) 1 1e+021 0 0 1e+021 2205 44100)) (ATABS T0 (FORCESRATES S%RATE > (SINE 62 0.1)))))))) (T (SNDSEQ (PROG1 FIRST%SOUND (SETF FIRST%SOUND > NIL)) (FUNCTION (LAMBDA (T0) (WITH%ENVIRONMENT (QUOTE ((0 1 NIL) 1 > 1e+021 0 0 1e+021 2205 44100)) (ATABS T0 (FORCESRATE S%RATE (SINE > 62 0.1))))))))) > 
From: paul beach <sniffyraven@fa...>  20100619 17:47:01

I want to convert a Generate, to an Effect plugin. But fmosc does not take a signal parameter. It is possible to FM sweep the signal? (fmosc c (pwllist bilist)) ; binomial filter  paul beach sniffyraven@... 
From: edgar <edgarrft@we...>  20100619 19:15:10

> Paul Beach wrote: > > I want to convert a Generate, to an Effect plugin. But fmosc does > not take a signal parameter. It is possible to FM sweep the signal? > > (fmosc c (pwllist bilist)) ; binomial filter Could we have the complete context please? And what are the exact Nyquist error messages? Asks  edgar 
From: paul beach <sniffyraven@fa...>  20100621 20:57:37

Transpose is a handy instruction to change the frequency in semitones. Shift an anote up an octave, (transpose 12 (hzosc 220)) ; 12 semitones = an 8ve But it has no Effect on a sinewave. Generate plugin, or Nyquist prompt: (transpose 12 s) does nothing and returns no error message.  paul beach sniffyraven@... 
From: Roger Dannenberg <rbd@cs...>  20100621 21:55:11

Yes, that is correct and matches the documentation, except that I would say (as does documentation) that transpose changes the environment in which behaviors are evaluated, not sounds themselves. Roger paul beach wrote: > Transpose is a handy instruction to change the frequency in semitones. > Shift an anote up an octave, > (transpose 12 (hzosc 220)) ; 12 semitones = an 8ve > > But it has no Effect on a sinewave. > Generate plugin, or Nyquist prompt: > (transpose 12 s) > does nothing and returns no error message. > 
From: paul beach <sniffyraven@fa...>  20100624 15:24:23

I don't see a mod function in the documentation; and presume it would be done like this: ; mod ( n, d ) = n  d * int (n/d) ; 22 mod 5 = 2 ( 22 (* 5 (/ 22 5))) Output 2  paul beach sniffyraven@... 
From: edgar <edgarrft@we...>  20100624 18:25:39

paul beach asked: > I don't see a mod function in the documentation; and presume > it would be done like this: > > ; mod ( n, d ) = n  d * int (n/d) > > ; 22 mod 5 = 2 > > ( 22 (* 5 (/ 22 5))) > Output 2 I have no particular knowledge how it works in SAL, but XLISP has a REM function, see: http://www.audacityforum.de/download/edgar/nyquist/nyquistdoc/xlisp/xlispref/xlispref217.htm If you see in XLISP: (rem expr1 expr2 ...) then this should work in SAL like this: rem(expr1, expr2, ...) I know that REM is not 100% equal to MOD but as far as I know there is no MOD function in XLISP or SAL.  edgar  The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: 
From: paul beach <sniffyraven@fa...>  20100624 19:49:27

Rem seems to be more general than mod. Should be useful for multiple congruences,(the socalled Chinese remainder theory). Also there is a (gcd a b), meaning greatest common divisor. Even though there is no MOD statement, LISP seems to be superior with respect to NUMBER theory. Some topics would be, primitive roots, quadratic residues, congruence. Just checking that (rem a b) is the same as modulus: Nyquist prompt: (rem 22 5) ; == 22 mod 5 Output =2 Much better than this, ( 22 (* 5 (/ 22 5))) ; no error checking! Thank you very much. On Thu, 24 Jun 2010 20:21:54 +0200, "edgar" <edgarrft@...> said: > paul beach asked: > > > I don't see a mod function in the documentation; and presume > > it would be done like this: > > > > ; mod ( n, d ) = n  d * int (n/d) > > > > ; 22 mod 5 = 2 > > > > ( 22 (* 5 (/ 22 5))) > > Output 2 > > I have no particular knowledge how it works in SAL, > but XLISP has a REM function, see: > > http://www.audacityforum.de/download/edgar/nyquist/nyquistdoc/xlisp/xlispref/xlispref217.htm > > If you see in XLISP: > > (rem expr1 expr2 ...) > > then this should work in SAL like this: > > rem(expr1, expr2, ...) > > I know that REM is not 100% equal to MOD but as far > as I know there is no MOD function in XLISP or SAL. > >  edgar > > > > > > > > >  > The author of this email does not necessarily endorse the following > advertisements, which are the sole responsibility of the advertiser: > > >  > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeekpromo > _______________________________________________ > Audacitynyquist mailing list > Audacitynyquist@... > https://lists.sourceforge.net/lists/listinfo/audacitynyquist  paul beach sniffyraven@... 
From: edgar <edgarrft@we...>  20100624 20:34:20

paul beach wrote: > Rem seems to be more general than mod. Should be useful for multiple > congruences,(the socalled Chinese remainder theory). Also there is a > (gcd a b), meaning greatest common divisor. Even though there is no MOD > statement, LISP seems to be superior with respect to NUMBER theory. Some > topics would be, primitive roots, quadratic residues, congruence. > > Just checking that (rem a b) is the same as modulus: > > Nyquist prompt: > > (rem 22 5) ; == 22 mod 5 > > Output =2 > > Much better than this, > > ( 22 (* 5 (/ 22 5))) ; no error checking! I am not a really good mathematician to tell the truth, but here is what the Common Lisp Standard says about the difference between REM and MOD: http://www.lispworks.com/documentation/HyperSpec/Body/f_mod_r.htm#rem In one sentence: REM and MOD differ in their handling of positive and negative numbers. If both number have the same sign, both functions behave the same: (rem 1 5) => 1 (mod 1 5) => 1 (rem 1 5) => 1 (mod 1 5) => 1 But if both numbers have unequal signs: (rem 1 5) => 1 (mod 1 5) => 4 (rem 1 5) => 1 (mod 1 5) => 4 I'm afraid if this is important to you than there will be no other way than to write a realmath solution. I will try now to write a Lisp version out of these examples: http://en.wikipedia.org/wiki/Modulo_operation But do not expect too much...  edgar  The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: 
From: edgar <edgarrft@we...>  20100624 21:31:50

Hi Paul, After realizing that REM in XLISP is limited to integers only, it was quite easy to write the missing MOD function: (defun mod (x y) (cond ((not (integerp x)) (error "MOD  bad argument type" x)) ((not (integerp y)) (error "MOD  bad argument type" y)) ((zerop y) (error "MOD  division by zero")) ((or (and (>= x 0) (< y 0)) ; x is positive, y is negative (and (< x 0) (> y 0))) ; x is negative, y is positive (+ x y)) ; unequal signs (t (rem x y)))) ; equal signs With equal signs: (rem 1 5) => 1 (mod 1 5) => 1 (rem 1 5) => 1 (mod 1 5) => 1 With unequal signs: (rem 1 5) => 1 (mod 1 5) => 4 (rem 1 5) => 1 (mod 1 5) => 4  edgar  The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: 
From: edgar <edgarrft@we...>  20100624 21:58:24

As I said: I'm not a really good mathematician. The previous MOD function only worked with onedigit numbers correctly. Here's a better version: (defun mod (x y) (cond ((not (integerp x)) (error "MOD  bad argument type" x)) ((not (integerp y)) (error "MOD  bad argument type" y)) ((zerop y) (error "MOD  division by zero")) ((or (and (>= x 0) (< y 0)) ; x is positive, y is negative (and (< x 0) (> y 0))) ; x is negative, y is positive (+ (rem x y) y)) ; unequal signs (t (rem x y)))) ; equal signs  edgar  The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: 
From: paul beach <sniffyraven@fa...>  20100624 22:55:14

Edgar, thank you for observations and code, but ... Usually, writers prefer not to bother with a negative sign. Also, it is also a bit awkward in Nyquist. (1 mod 5) = 1 or 4. Both mean the same, what you call an equivalance relation. A minus sign is sometimes wanted, say for Legendre symbols. But that is another topic. Changes to the source code, of course, can't be taken lightly. Example: All primes are of the form, 4*k + 1 or 4*k  1 = 4*k + 3 Nyquist is "corrected" to reject decimals. But if you look in a Number theory book, there is usually a section, 'Decimal fractions'. Thanks again, Paul On Thu, 24 Jun 2010 23:54:00 +0200, "edgar" <edgarrft@...> said: > As I said: I'm not a really good mathematician. The previous > MOD function only worked with onedigit numbers correctly. > > Here's a better version: > > (defun mod (x y) > (cond ((not (integerp x)) (error "MOD  bad argument type" x)) > ((not (integerp y)) (error "MOD  bad argument type" y)) > ((zerop y) (error "MOD  division by zero")) > ((or (and (>= x 0) (< y 0)) ; x is positive, y is negative > (and (< x 0) (> y 0))) ; x is negative, y is positive > (+ (rem x y) y)) ; unequal signs > (t (rem x y)))) ; equal signs > > >  edgar > > > > > > > > > > >  > The author of this email does not necessarily endorse the following > advertisements, which are the sole responsibility of the advertiser: > > >  > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeekpromo > _______________________________________________ > Audacitynyquist mailing list > Audacitynyquist@... > https://lists.sourceforge.net/lists/listinfo/audacitynyquist  paul beach sniffyraven@... 
From: paul beach <sniffyraven@fa...>  20100624 23:13:47

I am happy with the source code, (last eMail). However, these improvements could be made in a future version of Nyquist. (remminus a b ) ; see Edgar's code. (remdecimal a b) paul  paul beach sniffyraven@... 
From: paul beach <sniffyraven@fa...>  20100626 21:31:39

(Rem a b) is an example of defensive programming, which will not always be in agreement with the most general statements. Most programs, such as this one, should work fine, the way things are. Polynomial Bird Song defaults to this short tune: http://www.climatehoax.ca/music/pol_bird.mp3 There are two short chirps generated by, k * j^2 (mod n) where ka is first, and kab the second tweet. j runs from 0 to n. k modifies the quadratic residue envelop. For k = 5, the remainders are: (0,5,7,6,2,8,11,11,8,2,6,7,5,0 ) Two things are needed 1. A sine wave 2. The set of natural numbers (1,2,3, ...). Here's the plugin. ;nyquist plugin ;version 1 ;type generate ;name "Polynomial Song Bird..." ;action "Same ..." ;control n "n value" int "" 13 1 50 ;control c "carrier freq" real "" 97 1 125 ;control k2 "scramble by multiplication" int "" 5 1 25 ;control s1 "Silence between chirps" real "" .025 .001 1.0 ;control k3 "scramble next chirp" int "" 4 1 25 ;control t "time increment" real "" 0.02 .0001 1.0 ;info "Single sine wave synthesis by Paul Beach" (defun tweet (k1) (setf time 0) (setf bilist '()) ; make bilist 0, 1, 2, ...., n (dotimes (j n) ; song = k * j^2 (mod n) where k1 is first, and k2 second tweet (setf song (rem (* k1 j j ) n )) (setf time (+ time t)) (push time bilist) (push (* 222 song) bilist) ; increase frequency modulation ) ; end dotimes (setf bilist (reverse bilist) ) ;scale amplitde modulation by 0.00025 (mult 0.00025 (pwllist bilist) (fmosc c (pwllist bilist)) ) ); end tweet definition (seq (tweet k2) (srest s1) (tweet k3) )  paul beach sniffyraven@... 
From: paul beach <sniffyraven@fa...>  20100703 21:01:29

There is no formula that only generates primes and excludes composite numbers. Here, the prime numbers are generated by Euclid's, greatest common divisor (gcd ), and a modified sieve of Eratosthenes'. The prime numbers can be labeled as pitches, in which case there are 4 different notes, since the prime numbers are to the modulus twelve. The notes happen to be Dflat, F, G, and B, which would be an augmented French 6th in the key of Fminor. I was trying to get (plunk) into the loop, any suggestions would be appreciated. paul ;nyquist plugin ;version 1 ;type generate ;name "A prime series..." ;action "Prime numbers 1197 ..." (setf pf (* 2 3 5 7 )) ; product of prime factors less than 10 (setf offs 10) (setf n 90) ; loop from 10 to 100 (dotimes (i n) (setf pr (gcd pf (+ i offs ))) (when (equal pr 1) (print (+ i offs )) ; (plunk ??) ) )  paul beach sniffyraven@... 
From: paul beach <sniffyraven@fa...>  20101208 01:42:37

The generall topic is vibrations of an elastic solid. The solution to surface vibrations, or Raliegh waves, is given as, u = A (e^rz  e^sz) sin k(x  ct) w = A (e^rz  e^sz) cos k(x  ct), from "The Earth", Harold Jeffreys, 1923. He says that no other type of harmonic wave is capable of continuous propagation over the surface of a homogeneous solid. The subtraction of one exponential from another is of interest. This would represent, to me, different dampings in (two) different directions. Since this is a feature of every musical instrument; the rather subtle amplitude modulations should sound convincing. One instrument has a large surface area, and roars like an earthquakethe church organ. Try the method of exponential differences with some music, Ellen Bayne by Stephen Forster, http://www.climatehoax.ca/music/ellen_bayne.mp3 74k 37 sec. Audacity Progam, How and Why The ear does not respond to stationary phase differences, that is, x = sin, y = cos sounds the same as, x = sin, y = sin. On the other hand octave couplings are common on the Organ, so the difference of exponentials times frequency is summed. (exp^a  exp^b) * sin f ; fundamental (exp^c  exp^d) * sin 2f ; second octave (exp^e  exp^e) * sin 4f ; third octave ;nyquist plugin ;version 1 ;type generate ;name "Exponential Differences_Organ..." ;action "Generating E.D. ..." ;control p "Pitch" int "Frequency" 69 22 122 (stretch 2 (lp (scale 3.0 (sim (mult ( sim (mult 1.0 (expdec 0 0.08 1)) (mult ( 0.0 1.0) 1.0 (expdec 0 0.04 1)) ) (sine p ); first octave ) (mult 1.0 ( sim (mult 1.0 (expdec 0 0.02 1.0)) (mult ( 0.0 1.0) 1.0 (expdec 0 0.010 1.0)) ) (sine (+ 12 p ) ) ; second octave ) (mult 1.0 ( sim (mult 1.0 (expdec 0 0.01 1.0)) (mult ( 0.0 1.0) 1.0 (expdec 0 0.005 1.0)) ) (sine (+ 24 p ) ) ; third octave ) ) ; end sim ) ; end scale 180) ; end low pass filter ) ; end stretch  paul beach sniffyraven@... 
From: paul beach <sniffyraven@fa...>  20101214 02:36:41

Amplitude Modulation Distortion The engineering formula for A.M. is (1 + m sin A) * sin B What usually happens is that a signal radiates into the gate of a FET and we have, for example: exp(sin A + sin B + ....) This spews out harmonics, since 2nd, 3rd, .... powers of sine become 2nd, 3rd, ... harmonics. (sin A + sin B + ...) * (sin A +sin B ...) ... * If only second order terms are considered, the power series can be rearranged, filtered (apparently) and then put into the form at the top of the page. This can be used to generate an overtone series, if the sines are harmonically related, to start with. I use the fundamental plus third partial, for example: (sim (sine 60) (sine sine 79)) The equal temperament should not be a problem, for 'perfect' fifths. For Two Part Invention 14, it sounds like so: http://www.climatehoax.ca/music/two_part_14.mp3 ;nyquist plugin ;version 1 ;type generate ;name " A. M. Instrument..." ;action "A. M. sounds..." ;control p "Pitch" int "Frequency" 69 11 111 (defun crick () (bandpass2 (mult 2 (sexp (mult 2 (sim (sine p) ( 0.0 .5) (sim 1 (mult (/ 18.0 p) (sine (+ p 19 ))))) )) (pwl .005 1 (/ 8.0 p) (/ 8.0 p ) 1) ) 1200 (/ p 44.0 )) ) (notch2 (lowpass2 (crick) (* 2.0 p)) 220 2)  paul beach sniffyraven@... 
From: paul beach <sniffyraven@fa...>  20110620 17:02:01

Thunder model using frequency modulation. FM allows exquisite control of frequency. In this example, (noise) is manipulated; and then, the carrier is simply filtered away. A few years ago, Roger mentioned that the atmosphere acts as a filter. Here, (lowpass6) seems about right. Numbers inside the bracket are interpreted as radian frequency: ( hzosc (sim 440 (hzosc 440))) => sin(440*t + sin(440t)) ;Thunder at a distance (setf d 4) ; Set (stretch d)/(noise d) to 4 seconds. (defun thun () (mult 1.25 (stretch d (env 0.001 0.95 0.85 1.0 0.5 .25) ) ;wave shape (lowpass6 (hzosc (sim 200 (mult 1000 (env 0.01 0.05 0.85 4.0 0.15 .15) ) ; supersonic spike (mult 5000 (noise d) ; modulate noise ) ) ) 150) ) ); end (thun) ; Use (thun) or this extra patch for more harmonics. (mult (stretch d (env 0.05 0.75 0.99 .7 .9 .7)) (hzosc (sim 1.0 (mult 300 (thun)))) )  paul beach sniffyraven@... 
From: edgar <edgarrft@we...>  20100625 18:44:26

Hi Paul (and all others), As it turned out today, there was still a special case missing, if the first argument is zero, the reault must be zero too. Hopefully the final version: (defun mod (x y) (cond ((not (integerp x)) (error "MOD  bad argument type" x)) ((not (integerp y)) (error "MOD  bad argument type" y)) ((zerop y) (error "MOD  division by zero")) ((zerop x) 0) ; if x is zero, the result is zero ((or (and (> x 0) (> y 0)) ; x and y are positive (and (< x 0) (< y 0))) ; x and y are negative (rem x y)) ; equal signs (t (+ (rem x y) y)))) ; unequal signs  edgar  The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: 
From: Roger Dannenberg <rbd@cs...>  20100625 22:31:42

I took a quick look at the XLISP implementation, and REM is directly implemented by calling C's % operator on integers. It looks like REM raises an error on FLONUM arguments. SAL allows you to call REM as a function, e.g. rem(5, 2), or use the "%" operator, e.g. 5 % 2. Roger paul beach wrote: > Rem seems to be more general than mod. Should be useful for multiple > congruences,(the socalled Chinese remainder theory). Also there is a > (gcd a b), meaning greatest common divisor. Even though there is no MOD > statement, LISP seems to be superior with respect to NUMBER theory. Some > topics would be, primitive roots, quadratic residues, congruence. > > Just checking that (rem a b) is the same as modulus: > > ... > 
From: Roger Dannenberg <rbd@cs...>  20100703 21:12:52

There's been much discussion in the past here about the ability of Nyquist to do things like normalizing big files because a simple approach such as (PEAK S NY:ALL) loads all samples of S into Nyquist memory. I've been promising to take a look at this for a long time. I found at least three bugs in the process, but did succeed in writing a pair of plugins that do normalization without using lots of memory. The details are here: http://www.cs.cmu.edu/~music/nyquist/debugplugin.html <http://www.cs.cmu.edu/%7Emusic/nyquist/debugplugin.html>; The most significant bug I found is that if you set a property on *scratch*, it may become invisible to future executions of plugins. Most variables are restored to their original values after running a plugin, preventing plugins from messing up the Nyquist runtime system. While *scratch* is carefully preserved to provide communication channel from one plugin to the next, and while we've said that the way to use it is to put perplugin properties on *scratch*, we didn't anticipate some rather bizarre behavior: If you make up a property symbol, e.g. 'NORMALIZEPART1 and put a property on *scratch*, the property is retained, but the symbol, being new, is removed from the symbol table (the obarray). This doesn't actually delete the property or the symbol, but when another plugin tries to look up the symbol, the code has to be parsed and the symbol looked up. The lookup will fail, so XLisp creates *another* symbol with the same name and adds it to the symbol table. Then the plugin goes to get the property, the GET function scans the property list looking for a pointer match (there's no need for string compares on symbols since it is assumed that symbols are unique). The lookup fails. The rather bizarre part is that if you choose a common symbol like 'TEST as we did when we tested the new facility, chances are the symbol already existed in Nyquist, so it was not removed from the symbol table. In those cases, the *scratch* property list works as expected. Did we already discover this? I seem to remember someone claiming this was broken (correct) and maybe I posted a quick demonstration that it worked fine (if so, I owe an apology  I must have used something like 'TEST as the property symbol). In any case, now we know the problem. I implemented a fix, but I'm not in a good state to commit changes. If someone (Leland?) wants the patch to nyx.c, I can send it. Roger 