How to reverse and change speed in one effect

I’m trying to make an effect that reverses AND speeds up the audio while changing pitch. This is forwards:

;nyquist plug-in
;version 1
;type process
;name “Fast-Forward”
;action “Cueing…”
;info “Simulates fast-forwarding audio on a tape or record”

(force-srate 44100 (stretch-abs 0.1 (sound s)))

I tried this:

;nyquist plug-in
;version 1
;type process
;name “Rewind”
;action “Reviewing…”
;info “Simulates rewinding audio on a tape or a scratch of a record”

(force-srate 44100 (stretch-abs -0.1 (sound s)))

nothing happened, and tried this instead:

;nyquist plug-in
;version 1
;type process
;name “Rewind”
;action “Reviewing…”
;info “Simulates rewinding audio on a tape or a scratch of a record”

(force-srate -44100 (stretch-abs 0.1 (sound s)))

But freezes and tries to go over 100% applied. Putting both values in negative did the same thing as the first; nothing.

Is it somehow possible to reverse sound while changing speed and pitch of it in Nyquist?

Nyquist in Audacity cannot directly reverse audio.
It is possible to reverse short sections of audio by loading the sound into an array, reverse the array, then convert the array back to a sound, but note that this will be pretty heavy on memory.

A better approach would be to use Audacity’s “Reverse” and “Change Speed” (or “Sliding Stretch”) effects in a Macro:

OK, now how do I move it from “Tools/Macros” to “Effects”? Is it possible to save as a different format (Like DLL or XML) in the “Plugins” folder?

No. Why would you need to?

Could I put a category or folder in “Tools/Macros”? If I could, how may I?

The “reverso” (nyquist) plugin reverses chunks of audio …

No, but if you say why you want to do this I may be able to suggest an alternative approach.

What if I wanted to do this on another computer, or wanted to share an effect?

Could you do an upgrade or update that allows you to make effects, save them, and put it on another computer with Audacity?

:email: to :computer::desktop_computer::iphone:

Is it possible to export Macro effects somehow? If not, could you add the feature to save effects to share or move to different computers (As well as the option to open original NY file path, or merge/copy into the new effect as one)?

Not yet, though you will be able to with the next version of Audacity.

Macros are saved as text files, so it is possible now to copy the text file from one computer to another (though not very convenient).
The manual shows where Macro text files are stored: Macros - Audacity Manual

Is it possible to combine Nyquist and Macros to use If-Then-Else codes? For instance, “If stereo, then duplicate once, if mono, then duplicate twice, if three channels, message ‘There is already 3 channels, so effect is skipped because it won’t have an effect.’, else, message ‘There is over 3 channels, this only works with Stereo/Mono.’” I’m pretty sure this is readable to humans, but is there any way I could use a combination to, say, halt further Macro or Nyquist, like “if” it doesn’t have enough channels, or too many, do “this”?


Yes, but you would need to define the task more precisely.

Audacity supports mono or stereo tracks. We would need the Nyquist code to distinguish between two selected mono tracks, and one selected stereo track, and decide what we want the code to do in each case.

For example, if we want to duplicate the selected tracks, if and only if there is one stereo track selected, then we could do something like:

;type tool
(defun test ()
  (let ((selected (get '*selection* 'tracks)))
    (when (/= (length selected) 1)
      (throw 'err "Error.\nSelect one track only."))
    (let* ((id (1- (first selected)))
           (info (nth id (aud-get-info "tracks")))
      (dolist (property info)
          ((and (member 'channels property)
                (= (second (member 'channels property)) 2))
            (setf is-stereo t))
          ((member 'start property)
            (setf start (second (member 'start property))))
          ((member 'end property)
            (setf end (second (member 'end property))))))
      (if is-stereo
          (list start end)
          (throw 'err "Error.\nStereo track required.")))))

(catch 'err
  (let ((times (test)))
    (aud-do-command "SelectTime:" :start (first times) :end (second times))
    (aud-do-command "Duplicate:")))

The message came up telling me to select one track only, but to be more specific, I’m (right now) trying to make a mono file duplicate twice to 3 files (1+2=3), or if it is stereo, duplicate once and make the one duplicated convert to mono. Basically, I’m trying to make it convert to a 3-channel audio file… at least while it is open. If possible, could I save 3-Channel audio files, in a way, even if I have to save individual audio files? I got Macros to do it, but on mono files, you have to apply it twice. Work around code?

Also, what is it called; 1 is “mono”, 2 is “stereo”, 3 is what?

Did I mention that the 3rd channel of an audio file is a mix between the left and right (if stereo)? This picture shows what I used, but need to know how to make mono work if clicked once.

As I wrote:
“For example, if we want to duplicate the selected tracks, if and only if there is one stereo track selected

How are you wanting to “convert” to mono? Mix down to mono, or just split and delete one channel?

More than 2 channels is generally just called “multi-channel” or “… channel” (“3 channel” or “4 channels” …)
There are also some names for particular speaker configurations, such as “quadrophonic” and “5.1 surround”.

No you didn’t, but that answers one of my questions :slight_smile:

Unfortunately that is not currently possible with Macro commands. Is that a deal breaker for your task?

I mean, if stereo, duplicate the stereo once (4), and merge one of them to single with the other 2 unchanged (3). If mono, duplicate (2) twice (3). Look at the pictures, it is an example of what I’m trying to do. Stereo tracks are duplicated, and one stereo track is merged to one, leaving 2+1. Mono tracks are duplicated twice, making 3 channels.

Note, if mono, mixing can be done or not done; it sounds the same either way, both would increase the volume of the 3rd track, one would be normal volume…

If I can’t do this in Macro-only, How do I make a tool that duplicates the single layer twice if mono, or duplicate once with mix of L&R in one channel if stereo In, say, Nyquist instead? Nyquist, Macro or both? All I want to do is make the effect where you don’t need to apply it twice, if it is mono. I’m sending you the example effect of what I did, is there really no way to fix this, nor a way to do something similar? Could someone point out why this isn’t working? (Yes, I know it directly says it in the name, but I want to edit it to only press once if mono and stereo, not twice on mono and once in stereo.) Stereo is working, How to do in Mono…? (Even if I can’t save it as a Triple-Channel audio file, or save it as multiple files?) Could you possibly convert Macro to or from Nyquist?
Convert To Triple-Channel (Use Once If Stereo, Use Twice If Mono).txt (814 Bytes)

The easiest solution (by far) would be to make two macros - one for applying to a mono track, and one for applying to a stereo track. You could set keyboard shortcuts for each, then press the appropriate shortcut depending on whether your source is a mono track or a stereo track.

Does that sound like a workable solution? If not, why not?