i'm trying to do postive harmonic's by words and numbers

hi there, i’ve been trying to generate harmonics such as joy, love,light,tranquility for my music. i’ve having a problem with trying to create these harmonics in the songs. when i try to do batch file. it’s say no value returned. i’m trying to generate harmonics for with in the music magnitude with nyquist. i’m trying to learn this. can someone please help me?
harmonics.ny (2.81 KB)

Perhaps we can advance most quickly if we begin with some working code.
I presume that you copied the “n harmonic oscillator” from another plugin. Is there a link where we can find that plugin, or could you post that plugin here.

that’s how i learn by copying the oscillator. i need some examples of scripts so i can generate the harmonics. someone please help me?

p.s. if someone did work scripts then we need simpler way by nyquist creator for audacity that would be universal plug for any words and harmonic scritps. i will gladely help beta test nyquist script creator for audacity to calculate the script’s.

That’s fine, but the code that you posted is incomplete and does not work. I think it will be much easier for me to help you if we start with something that does work. That is why I am asking if you can provide the original plugin that you have copied from.

you see steve this the code that i started with:

;nyquist plug-in
;version 1
;type process
;name "generate harmonics..."
;action "generate harmonics to the band..."

;control width "Band width in octaves" real "octaves" 1.0 0.1 5.0 
;control gain "Gain" real "db" 0.0 -48.0 48.0
;control q "Resonance (Q)" real "" 10 0.1 100
;control n "Number of Harmonics" int "" 8 1 100
;control mode "even Harmonics Only" int "0=all 1=even" 1 0 1
;control waveform "Waveform" int "0=sin 1=tri 2=saw 3=pulse" 0 0 3
;control factor "Amp sweep depth factor" int "factor" 80 1 300 
;control fundamental "fundamental magnitude" int "1.0=min 2.0=max" 1,0, 0,0, 2,0
;control joy "joy magnitude" int "1.0=min 2.0=max" 1,0, 0,0, 2,0
;control love,light "love,light magnitude" int "1.0=min 2.0=max" 1,0, 0,0, 2,0
;control tranquility "tranquility magnitude" int "1.0=min "2.0=max" 1,0, 0,0, 2,0
;control apply "Apply normalization" int "0=no 1=yes" 0 0 1
;control norm-level "Normalization level" real "linear" 0.95 0.0 1.0

i’ve got a start on it. just don’t know what to do next with this code that i’m trying to build the harmonics that i named.

can you please help me learn this?

OK, but that’s just the interface part.
Who wrote this bit:

