modify Reverse Bouncing Ball With Tone Shift

I use Audacity 2.1.1 under Windows 8.
I try to modify this plug-in. I would want that the effect applies to a single channel.
There is a problem. The code is:

;nyquist plug-in

;version 1
;type process
;name "RBBDTONE (channel)..."
;action "Applying reverse bouncing ball Delay with tone shift only
;on one chanel..."
;info "Reverse bouncing ball delay with Tone Shift by David R. Sky"

;control decay "Decay amount" real "dB" 0.05 0.00 5.00

;control delay "Delay time" real "seconds" 0.02 0.01 1.00

;control count "Number of bounces" int "times" 15 1 100

;control toneshift1 "Tone shift (whole)" int "semitones" -1 -24 24

;control toneshift2 "Tone shift (cents)" int "cents" 0 -100 100

;control channel "Channel" int "0=left 1=right" 0 0 1 

;control dur "duration" int "seconds" 5 1 60

(setf toneshift (sum toneshift1 (mult toneshift2 0.01)))

(setf toneshift (expt 2.0 (/ toneshift 12.0)))

(setf toneshift (/ 1.0 toneshift))

(defun change (s toneshift)
(force-srate 44100 (stretch-abs toneshift (sound s))))

;; Like reverse bouncing ball, but each bounce is tone shifted.

(truncate count)
(setf revcount (sum count 1))

(defun revbounces (s decay delay count)
 (if (= count 0) 
  (cue s)
   (sim (cue s)
               (loud decay (at (mult delay (- revcount count))
(revbounces (change s toneshift) decay delay 
(- count 1))))))) 

(defun mytone ()
 (if (= channel 0)
   (mult (revbounces (aref s 0) (- 0 decay) delay count)) 
   (seq (aref s 1) (s-rest dur)))
   (seq (aref s 0) (s-rest dur))
   (mult (revbounces (aref s 1) (- 0 decay) delay count)))))

(stretch-abs 1 

The console Nyquist indicates the following error:

error: illegal character - -62
1> error: illegal character - -96
2> -0.59
2> 0.966494
2> 1.03467
2> 11
2> 12
2> #(#<Sound: #9f38738> #<Sound: #9f387d8>)
2> 1>

Do you see where is the error in the code?
Beforehand thank you.

Do you mean that you want it to apply to a single channel of a stereo track, or that you want it to work with a mono track?

I’ve tried the code and it already works with a single channel of a stereo track :confused:

Which plug-in?
Is this the plug-in that you are modifying:

Reverse Bouncing Ball Delay with Tone Shift

Thank you for your answer.
_ Yes. My code uses the code of the plug-in “Reverse Bouncing Ball Delay With Tone Shift” of David R. Sky.
_ I try to apply the delay effect on a single channel of a stereo audio file.

When I tried this code to generate an audio file, it did not work. The nyquist console also indicated the same error message: “error: illegal character”. Then, I placed of a space after (setf toneshift1 -1), then the code worked. It is strange. I have the impression that there is a kind of bug.
It happened several times with different codes. I make one copy / stick of a code which works well. I place it in the console Nyquist; and Nyquist indicates:
"error: illegal character ".
I hope that it is understandable.

I don’t see (setf toneshift1 -1) anywhere in your code :confused:

Typing errors are a common cause for such things. I make typing errors all the time and they can be quite hard to spot sometimes.

_ I badly expressed myself. We can transform the code of the plug-in to use the console Nyquist. In this case, it is necessary to replace; control decay “decay amount” … by (setf decay 2) for exemple.
In fact when I click on “Déboguer” or “Preview” Nyquist Nyquist show: “Nyquist a retourné la valeur: 13” (This value corresponds to the value chosen in the plug-in).

When I write the code of the plug - in I use NotePad ++. I save in the .lisp format . Then, I copy in Program Files (x 86)/Audacity/Plug-ins Files/. But, I have to change the extension of the file. At this moment there, Windows indicates that it can corrupt the file.
Has there it another way to save in the format .ny?
I hope that it is understandable.
Beforehand thank you for the piece of information.

You mean the “Nyquist Prompt” effect?

In the current 2.1.1 version of Audacity you can use normal plug-in code. If you copy and paste the full contents of the original “Reverse Bouncing Ball Delay With Tone Shift” file into the Nyquist Prompt (Audacity 2.1.1), then the full code, including the “;control” statements are interpreted and the code will run just like an installed plug-in.