12 thoughts on “Simple Vibrto Effect”

    1. The script can be applied to a mono track using the Nyquist Prompt effect.

      Select the region of a mono track that you want to apply the vibrato effect to, then from the Effect menu select “Nyquist Prompt”. Then copy and paste the script into the Nyquist Prompt and apply.

      Note that this effect is only intended to be applied to short sections (just a few seconds). The sound quality will become progressively worse over longer sections.

      1. Thank you for the information. It’s a pity that the effect is so short. I have the impression that it is an effect of tremolo, rather than an effect of vibrato. I tried to create a wave with this sound effect. The problem is that this code does not work. Do you understand the problem?
        (setq depth 2)
        (setq vibrato-freq 8)
        (setq depth (* depth 0.01))

        (defun mysound ()
        (scale 0.5 (hzosc 697)))

        (abs-env
        (mysound (integrate (sum 1 (mult depth (hzosc vibrato-freq))))))

        1. If you want a tremolo effect, that is a lot easier to do – I’ll post something if you like, but first for the job in hand…

          The important function in this vibrato effect is SND-COMPOSE (see: http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index667 ) but you’ve missed that in your code.

          Also, you have defined MYSOUND as a function, but are then treating it as a variable. A function call needs to be in parentheses (brackets) and in the form:
          (function-name arguments)
          In the case of MYSOUND there are no following “arguments” so all you need is (mysound).

          Try something like this:

  1. Thank you for the previous information. I realized that this code really generates an oscillation around an axis of the pitch of a sound. I had thus made a mistake. It is well about a vibrato. I modified a little the code. On the other hand, I tried it in a stereo track and it works well.

    I tried to understand the functioning of the function snd – compose. I did not arrive there because it is very complicated. A sentence as …” The sound f is used in effect as a lookup table, but it is assumed that g is non-decreasing, so that f is accessed in time order…” for example, is very hermetic for a musician. By looking for a long time, I found that a single code with the function snd – compose. We find it in the article “Pitch_change”. The presented code is intended for users confirmed by the language Nyquist because it is very complex.

    1. Yes that code will work in a mono or stereo track. The (mono only) SND-COMPOSE function is being applied to (MYSOUND) which is a mono sound. When Nyquist returns a mono sound to a stereo track, Audacity copies the sound to both tracks.

      SND-COMPOSE is one of the more complicated effects, which is one of the reasons that I thought it would be worth posting a simple example.

      The inner expression in SND-COMPOSE:
      (integrate (sum 1 (mult vib-depth (hzosc vibrato-freq))))
      creates a wiggly rising line (waveform) from 0 at the start of MYSOUND to an amplitude equal to the length of MYSOUND at the end of MYSOUND. It is this wiggly line that is used as a “look-up table” to map the original samples from MYSOUND to their new positions, thus creating a pitch shift. The amount of “wiggle” on the line sets how much the samples from MYSOUND are shifted.

      The wiggle should always be rising in amplitude – if it decreases, then that would attempt to move samples earlier than the preceding samples, which can’t be done.

      1. I thank you for the previous information. I found on the forum Nyquist a code with the function snd – compose. I tried it with the following regulations:

        It seems very interesting because we can create many variations in the proportions thanks to the function (pwl.
        On the other hand, it does not work. Do you see an error in this code there?

        1. There’s a few errors in that code.

          1. (stretch-abs 2,
          There should not be a comma after the 2

          Generally it is not good practice to write floating point numbers with just a dot – it’s too prone to typing errors. If you need a value to be a float, write it as (for example) “2.0” rather than “2.”

          2. (hzosc 697 12.)
          This is incorrect. HZOSC takes just one argument, the frequency. If you need to specify the duration you can do that with OSC.

          Whereas HZOSC specifies the frequency in Hz, OSC specifies the frequency in “steps” (the same as MIDI note numbers). Frequency (Hz) can be converted to the step number using HZ-TO-STEP. So instead of

          you probably want:

          3. (force-srate 44100
          This is probably not “wrong”, provided that the track sample rate is 44100 Hz.
          It would probably be better to have:

          so that it can work correctly whatever the track sample rate.

          4. The PWL function looks rather odd.
          PWL takes pairs of “time” and “level” in the form:

          All of the times are given as multiples of the original selection duration, except for the first (0) and the final one (14). The purpose of that is unclear, but I suspect that it is a coding error.

          I’m not entirely sure what the intention of the original author is, but I suspect that what they meant was something more like this:

          1. I thank you for all this information. I try to combine two codes. The one allows to create glissandis, and the second allows to create a progressive vibrato. My code is the following one:

            There are errors in this code because glissandis does not appear.
            After all, it is really possible to obtain this sound result?

          2. There’s a problem here:

            As described in my previous post, PWL takes pairs of parameters, one for the time value and one for the amplitude (level).
            Time, level, time, level, time, level…. time (implied zero level).

            Your time values are:
            0, 1, 12, 16

            Your amplitude values are:
            0, 7, 47, 0
            The final amplitude should not be included because PWL automatically uses an amplitude value of zero as the last value, therefore there should always be an odd number of parameters.

            The main problem though is that your maximum value is 47 which is not nearly big enough for using it in FMOSC.

            If you look up FMOSC in the Nyquist manual you will see that the modulation is expressed in hz, e.g. a sinusoid modulation signal with an amplitude of 1.0 (2.0 peak to peak), will cause a +/- 1.0 hz frequency deviation in sound. Your modulation amount is at most 0.5 x 47 = 23.5 Hz which is not enough variation to be noticeable until you get about 2/3rds of the way through the sound.

            The following will have a much more noticeable effect:

            Running your full code in the Nyquist Prompt and using the “Debug” button, there is an error shown:

            If we lay out your code a little better, the reason for the error becomes apparent:

            You have written (modulator as if it is a function.
            What you actually want is to use the previously defined modulator variable.

            I can’t see exactly what you are trying to do, but the function variable-resample should take two parameers; steps and snd.

  2. I thank you. I corrected the code which works.

    On the other hand, I did not know how to use the parameters ” steps ” and “snd”. There is little information on the Internet. Could you indicate to me how we use the parameter ” snd “?
    Thank you.

    1. When you are posting code samples, please add “code” tags around your text. This makes the code appear in a box and will be laid out correctly.
      I’ve added code tags to your previous post.

      <code>
      ;Your code goes here.
      </code>

      STEPS and SND in your code are “variable” names (symbols that represent values).
      Variables are user defined – you can use most normal characters for variable names but should avoid keywords that are part of the LISP/Nyquist language and must not contain spaces.
      LISP/Nyquist are not case sensitive, so snd and SND are identical.

      In this case SND and STEPS are used to pass two values to the function called variable-resample
      The syntax for defining functions is described in the XLISP manual here: http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-087.htm
      Instead of using snd, the code could have used mysound or signal provided that the same name is used each time that you wish to refer to that variable.

      In the above, x and y are variables. They have been set to values of 3 and 4 respectively. Other than the choice of variable name it is identical to:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.