Nyquist Prompt script and lastlog.txt contents provided

Windows 11, Pro
Audacity 3.6.1

I am trying to stack and time-shift then amplify by -40 db identical tracks of a prayer, which will essentially enhance the effectiveness of the prayer with neither a bulge in the middle of the resulting track nor the length of the track increasing. For this purpose I came up with the idea of using Nyquist Prompt to loop the stacking in a way that the end of track protrusions will be added to the beginning of resulting track.

Here is the script that I was given by Meta AI:

Nyquist

; Define the number of layers (tracks)
(setq layers 100000)

; Define the number of generations (iterations)
(setq gens 50)

; Define the amplification reduction (in dB)
(setq amp-reduction -40.0)

; Define the shift amount
(setq shift 0.001)

(defun process (sig gen)
(format t “Processing generation ~a…~%” gen)
(let ((imp-dur (/ layers (* sound-srate (get-duration 1)))))
(format t “Impulse duration: ~a~%” imp-dur)
(let ((impulse)
(shift-amount (* shift gen)))
(setf impulse (control-srate-abs sound-srate
(const 1 imp-dur)))
(setf sig (convolve sig impulse))
(setf sig (time-shift sig shift-amount))
(mult sig (/ (peak sig *)))
; Amplification reduction at the end of each generation
(db-to-linear (linear-to-db sig amp-reduction)))))

(multichan-expand
(lambda (sig)
(dotimes (gen gens)
(format t “Generation ~a of ~a…~%” (1+ gen) gens)
(setf sig (process sig gen))))
track)

And finally, here is the full contents of the lastlog.txt file:

20:31:08: Audacity 3.6.1
20:31:08: Error: Failed to load shared library ‘avformat-61.dll’ (error 126: The specified module could not be found.)
20:31:08: Error: Failed to load shared library ‘avformat-60.dll’ (error 126: The specified module could not be found.)
20:31:08: Error: Failed to load shared library ‘avformat-59.dll’ (error 126: The specified module could not be found.)
20:31:08: Error: Failed to load shared library ‘avformat-58.dll’ (error 126: The specified module could not be found.)
20:31:08: Error: Failed to load shared library ‘avformat-57.dll’ (error 126: The specified module could not be found.)
20:31:08: Error: Failed to load shared library ‘avformat-55.dll’ (error 126: The specified module could not be found.)
20:31:11: Error: Failed to load shared library ‘avformat-61.dll’ (error 126: The specified module could not be found.)
20:31:11: Error: Failed to load shared library ‘avformat-60.dll’ (error 126: The specified module could not be found.)
20:31:11: Error: Failed to load shared library ‘avformat-59.dll’ (error 126: The specified module could not be found.)
20:31:11: Error: Failed to load shared library ‘avformat-58.dll’ (error 126: The specified module could not be found.)
20:31:11: Error: Failed to load shared library ‘avformat-57.dll’ (error 126: The specified module could not be found.)
20:31:11: Error: Failed to load shared library ‘avformat-55.dll’ (error 126: The specified module could not be found.)
20:31:59: File name is D:\000000000000-3\Detailed\Detailed 000000.wav
20:31:59: Mime type is *
20:31:59: Opening with libsndfile
20:31:59: Open(D:\000000000000-3\Detailed\Detailed 000000.wav) succeeded
20:32:00: Operation ‘Importing WAV (Microsoft)’ took 1.516000 seconds. Poll was called 225 times and took 0.041655 seconds. Yield was called 19 times and took 0.011940 seconds.
20:32:01: Operation ‘Music Information Retrieval’ took 0.901000 seconds. Poll was called 8192 times and took 0.150768 seconds. Yield was called 8 times and took 0.126938 seconds.
20:33:14: Operation ‘Pre-processing’ took 0.000000 seconds. Poll was called 0 times and took 0.000000 seconds. Yield was called 0 times and took 0.000000 seconds.
20:33:14: ‘Nyquist Prompt’ returned:
error: unbound variable - NYQUIST
if continued: try evaluating symbol again
1> 100000
1> 50
1> -40
1> 0.001
1> PROCESS
1> Generation 1 of 50…
Processing generation 0…
Impulse duration: 0.00170331
error: too few arguments - NIL
2> 1>
20:33:14: Nyquist returned nyx_error:
error: unbound variable - NYQUIST
if continued: try evaluating symbol again
1> 100000
1> 50
1> -40
1> 0.001
1> PROCESS
1> Generation 1 of 50…
Processing generation 0…
Impulse duration: 0.00170331
error: too few arguments - NIL
2> 1>
20:33:14: Operation ‘Nyquist Prompt’ took 0.119000 seconds. Poll was called 1 times and took 0.000001 seconds. Yield was called 0 times and took 0.000000 seconds.

