Audacity Plugins
Audacityteam.orgAudacity Support
  • Audacity Plugins
  • Installing plugins
  • FFMPEG & LAME
  • realtime effects
    • Plugin Suites
    • Pitch and Tempo
    • Delay and Reverb
    • Distortion
    • Dynamics Processing
    • Filters
    • Equalizers
    • Modulation
    • Noise Removal and Repair
  • AI plugins
    • AI plugins
  • Nyquist Plugins
    • Generator Plugins
      • Tone Generators
      • Noise Generators
      • Special Effect Generators
      • Instrument Sound Generators
      • Sequence Generators
      • Generator Utilities
    • Effect Plugins
      • Amplify, Mix and Pan Effects
      • Delay and Reverb
      • Distortion Effects
      • Dynamics Processing
      • Filters and EQ
      • Modulation Effects
      • Sequencer Effects
      • Time, Pitch and Tempo
  • Analyzers
    • Analysis plugins
    • Loudness compliance checks
  • Contributing
    • Adding plugins to this site
    • Developing your own plugins and scripts
      • Creating your own Nyquist Plugins
        • Nyquist Reference Manual
        • Plugin Reference
        • Headers Reference
        • Widgets Reference
        • Basics
          • Volume Basics
          • Independent Stereo Volume Basics
          • Delay Basics
          • Prompt Basics
        • Tutorials
          • The *SCRATCH* Symbol Tutorial
          • Property List Tutorial
          • Stereo Tracks Tutorial
          • Macro Tutorial
          • File Button Tutorial
        • 💬Nyquist Forum
      • Scripting reference
  • Additional resources
    • Audacity custom themes
    • EQ curves
      • EQ XML to TXT converter
      • Weighted curves
      • Playback equalization for 78 rpm shellacs and early 33⅓ LPs
    • External scripts
    • Audacity Support
Powered by GitBook
On this page
  • LISP vs SAL
  • Changing the Volume of an Audacity Track

Was this helpful?

Edit on GitHub
Export as PDF
  1. Contributing
  2. Developing your own plugins and scripts
  3. Creating your own Nyquist Plugins
  4. Basics

Volume Basics

This page explains how to use Nyquist to change the volume of Audacity tracks in different ways.

PreviousBasicsNextIndependent Stereo Volume Basics

Last updated 2 years ago

Was this helpful?

Note: All [comments] and [explanations] are written in square brackets, so they cannot be confused with (Lisp code).

LISP vs SAL

SAL is a new alternative syntax to LISP. Although Nyquist is based on the LISP programming language, you can write almost any Nyquist program in SAL. Most people prefer SAL syntax to LISP syntax because SAL is a bit more like popular programming languages that include Java, C, and Python.

You can specify which one you're using with the respective :

;codetype lisp
;codetype sal

You can only use one or the other in your script.

Changing the Volume of an Audacity Track

To change the volume of an Audacity track with Nyquist, the easiest way is to use the Nyquist function:

(scale number sound)

scale(number, sound)

The "scale" function multiplies the amplitude [volume] of the "sound" by the given "number". A number of 0.5 will make the sound become only half as loud as before, while a number of 2 will make the sound become double as loud as before.

Example:

See for an explanation how the Nyquist prompt works.

  • To run this example in the Nyquist Prompt, ensure that "Use legacy (version 3) syntax" is not selected.

  • For more information about the *track* keyword, refer to the

1. Create an audio track with some audio [eg a short recording]

2. Now click Tools > Nyquist Prompt. A window with a text field will appear where you can type in:

(scale 0.5 *track*)

Important: Do not forget to type the parentheses. The parentheses are part of the Lisp language Nyquist is based on. Without the parentheses the Nyquist Lisp interpreter will not be able to understand your code.

return scale(0.5, *track*)

Important: Do not forget to type the parens and comma. These are part of the SAL language.

After clicking "OK" in the "Nyquist Prompt" window the "scale" function will take the Audacity sound and return a "scaled-down" sound with half the volume to Audacity. The result of the last computation of the Nyquist code always gets automatically returned to Audacity.

If you try "scale" with big numbers you will notice that you can return sounds with volumes taller than the Audacity track which will sound very distorted if you play them afterwards in Audacity. So an important lesson to learn is that Nyquist gives you the freedom to do whatever you want but it's now on you to take care that the result will still sound good afterwards.

MULT may be used with numbers, sounds or multi-channel sounds. When using MULT with a sound and a number, each sample value in the selected sound is multiplied by the number, which is essentially the same as using the SCALE command.

(mult *track* 0.5)
return mult(*track*, 0.5)

An alternative command for amplifying a sound is the command.

MULT
SCALE
Prompt Basics
Plugin Reference
codetype header