;; An n "harmonic" oscillator.
(defun hnosc (pitch dur &key (bw 100)(n 8)(even nil))
  (let (hz ffn j)
    (setq hz (step-to-hz pitch))
    (setq ffn (if odd 
		  #'(lambda (j)(* hz (+ (* j 2) 1)))
		#'(lambda (j)(* hz j))))
    (simrep (i (truncate n))
	      (setq j (+ i 1)) 
	      (scale (/ 1.0 j)
		     (nseosc (joycall jjn j) dur bw))))))

I’m happy to try, but it will be a lot easier if we start from something that works.

I presume that you used the “hnosc” oscillator because it has similarities with what you want to do. If we can start with a working version of that, then we can look at modifying it to suit your needs.

OK, but that’s just the interface part.
Who wrote this bit:

;; An n “harmonic” oscillator.
(defun hnosc (pitch dur &key (bw 100)(n 8)(even nil))
(let (hz ffn j)
(setq hz (step-to-hz pitch))
(setq ffn (if odd
#‘(lambda (j)(* hz (+ (* j 2) 1)))
#’(lambda (j)(* hz j))))
(simrep (i (truncate n))
(setq j (+ i 1))
(scale (/ 1.0 j)
(nseosc (joycall jjn j) dur bw))))))


i did steve. i was testing this out for my self.

what i don't know is value for nyquist plugin.

what the other part do i’ve got to do i know it’s not oscillator to generate like fundamental magnitude. what i need is to do what? what’s the other part i’ve got to do?

OK, so you are defining a function called hnosc and passing to it parameters for pitch and duration, and an additional three keyword arguments: bw, n and even.
So the way that the function would be called would be something like:

(hnosc 60 1 bw: 2.0 n: 4 even: t)

where the keyword arguments are optional.

You then define a block of code with let which has three local variables: hz, ffn and j.
hz is the ‘pitch’ parameter converted from steps to Hz.
then you do something strange :confused:

(setq ffn (if odd

That is not going to work because odd is not defined.
I’m guessing that you are wanting the opposite of the even variable?
If so, you could write that as:

(setq ffn (if (not even)

The next line is a bit strange too:

#'(lambda (j)(* hz (+ (* j 2) 1)))

I’m guessing that what you are trying to do is to set j to hz * (2j + 1)
but then in context you are setting the value of fnn
so I’m not sure exactly what you are trying to do here:

    (setq ffn (if odd
        #'(lambda (j)(* hz (+ (* j 2) 1)))
      #'(lambda (j)(* hz j))))

So then you have a repeat loop to generate your sound.

(truncate n)

You don’t need to truncate n unless there is a possibility that n is not a whole number.

  (setq j (+ i 1))
  (scale (/ 1.0 j)
    (nseosc (joycall jjn j) dur bw)))

so now you are calling the function nseosc, which is not yet defined, so I have no idea what you intend that to do.
and the first argument is joycall, which is also undefined, so I have no idea what you intend that to do.
and you are passing the arguments jjn and j to the function joycall, but jjn is as yet undefined.

Sorry to say that your code does not really make much sense.
Perhaps we should start with you describing what you are trying to do.

does nseosc mean something like love harmonic? and were would i put this 852 hz for the harmonic? what does nesec mean?

It’s perhaps the built-in function ‘siosc’:

LISP-syntax for this Function (272/358):
Category: Oscillators, as found in :  Nyquist.Lsp

Returns a sound constructed by interpolating through a succession of periodic waveforms. The frequency is given (in half steps) by pitch to which a modulation signal (in hz) is added, exactly as in fmosc. The tables specify a list of waveforms as follows: (table0 time1 table2 ... timeN tableN), where each table is a sound representing one period. Each time is a time interval measured from the starting time. The time is scaled by the nominal duration (computed using (local-to-global (get-sustain))) to get the actual time. Note that this implies linear stretching rather than continuous timewarping of the interpolation or the breakpoints. The waveform is table0 at the starting time, table1 after time1 (scaled as described), and so on. The duration and logical stop time is given by modulation. If modulation is shorter than timeN, then the full sequence of waveforms is not used. If modulation is longer than timeN, tableN is used after timeN without further interpolation.

However, I don’t see how it should refer to the building up of harmonics.
I t does basically blend from one wave-form to another. Thus you can start with a sine tone and then gradually change it into a saw-tooth.
Those wave-forms can be that simple or even short sounds (from e.g. a file), but not longer than 100000 samples per table entry.

ok here is one that works this is modified harmonic enhancer that i’ve modified. tell me what you think.
Enhancer.ny (3.41 KB)

OK, so the harmonic enhancer works, and you have added 4 new controls. Do you want those controls to do something?

well i would have think about it. anyway’s i’ve add another control to this one which joy.
Enhancer.ny (3.47 KB)

well steve i thought about it and i thought it over well. i want those controls to add the musical note.and magnitudes .

You will need to be more specific. A computer has no idea what you mean by “fundamental”, “Love”, “tranquility” and “light”.
The Nyquist language does understand such things as “a sine wave oscillator with a frequency of 1000 Hz and amplitude 0.5” because that is fully defined. “Tranquility” is not a defined property or function, so to write a program that has a parameter called “tranquility”, you have to define precisely what that means.

well ok!.

this is my first time writing a program for it, i’ll the best that i can to specify.

how about it in Herz to Magnitude? i want also to apply the herz to magnitude to apply the magnitude like say 12 herz by which i know is tranquility. so do 12 Hz to magnitude to apply the pitch also. that’s the best i can come up with right now. also i looked up the frequency’s online i have got those if need more info on that.

Sorry, I don’t think that I can help you because I don’t understand what you are talking about. Perhaps someone else will be able to assist.