Create sequential tones

is there a way to use nyguist to create sequential tones ?

I tried putting in

(hzosc 110)(hzosc 220)(hzosc 440)

but it seemed to just create the last one in the list.

Ideally I want to be able to create tones from a list of frequencies, and these then play in a linear fashion one after the other

e.g. 110,220,330,440,550,660,770, etc…

how do I do that in nyquist?

I’ve deleted your other posts about this as you are now further on with this - almost there in fact.
Try:

(seq (hzosc 110)
     (hzosc 220)
     (hzosc 440))

thanks that works. and thanks for deleting the previous post, I could not seem to find the delete option.

now I just need to control the length of time each frequency plays for, how would I add that in?

If you are doing this in the Nyquist Prompt, add this line at the start so that durations will be in seconds (“Process” effects have durations relative to the length of the selection).

;type generate

Here’s an example:

;type generate

(seq (stretch 0.5 (hzosc 110))
     (hzosc 220)
     (stretch 2.0 (hzosc 440)))

What’s the goal?

thanks will try that.

the goal is to create audio files of various frequencies using fibonacci patterns, escalating up from different root start points.
1 hz being the obvious fibonacci root, but I wanted to see how they sound if I start from other frequencies.
I want to build a selection and see how they sound in comparison to each other. might try and use them to build some music from too.
been looking for a tone generator that can create sequential tones from a list of frequencies to this end.
and looks like this may just do it for me, so thanks !

Interesting. And that will create an exponential rise?

