[Audacity-nyquist] Number Theory Application From: paul beach - 2010-06-26 21:31 ```(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 plug-in. ;nyquist plug-in ;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 bi-list '()) ; make bi-list 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 bi-list) (push (* 222 song) bi-list) ; increase frequency modulation ) ; end dotimes (setf bi-list (reverse bi-list) ) ;scale amplitde modulation by 0.00025 (mult 0.00025 (pwl-list bi-list) (fmosc c (pwl-list bi-list)) ) ); end tweet definition (seq (tweet k2) (s-rest s1) (tweet k3) ) -- paul beach sniffyraven@... ```

[Audacity-nyquist] ;control widget documentation? Stevethefiddle <stevethefiddle@gm...>
 Re: [Audacity-nyquist] ;control widget documentation? From: paul beach - 2010-06-11 18:44 ```Rate, Tempo, seem to be commands for Adagio Midi commands. It is not likely that I would use a plug-in 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" said: > > I notice that the word "rate" can be used as a parameter with slider > widgets; > for example, the following plug-in will display the current sample rate: > > ;nyquist plug-in > ;version 1 > ;type generate > ;name "Show-SampleRate..." > ;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/control-widget-documentation-tp5156108p5156108.html > Sent from the audacity-nyquist 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/thinkgeek-promo > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist -- paul beach sniffyraven@... ```

 Re: [Audacity-nyquist] ;control widget documentation? From: Stevethefiddle - 2010-06-15 01:17 ```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/control-widget-documentation-tp5156108p5180023.html Sent from the audacity-nyquist mailing list archive at Nabble.com. ```

 Re: [Audacity-nyquist] ;control widget documentation? From: paul beach - 2010-06-17 20:11 ```Nyquist-Audacity 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: # Arguments: ((FIRST%SOUND (RATE 50 (SINE 60 0.2))) (S%RATE (GET-SRATES FIRST%SOUND))) (COND ((ARRAYP FIRST%SOUND) (SND-MULTISEQ (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)) (AT-ABS T0 (FORCE-SRATES S%RATE (SINE 62 0.1)))))))) (T (SND-SEQ (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)) (AT-ABS T0 (FORCE-SRATE S%RATE (SINE 62 0.1))))))))) -- paul beach sniffyraven@... ```

 Re: [Audacity-nyquist] ;control widget documentation? From: Roger Dannenberg - 2010-06-17 21:18 ```paul beach wrote: > Nyquist-Audacity 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: # > Arguments: > ((FIRST%SOUND (RATE 50 (SINE 60 0.2))) (S%RATE (GET-SRATES > FIRST%SOUND))) > (COND ((ARRAYP FIRST%SOUND) (SND-MULTISEQ (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)) (AT-ABS T0 (FORCE-SRATES S%RATE > (SINE 62 0.1)))))))) (T (SND-SEQ (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)) (AT-ABS T0 (FORCE-SRATE S%RATE (SINE > 62 0.1))))))))) > ```

 Re: [Audacity-nyquist] ;control widget documentation? From: edgar - 2010-06-19 13:09 ```Still unanswered question: the Audacity "rate" variable The "rate" variable never was documented because it is a typical Audacity short-brainer causing more problems than it does any good. The "rate" variable only works only inside the header lines of an Audacity Nyquist plugin, it represents the sample frequency of the first selected Audacity track. The "rate" variable badly messes-up things as soon as you apply a Nyquist effect to more than only one selected Audacity tracks, where the Audacity tracks have different sample rates. The "rate" variable is only set once, before the plugin code is applied to the first selected Audacity track, but in contrast to the Nyquist *sound-srate* variable, the Audacity "rate" variable NEVER gets updated with subsequent audio tracks. It works much better if you specify a frequency either directly in Hertz or in "percent" of the track's sample-rate and then compute the exact "percents" in Herts out of the Nyquist *sound-srate* variable for each track separately. In one sentence: forget the "rate" variable as fast as you can. - edgar Original message was: I notice that the word "rate" can be used as a parameter with slider widgets; for example, the following plug-in will display the current sample rate: ;nyquist plug-in ;version 1 ;type generate ;name "Show-SampleRate..." ;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? ```

 [Audacity-nyquist] FM signal sweep From: paul beach - 2010-06-19 17:47 ```I want to convert a Generate, to an Effect plug-in. But fmosc does not take a signal parameter. It is possible to FM sweep the signal? (fmosc c (pwl-list bi-list)) ; binomial filter -- paul beach sniffyraven@... ```

 Re: [Audacity-nyquist] FM signal sweep From: edgar - 2010-06-19 19:15 ```> Paul Beach wrote: > > I want to convert a Generate, to an Effect plug-in. But fmosc does > not take a signal parameter. It is possible to FM sweep the signal? > > (fmosc c (pwl-list bi-list)) ; binomial filter Could we have the complete context please? And what are the exact Nyquist error messages? Asks - edgar ```

 Re: [Audacity-nyquist] FM signal sweep From: paul beach - 2010-06-21 20:57 ```Transpose is a handy instruction to change the frequency in semitones. Shift an a-note up an octave, (transpose 12 (hzosc 220)) ; 12 semitones = an 8ve But it has no Effect on a sinewave. Generate plug-in, or Nyquist prompt: (transpose 12 s) does nothing and returns no error message. -- paul beach sniffyraven@... ```

 Re: [Audacity-nyquist] FM signal sweep From: Roger Dannenberg - 2010-06-21 21:55 ```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 a-note up an octave, > (transpose 12 (hzosc 220)) ; 12 semitones = an 8ve > > But it has no Effect on a sinewave. > Generate plug-in, or Nyquist prompt: > (transpose 12 s) > does nothing and returns no error message. > ```

 [Audacity-nyquist] utilities From: paul beach - 2010-06-24 15:24 ```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@... ```

 Re: [Audacity-nyquist] utilities From: edgar - 2010-06-24 18:25 ```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.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-217.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: ```

 [Audacity-nyquist] Number theory with Nyquist. From: paul beach - 2010-06-24 19:49 ```Rem seems to be more general than mod. Should be useful for multiple congruences,(the so-called 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" 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.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-217.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/thinkgeek-promo > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist -- paul beach sniffyraven@... ```

 Re: [Audacity-nyquist] Number theory with Nyquist. From: edgar - 2010-06-24 20:34 ```paul beach wrote: > Rem seems to be more general than mod. Should be useful for multiple > congruences,(the so-called 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 real-math 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: ```

 Re: [Audacity-nyquist] Number theory with Nyquist. From: edgar - 2010-06-24 21:31 ```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: ```

 Re: [Audacity-nyquist] Number theory with Nyquist. From: edgar - 2010-06-24 21:58 ```As I said: I'm not a really good mathematician. The previous MOD function only worked with one-digit 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: ```

 Re: [Audacity-nyquist] Number theory with Nyquist. From: paul beach - 2010-06-24 22:55 ```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" said: > As I said: I'm not a really good mathematician. The previous > MOD function only worked with one-digit 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/thinkgeek-promo > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist -- paul beach sniffyraven@... ```

 [Audacity-nyquist] Number theory with Nyquist-remark #2 From: paul beach - 2010-06-24 23:13 ```I am happy with the source code, (last eMail). However, these improvements could be made in a future version of Nyquist. (rem-minus a b ) ; see Edgar's code. (rem-decimal a b) -paul -- paul beach sniffyraven@... ```

 Re: [Audacity-nyquist] Number theory with Nyquist. From: edgar - 2010-06-25 18:44 ```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: ```

 Re: [Audacity-nyquist] Number theory with Nyquist. From: Roger Dannenberg - 2010-06-25 22:31 ```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 so-called 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: > > ... > ```

 [Audacity-nyquist] Number Theory Application From: paul beach - 2010-06-26 21:31 ```(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 plug-in. ;nyquist plug-in ;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 bi-list '()) ; make bi-list 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 bi-list) (push (* 222 song) bi-list) ; increase frequency modulation ) ; end dotimes (setf bi-list (reverse bi-list) ) ;scale amplitde modulation by 0.00025 (mult 0.00025 (pwl-list bi-list) (fmosc c (pwl-list bi-list)) ) ); end tweet definition (seq (tweet k2) (s-rest s1) (tweet k3) ) -- paul beach sniffyraven@... ```

 [Audacity-nyquist] Generate Primes with (gcd x y) From: paul beach - 2010-07-03 21:01 ```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 D-flat, F, G, and B, which would be an augmented French 6th in the key of F-minor. I was trying to get (plunk) into the loop, any suggestions would be appreciated. -paul ;nyquist plug-in ;version 1 ;type generate ;name "A prime series..." ;action "Prime numbers 11-97 ..." (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@... ```

 [Audacity-nyquist] Normalization and memory usage in Nyquist Plug-ins, also using *SCRATCH* From: Roger Dannenberg - 2010-07-03 21:12 ```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 plug-ins that do normalization without using lots of memory. The details are here: http://www.cs.cmu.edu/~music/nyquist/debug-plugin.html The most significant bug I found is that if you set a property on *scratch*, it may become invisible to future executions of plug-ins. Most variables are restored to their original values after running a plug-in, preventing plug-ins from messing up the Nyquist runtime system. While *scratch* is carefully preserved to provide communication channel from one plug-in to the next, and while we've said that the way to use it is to put per-plug-in properties on *scratch*, we didn't anticipate some rather bizarre behavior: If you make up a property symbol, e.g. 'NORMALIZE-PART1 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 plug-in 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 plug-in 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 ```

 [Audacity-nyquist] Raliegh Waves Model From: paul beach - 2010-12-08 01:42 ```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 earthquake--the 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 plug-in ;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 (exp-dec 0 0.08 1)) (mult (- 0.0 1.0) 1.0 (exp-dec 0 0.04 1)) ) (sine p ); first octave ) (mult 1.0 ( sim (mult 1.0 (exp-dec 0 0.02 1.0)) (mult (- 0.0 1.0) 1.0 (exp-dec 0 0.010 1.0)) ) (sine (+ 12 p ) ) ; second octave ) (mult 1.0 ( sim (mult 1.0 (exp-dec 0 0.01 1.0)) (mult (- 0.0 1.0) 1.0 (exp-dec 0 0.005 1.0)) ) (sine (+ 24 p ) ) ; third octave ) ) ; end sim ) ; end scale 180) ; end low pass filter ) ; end stretch -- paul beach sniffyraven@... ```

 [Audacity-nyquist] Amplitude Modulation Distortion From: paul beach - 2010-12-14 02:36 ```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 plug-in ;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 (s-exp (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@... ```

 [Audacity-nyquist] Thunder model using frequency modulation. From: paul beach - 2011-06-20 17:02 ```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@... ```