Please help me troubleshoot this script.

And here, also is the Nyquist Prompt debug output:

error: unbound variable - NYQUIST
if continued: try evaluating symbol again
1> 100000
1> 50
1> -40
1> 0.001
1> PROCESS
1> Generation 1 of 50…
Processing generation 0…
Impulse duration: 0.00170331
error: too few arguments - NIL
Function: #<FSubr-LET: #000002C5D1D83680>
Arguments:
((IMPULSE) (SHIFT-AMOUNT (* SHIFT GEN)))
(SETF IMPULSE (CONTROL-SRATE-ABS SOUND-SRATE (CONST 1 IMP-DUR)))
(SETF SIG (CONVOLVE SIG IMPULSE))
(SETF SIG (TIME-SHIFT SIG SHIFT-AMOUNT))
(MULT SIG (/ (PEAK SIG )))
(DB-TO-LINEAR (LINEAR-TO-DB SIG AMP-REDUCTION))
Function: #<FSubr-LET: #000002C5D1D83680>
Arguments:
((IMP-DUR (/ LAYERS (
SOUND-SRATE (GET-DURATION 1)))))
(FORMAT T “Impulse duration: ~a~%” IMP-DUR)
(LET ((IMPULSE) (SHIFT-AMOUNT (* SHIFT GEN))) (SETF IMPULSE (CONTROL-SRATE-ABS SOUND-SRATE (CONST 1 IMP-DUR))) (SETF SIG (CONVOLVE SIG IMPULSE)) (SETF SIG (TIME-SHIFT SIG SHIFT-AMOUNT)) (MULT SIG (/ (PEAK SIG *))) (DB-TO-LINEAR (LINEAR-TO-DB SIG AMP-REDUCTION)))
Function: #<Closure-PROCESS: #000002C5D1B696C8>
Arguments:
#<Sound: #000002C5D1864628>
0
Function: #<FSubr-SETF: #000002C5D1D83398>
Arguments:
SIG
(PROCESS SIG GEN)
Function: #<FSubr-DOTIMES: #000002C5D1D88F60>
Arguments:
(GEN GENS)
(FORMAT T “Generation ~a of ~a…~%” (1+ GEN) GENS)
(SETF SIG (PROCESS SIG GEN))
Function: #<Closure: #000002C5D1B68930>
Arguments:
#<Sound: #000002C5D1864628>
Function: #<Subr-APPLY: #000002C5D1D858B8>
Arguments:
#<Closure: #000002C5D1B68930>
(#<Sound: #000002C5D1864628>)
Function: #<FSubr-COND: #000002C5D1D88180>
Arguments:
(LEN (SETF RESULT (MAKE-ARRAY LEN)) (DOTIMES (I LEN) (SETF (AREF RESULT I) (APPLY FN (MAPCAR (FUNCTION (LAMBDA (A) (COND ((ARRAYP A) (AREF A I)) (T A)))) ARGS)))) RESULT)
(T (APPLY FN ARGS))
Function: #<FSubr-LET: #000002C5D1D83680>
Arguments:
(LEN NEWLEN RESULT)
(DOLIST (A ARGS) (COND ((ARRAYP A) (SETF NEWLEN (LENGTH A)) (COND ((AND LEN (/= LEN NEWLEN)) (ERROR (FORMAT NIL “In ~A, two arguments are vectors of differing length.” FN)))) (SETF LEN NEWLEN))))
(COND (LEN (SETF RESULT (MAKE-ARRAY LEN)) (DOTIMES (I LEN) (SETF (AREF RESULT I) (APPLY FN (MAPCAR (FUNCTION (LAMBDA (A) (COND ((ARRAYP A) (AREF A I)) (T A)))) ARGS)))) RESULT) (T (APPLY FN ARGS)))
Function: #<Closure-MULTICHAN-EXPAND-OLD: #000002C5D1ACB098>
Arguments:
#<Closure: #000002C5D1B68930>
#<Sound: #000002C5D1864628>
Function: #<Subr-APPLY: #000002C5D1D858B8>
Arguments:
MULTICHAN-EXPAND-OLD
(#<Closure: #000002C5D1B68930> #<Sound: #000002C5D1864628>)
Function: #<FSubr-IF: #000002C5D1D8A8C8>
Arguments:
(STRINGP (FIRST ARGS))
(APPLY (QUOTE MULTICHAN-EXPAND-NEW) ARGS)
(APPLY (QUOTE MULTICHAN-EXPAND-OLD) ARGS)
Function: #<Closure-MULTICHAN-EXPAND: #000002C5D1ACBEC0>
Arguments:
#<Closure: #000002C5D1B68930>
#<Sound: #000002C5D1864628>
2> 1>

That’s true, which is why I am here now.

What exactly do you mean? Describe, step by step, how I would do that manually.

Manually - and with NP too, I only know how to do unlooped version, which has a bulging point in the middle of the track and long silent parts at either end. What I am trying to achieve - I don’t even know how to do it manually - is to, after the stacking and time-shifting, each time that they are done, the extra length of the shifted track be removed from the end and be inserted onto the beginning. This way the whole track will have subconsciously -at lease - audible parts across the entire listening time.

Thank you so much for your interest in this.
HP

Sorry but I don’t understand what you are trying to do, so I am not able to make any suggestions.

I am trying to create a subliminal/prayer track which by listening to once, it’s as if you’ve listened multiple times (what I need is googles of times of tracks stacked on top of each other, so by listening once, I have heard the subliminal prayer a huge number of times. I have an NP script that produces a nonlooped track. I will past part of it below that might help you see the bulge of high amplitude in the middle and length of the track keeps growing with each time of stacking and time-shifting:

NyquistPrompt:Command=“;control layers "Number of layers" int "" 10000 1 4000000\n\n(defun process (sig)\n (let ((imp-dur (/ layers (* sound-srate (get-duration 1))))\n impulse)\n (setf impulse (control-srate-abs sound-srate\n (const 1 imp-dur)))\n (setf sig (convolve sig impulse))\n (mult sig (/ (peak sig ny:all)))))\n\n(multichan-expand #'process track)” Parameters=“layers="10000"”
Amplify:Ratio=“0.0079432819”
NyquistPrompt:Command=“;control layers "Number of layers" int "" 10000 1 4000000\n\n(defun process (sig)\n (let ((imp-dur (/ layers (* sound-srate (get-duration 1))))\n impulse)\n (setf impulse (control-srate-abs sound-srate\n (const 1 imp-dur)))\n (setf sig (convolve sig impulse))\n (mult sig (/ (peak sig ny:all)))))\n\n(multichan-expand #'process track)” Parameters=“layers="10000"”
Amplify:Ratio=“0.0079432819”

… Repeated 50 times.

Also the AI said this could be accomplished manually with below steps:

You want to create a looped track in Audacity that:

  1. Can be stacked multiple times without creating a bulge in the middle (i.e., no noticeable increase in volume or distortion)

  2. Doesn’t add to the length of the original track

To achieve this, you can try the following steps:

  1. Split the track: Select the track, go to Edit > Split > Split (or Ctrl+I), and split the track into two identical copies.

  2. Loop the split tracks: Select both tracks, go to Effect > Repeat (or Ctrl+Shift+R), and set the repeat count to a high number (e.g., 100).

  3. Sync the tracks: Make sure the tracks are synchronized by selecting both and using Tracks > Sync > Sync (or Ctrl+Shift+S).

  4. Mix the tracks: Go to Tracks > Mix > Mix (or Ctrl+Shift+M) to combine the looped tracks into a single track.

  5. Adjust gain (optional): If you notice any slight volume increase, select the mixed track and use Effect > Amplify (or Ctrl+Shift+A) to adjust the gain.

Here’s another try of helping put across what it is I am trying to achieve:

Goal: Create a layered audio effect using Nyquist Prompt, where:

  1. A single audio track is duplicated and stacked multiple times (e.g., 100,000 layers).

  2. Each duplicated track is time-shifted by a small amount (e.g., 0.001 seconds) relative to the previous track.

  3. The resulting layered audio effect should not increase the overall length of the original track.

  4. The script should apply amplification reduction to prevent clipping.

Desired outcome: A dense, layered sound with a consistent duration, achieved by stacking and time-shifting multiple copies of the original audio track.

We found out about circular-shifting and that changed the whole code drastically. Here it is with example settings:

Lisp

(defun snd-subseq (sound start end)
(subseq sound start end))

(defun snd-slice (sound start end)
(snd-subseq sound start end))

;; Define the number of layers (tracks)
(setf layers 100)

;; Define the amplification reduction (in dB)
(setf amp-reduction -60.0)

;; Define the shift amount (in seconds)
(setf shift 0.001)

(defun circular-shift (sig shift-amount)
(let* ((dur (snd-length sig 0)) ; Added channel number 0
(sr (snd-srate sig))
(shift-samples (round (* shift-amount sr)))
(left-part (snd-slice sig 0 shift-samples))
(right-part (snd-slice sig shift-samples (- dur shift-samples))))
(seq (cue right-part) (cue left-part))))

(defun process-layers (sig)
(let ((result sig))
(dotimes (gen layers)
(let* ((shift-amount (* shift gen))
(shifted-sig (circular-shift sig shift-amount))
(amplitude (db-to-linear (- amp-reduction (* (/ gen layers) amp-reduction)))))
(setf result (sum result (scale amplitude shifted-sig)))))
(scale (/ 1.0 (snd-max result 0)) result))) ; Added channel number 0

(defun process-input (input)
(cond
((numberp input) (process-layers (sine input 1.0)))
((soundp input) (process-layers input))
(t (error “Input must be a number (frequency) or a sound object”))))

;; Check if we have valid input
(setf s (if (and (boundp 's) (soundp s))
s
(sine 440.0 1.0))) ; Default to 1-second 440 Hz sine wave if no valid input

;; Ensure the sound is long enough
(setf s (sim s (s-rest (max 0 (- (* 2 layers shift) (snd-length s 0)))))) ; Added channel number 0

(multichan-expand #'process-input s)

You can either run it in your setup or ask me for my debug output.

I’ve never done any scripting so I can’t help you…

100,000 copies on top of each other (ignoring the time shift for the moment) would amplify it by 100,000 which is +100dB.

Without a delay, duplication (mixing something with itself) is exactly the same as amplification.

That will cause comb filtering and a big mess. With enough copies it will become unintelligible. Maybe that’s OK with subliminals, since you don’t want to hear it anyway?

To see what the effect is, you can try it manually with 3 or 4 copies before making it subliminal. But if you combine 4 copies, reduce the volume to 25% (-12dB) before time-shifting and mixing.

Of course, every time you delay by 1ms, it gets 1ms longer. 100,000 times, that will extend the audio by 10 seconds.

Exactly; the subconscious mind can follow along even if you reversed and layered the tracks, and sped them up hundreds of times too.

You understood the issues very well. Now, we just need a hard core NP coder to fix things up for us.

Cheers,
Bryan

This will give you 1000 repeats. It is too slow for 100000 repeats.
If you test this with a short, audible speech recording, you may be surprised by what it sounds like.
I’ve not tested with long tracks, but it works for me with a 4 minute track.

(setf repeats 1000)  ; Number of repeats

(defun normalize (sig)
  (setf max-samples 1000000)
  (mult sig (/ 1.0 (peak sig max-samples))))


(defun do-repeats (sig n)
  (let ((s (mult (/ (sqrt (float n))) sig))
        (out (s-rest 1)))
    (dotimes (i n)
      (setf out (sim out
                     (at-abs (* i 0.001) (cue s)))))
    ;; If normalization is required
    ; (setf out (normalize out))
    out))

(multichan-expand #'do-repeats *track* repeats)

Thank you, Steve. When I run it there are no bugs. But the issue is that we’re not doing circular shifting, so, as a result there will be silent ends and the length of the audio will increase. Could you please provide the code with circular-shifting?

Just cut off the bit at the end, place it in a new track, align it with the start, and mix the two tracks.

Steve, many thanks again, but slicing bits off the end and placing it at the beginning - I tried it - can never be precise. Plus, I don’t want to be limited to 1000 layers, rather I’d like to do at least 100000 layers per generation and be able to do 50 generations in one go. The only way to achieve this is by fully automating the process and a negative amplification by say -44 db at the end of each generation.

Thanks a million,
Bryan

Another AI produced the below code that results in errors again:

lisp

Copy

`(setf repeats 1000) ; Number of repeats

(defun normalize (sig)
(setf max-samples 1000000)
(mult sig (/ 1.0 (peak sig max-samples))))

(defun do-repeats (sig n)
(let* ((s (mult (/ (sqrt (float n))) sig))
(duration (snd-length s sound-srate))
(out (s-rest 0))) ; Start with an empty sound
(dotimes (i n)
(let ((shift-amount (mod (* i 0.001) duration)))
(setf out (sum out
(at-abs 0 (cue (extract-abs shift-amount duration s)))))))
;; If normalization is required
; (setf out (normalize out))
out))

(multichan-expand #'do-repeats track repeats)`

Why is it not precise? You just need to select from the original end position, which you can mark with a label if necessary, to the new end of the track. Cut that part, paste to a new track, and align with the start of the original selection.

I’m not really inclined to spend much more time on this as it cannot possibly have any subliminal effect after the being so thoroughly mashed.

That’s exactly the point it’s supposed to be so thoroughly mashed that nothing can compete with it. I already have something with close to a googolplex of repetition that has taken me years to develop. I am listening to that one 24/7 - you know for what? For HeavenS on Earth - but now that I am more experienced, I want something that can surpass the power of the previous one in just a few days.

This version does 10,000 repeats, and loops the tail back to the beginning.

(setf repeats 10000)  ; Number of repeats
(setf delay 0.001)

(defun normalize (sig)
  (setf max-samples 100000000)
  (if (soundp sig)
      (setf factor (/ 1.0 (peak sig max-samples)))
      (setf factor (vector (/ 1.0 (peak (aref sig 0) max-samples))
                           (/ 1.0 (peak (aref sig 1) max-samples)))))
  (mult sig factor))

(defun make-impulse ()
  (setf impulse-array (make-array (truncate (* *sound-srate* delay))))
  (dotimes (i (length impulse-array))
    (setf (aref impulse-array i) 0))
  (setf (aref impulse-array 0) 1)
  (snd-from-array 0 *sound-srate* impulse-array))

(defun do-repeats (sig impulse)
  (let* ((convolved (convolve sig impulse))
         (tail (extract 1 2 convolved)))
    (extract 0 1 (sim convolved tail))))

(defun process ()
  (let ((impulse-train (seqrep (i repeats) (cue (make-impulse)))))
    (setf repeated (multichan-expand #'do-repeats *track* impulse-train))
    (normalize repeated)))


(process)

To do much more than 10,000 repetitions in one go I think you would need to use a different programming language, such as C/Cpp or Rust, rather than Nyquist + Audacity.