“Obvious”, but still “arbitrary”.
(1Hz being 1 cycle per second, where 1 second was formerly defined as 1⁄86400 of a day, and in modern times as:
9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom" (at a temperature of 0 K)”)


For creating a large number of tones in the sequence, it would be better to use a loop structure. For example, here I set “frequencies” as a list of frequencies, then loop through the list to create the sequence. The tones are created in a function “tone”, which generates a sine wave at the desired frequency and length, and shapes it with an envelope.

;type generate

(defun tone (hz dur)
  (stretch dur
    (mult (env 0.05 0.1 0.5 1.0 0.5 0.4)
          (hzosc hz))))

(setf frequencies (list 200 300 400 500 600))

(seqrep (i (length frequencies))
  (tone (nth i frequencies) 1.0))

You can of course use a function to generate the frequency values. In this case, a sequence of 10 frequencies at intervals of 100 Hz:

;type generate

(defun tone (hz dur)
  (stretch dur
    (mult (env 0.05 0.1 0.5 1.0 0.5 0.4)
          (hzosc hz))))

(defun get-hz (n)
  (* 100 (1+ n)))

(seqrep (i 10)
  (tone (get-hz i) 1.0))

Well I wasn’t sure where I was going with it. I am just in the process of looking and trying to understand Fibonacci influence on frequencies and how it does, or doesnt, appeal to our ear. maybe I should say my ear as it seems many people experience sound differently.

I just created a largish excel sheet using the fibonacci pattern starting with the root number as 1, then as 2, then 3,4,5 going up to 100 and then looking to see how it looked. In chart form yes, it created exponential rises. In terms of actual sound, well that leaves me with possibly thousands of frequencies to input, and I didnt fancy manually putting them into an online tone generator, so here I am. (I will eventually be moving to Cubase to construct something out of all this, probably use the Audacity wav files created to then build something out of the ones that appeal to me using whatever instruments allow me to adjust their frequencies to fit.)

I have to say I am blown away by how much you have helped, those last codes are exactly what I was looking for thank you soooo much!!!

This is fascinating I had never considered that. I was actually expecting someone to have a go and say I can’t use fibonacci like that on any other number than 1 at the root. I also was looking at a bunch of stuff around the Golden Ratio 0.618 and applying that to root frequencies to make scales, but I was more interested to dive into the fibonacci effect as I have shared here.

Also I intend to apply fibonacci sequencing to the position in aural space, panned I guess as it moves through the frequency steps, and also in time as it moves through the tempo. I had not got to looking at those parts yet, but had assumed I would be using 120bpm as a starting point just for simplicity. Your comments up there now give me interest to look at just why we call 1 second a second, ergo 1 minute a minute, which may then influence 120bpm as a starting point for me to create whatever I end up creating from all this.

Thanks again for those coding methods, they were both exactly what I was looking for as it gives me the option to create formulas to define the frequencies, and also gives me the option to cut and paste them from my excel sheet. amazing. I am gobsmacked. really appreciate it!
Let me know who to credit for the help on this, if and when I actually finish something and put it out there. “Steve from Audacity Forum” ?

Spoiler alert!
If you want to work out the Fibonacci tones yourself, don’t look at the code below.
On the other hand, feel free to adapt the code below to suit your needs.

;type generate

;control dur "Duration of each note" float "seconds" 0.25 0 2

(defun tone (hz dur)
  (print hz)  ;print will list the frequencies in Debug window
  (stretch dur
    (mult (env 0.05 0.1 0.5 1.0 0.5 0.4)
          (hzosc hz))))

(defun fib(maximum)
  ;; Returns Fibonacci series up to 'maximum'.
  ;; List is built by pushing terms to the start (for efficiency)
  ;; then the complete list is reversed and returned.
  (let ((series (list 2 1)))  ;Ignore the first two terms of the series
    (do* ((n0 (second series)(second series))
          (n1 (first series)(first series))
          (next (+ n0 n1)(+ n0 n1)))
        ((> next maximum) (reverse series))
      (push next series))))


(let* ((nyqhz (truncate (/ *sound-srate* 2.0)))  ;Nyquist frequency as integer
       (hz-list (fib nyqhz)))
  (if (> dur 0)
      (seqrep (i (length hz-list))
        (tone (nth i hz-list) dur))
      "Error.\nNote duration must be greater than zero."))



If it’s informal, then that will be fine :wink:
If it’s formal, then I’m listed in the Team Members section of the Audacity credits (https://www.audacityteam.org/about/credits/)
If you want or need to include a citation for Audacity Software, see: https://www.audacityteam.org/about/citations-screenshots-and-permissions/

thanks, I did used to work with LISP back in the 90s when I built stages with AUTOCAD and was automating truss designs and stuff, but to be honest I feel a bit clueless with that code. I took a brief look through the reference sites for it NyQuist, but none the wiser tbh.

Is there an easy way to adapt it to be able to choose the root number that is used, for instance 10 and then it generate the Fibonacci sequence using 10 as the start point. e.g. 10, 10, 30,50, 80 etc…

dont worry if not, I feel I have got more than enough to work with already with all the fantastic code you provided thus far, but since you posted that one too, I certainly am interested in figuring out where I need to adapt it to achieve the above.

Maybe add equalization to the Fibonacci frequency-series so the audible ones are more equally loud to the human ear …

''Fibonacci=Loudness'' Equalization curve.png
Fibonacci=Loudness.XML|attachment (54.7 KB)
https ://manual.audacityteam.org/man/equalization.html#manage#Import

For the LISP commands and syntax, the XLisp reference is good (and has examples): http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-index.htm
The “XLISP Language Reference” is a good page to bookmark: http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-index.htm

For keywords that are specific to Nyquist, the Nyquist language reference is here: http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html

Yes, I commented that line:

(let ((series (list 2 1)))  ;Ignore the first two terms of the series

In the above I began the series with the numbers 1 and 2 (note that the list is being created right to left and the reversed)
To start with numbers 10 and 20:

(let ((series (list 20 10)))  ;Ignore the first two terms of the series

genius! thanks, and thanks for all the links for reference.

I misunderstood the number series on first glance, I thought it stripped those two numbers out to stop it impacting the set in some way.

Ok I will test it when I next have some time, and the EQ thing looks like a good idea too. I was currently pulling the vol down as I listened to tones in series, so that is perfect.