# Quick conversion calculator

A small plug-in with some useful conversion features.
The following conversion functions are included in this version:

dB to linear
Linear to dB
dB to percent
Percent to dB
BPM to beat length
Beat length to BPM

In addition it can add a series of numbers, or multiply a series of numbers.
It is also able to run simple Nyquist commands that produce a printable result.

It has been written in a modular way so it is pretty easy if anyone wants to add more functions or customise it in any way.

Installing the plug-in.
This is done in the usual way - just put the .ny file into your Audacity plug-ins folder and restart Audacity.
This plug-in will be listed in the Generate menu (the only type that allows a Nyquist plug-in to run without a track selection).
It will be listed as: “Quick Calculator”.

As usual, any feedback, problems or suggestions, please post as a reply here on the forum.
qcalc.ny (2.63 KB)

A couple more functions added (also includes the inverse of each function)
New functions in bold.

• dB to linear
• dB to percent
• BPM to beat length
• Midi note number to Frequency (Hz)
• Frequency (Hz) to cycle period (seconds)
• Frequency (Hz) to cycle length (samples)
• Multiplication
• Division
• Nyquist script

qcalc.ny (4.69 KB)

One more function added (thanks Robert J.H. for the suggestion).

• dB to linear
• dB to percent
• BPM to beat length
• Midi note number to Frequency (Hz)
• Frequency (Hz) to cycle period (seconds)
• Frequency (Hz) to cycle length (samples)
• Tempo Change as %
• Multiplication
• Division
• Nyquist script

Tempo Change as %” may be useful when using the “Change Speed” or “Sliding Time Scale / Pitch Shift” effects.
If you know the current tempo in bpm and the desired tempo in bpm, use “Tempo Change as %” and enter the original tempo and target tempo as two numbers (separated by a space).
For example, if you want to change the tempo from 160 bpm to 180 bpm, enter: 160 180
qcalc.ny (5.31 KB)

I cheat by entering the length or BPM values in Effect > Change Tempo.

Gale

The Quick Calculator is more accurate.
For example, according to “Change Tempo”, from 45 to 33.3333 = -26.667 (tempo values are truncated to integers).
Quick Calculator gives the answer, from 45 to 33.3333 = -25.926 (correct to 3 decimal places).

This can be used with “Change Speed”, “Change Tempo” and ‘Sliding Time Scale / Pitch Shift’ effects.

Example:
To stretch 1 minute and 22.5 seconds to 1 minutes and 30 seconds, you can either work out the required ‘percent’ for “Change Speed”, “Change Tempo” or ‘Sliding Time Scale / Pitch Shift’ effects in minutes or in seconds (but both the initial duration and final duration must be in the same units.
1 minute and 22.5 seconds = 82.5 seconds
1 minutes and 30 seconds = 90 seconds
Select “Length Change as %” in the Quick Calculator and enter:

``````82.5  90
``````

The calculator returns:

``````Duration change from
82.5 to 90 is -8.33333 %.
``````

The value -8.33333 can then be entered into the “Change Speed”, “Change Tempo” or ‘Sliding Time Scale / Pitch Shift’ effects.

Note that the Change Tempo effect may not produce precisely the desired length due to limitations of that effect.
Note that for ‘Sliding Time Scale / Pitch Shift’ the value must be entered as the Initial and Final tempo change to produce the target length.

Also added the ‘Inverse’ function for “Divide (a/b)” and a couple of wording refinements.
qcalc.ny (6.24 KB)

You can’t copy results.

That’s a bug / limitation in Windows.

Here’s a workaround.
This version copies the output text into the Nyquist debug window. (Click the “Debug” button rather than the “OK” button).

A known limitation of this workaround version: Some of the formatting in the debug window may look a bit strange (for example, “new line” characters will sometimes be printed as “\n”)
qcalc-win.ny (6.45 KB)