Hi, i’m not sure if this is the proper place to ask so excuse me if this belongs to somewhere else.

I am looking for a possibility to automatically generate multiple sinus waves (or rather - a sound) with different amplitudes, based on a spreadsheet (containing frequency and amplitude) and each with a random phase offset. Is there a plugin or an easy way to do that for a “luser” in audio editing like me? ^^

The background is the following - i have the frequency spectrum of gear combinations (transmission) through numerical calculations in spreadsheet format and i’d like to “audiolise” (visualising for the ears so to speak) the results

That’s no problem.
You can directly produce executable code within the spreadsheet and paste in the nyquist prompt to produce a sound in Audacity.
What program do you use? I’m only familiar with Excel.
However, the formulas needed are so simple that it will be the same in most applications.
Let’s say we have frequency in A2:An and Amplitude in B2:Bn and the duration would be 1 s:
C1:

``````="(abs-env (sim"
``````

C2:

``````="   (scale "&B2&" (hzosc "&A2&" *table* (real-random 0 360)))"
``````

The same formula for all up to Cn.
Cn+1:

``````="))"
``````

Don’t forget the equal signs.
As you can see, the phases are randomized on the fly.
I’ve written it adhoc, so there might still be a mistake in it.

All you have to do afterwards is copying the C1:Cn range, put it in the Nyquist Prompt (Effect menu) and press OK.

Great! Thank you, it works perfectly.
Is there a way/workaround to increase the maximum amount of lines the nyquist window can take at once? It cuts off the pasted code if there are more then ~500 lines

I think the text box limit is about 32768 characters.
Thus the limit is not defined by actual lines.
How many sine waves do you intent to sum up?
You can use the variable “s” to add the existing audio in the track to the new ones.
E.g.

``````="abs-env (sim s"
``````

in C1.
You would copy the first 300 cells, put it in the nyquist prompt, append to parenthesis ‘))’ and create the tone with ok.
Then, you would copy the next 400 cells and overwrite all after “sim” in the Nyquist Prompt with the copied cells. Don’t forget to place the variable s somewhere (after sim for example).

There are several methods to make the code more consise.
For example (for the Nyquist Promt):

``````(defun accumulate  (duration list)
(abs-env (stretch-abs duration  (simrep (i (/ (length list) 2))
(scale (nth (1+ (* 2 i)) list)
(hzosc (nth (* i 2) list) *table*
(real-random 0 360)))))))
;;
(accumulate 2.0; duration in seconds
(list
>Overwrite me with the two copied columns, freq&amp>
))
``````

All you have to do is to copy the two columns - without header - at the indicated position.
You can also change the duration (2 s, after “(accumulate”)
Store the code also in the spreadsheet in order to have it handy.

Too many sine waves may cause a stack overflow–no warranty

If that is the case on your machine, then it may be platform dependent, or it may not just be a character count limit.
I’ve just tried pasting code into the Nyquist Prompt effect which included 4 extremely long comments (> 30000 characters per comment) with simple PRINT commands between. The PRINT commands were all correctly executed, and all of the data (including comments) was correctly retained in the text box when I reopened the effect.
The total character count for this experiment was 153568 characters.

For huge amounts of data, it would really be better to read from a file.

Update: successfully repeated the above test with > 1.2 million characters.

Update: Also works with > 5 million characters, though it is becoming very slow to scroll down the text box.

It’s a bit strange.
First pasting of an Excel column (line-numbers as content)
stops after 5184 lines = 30000 characters.
I then select all the text (ctrl-home and ctrl-shift-end) and paste again.
This pastes all 1048576 lines = ~8000000 characters.
Then Ok (with the SAL error message coming up).
…reopen…
Now, I can only jump from Ok to Cancel to Debug (tab key).

The Nyquist Prompt was designed to handle short snippets of code, so it doesn’t surprise me if there are quirks/bugs when pasting tens of thousands of characters, but it seems OK here (on Linux) for hundreds of thousands of characters.

If this code is for a one off job, it would probably be easiest to just save the data as a plain text file on the desktop, then hard code the path to the file into the Nyquist script.

I assume that it is rather a screen reader issue on my system.
WXWidgets do not behave very well under certain circumstances, in particular when it comes to accessibility requirements and compatibility. .