I read the above as, if sound is an array (as in stereo - which it is in my case), then
“sum” them together.
If it’s not an array, (mono), then return unchanged.
Can you please give me any pointers as to where I’m going wrong.
Thanks.
Try adding this to your script before you use TO-MONO
(defun to-mono (sig)
(let ((s sig))
(when (arrayp sig)
(setf s (aref sig 0))
(dotimes (i (1- (length sig)))
(setf s (sim s (aref sig (1+ i))))))
s))
The actual code in the later version of Nyquist (below) is a bit more complex, but does the same as the above function.
Here’s the version in Audacity 3.1.0:
(defun to-mono (sound)
(ny:typecheck (not (or (soundp sound) (multichannel-soundp sound)))
(ny:error "TO-MONO" 1 '((SOUND) NIL) sound t))
(let ((s sound))
(cond ((arrayp sound)
(setf s (aref sound 0)) ;; ANY channel opens the gate
(dotimes (i (1- (length sound)))
(setf s (nyq:add-2-sounds s (aref sound (1+ i)))))))
s))
Note that the +6dB occurs only when the waveforms are in phase (peaks and troughs coincide in both channels). Example: If the left channel is an inverted copy of the right channel, then the sum will be silence.
Also note that the code can handle multiple (more than 2) channels, even though Audacity currently only supports mono or stereo.
Are you using an old Mac, or do you have another reason to use an old version of Audacity?
Have you tried Audacity 2.4.2? In my opinion, that was the pinnacle of the 2.x series.
Note that the +6dB occurs only when the waveforms are in phase
Correct and it’s part of the reason for wanting to use the function, to check the phase of left vs right channels.
Are you using an old Mac, or do you have another reason to use an old version of Audacity?
Have you tried Audacity 2.4.2? In my opinion, that was the pinnacle of the 2.x series.
I’m using a Macbook Pro (mid 2012) with Mac 10.12.6
Also have a Win8 laptop somewhere, also has 2.3.1 on it.
My nix boxes all have 2.2.1 on Debian 10.
At the studio, have several Macbooks, iMacs and “dustbins” of varying ages and OS versions.
I just found that 2.3.1 has been very stable and has served me well both at home and at work.
For now at least, I think the 3.x series needs to mature a bit more before I will consider upgrading.
As for 2.4.2, I’m willing to consider it, especially as you rate it very highly.
Would it be a simple case of just downloading it and installing it? (Is it compatible with Mac 10.12 ?).
Would all my plugins (ny, VST, AU and some LADSPA) still work including any presets?
I’m not using 3.x for production work either (for the same reason).
Linux is a good platform for testing new releases now that AppImages are available (no need to uninstall your regular version, though to be on the safe side I’d recommend backing up the ~/.audacity-data folder (I just rename it as ~/audacity-data-bak, then change it back after testing the AppImage).
This is how I’m going to approach it…
(It’s probably the safest way, although the most laborious, but like to err on the side of caution).
The Win8 laptop, will try on that first with 2.4.2
I rarely use Windows so if anything goes wrong, no catastrophe.
For Mac, will try on the oldest Macbook Pro at work and use it for a while
to see how things behave.
There is one in one of the edit suites that is just used for emails, etc.
Perfect candidate.
Will patch it in to one of the inputs on the desk and play for a while.
As for Linux, I read somewhere that the AppImage does not support Jack audio.
Is that correct, or am I mistaken?
I use Jack audio as the default on all my nix boxes.
That was correct the last time that I checked.
The AppImage versions have been improving with each release, but not yet mature enough for production use in my opinion (though 3.1.0 may be good enough for anyone that does not require Jack).