The content of posts of Volta-X, in particullary of the one where the problems are formulated was deleted/modified by the author itself.
The problems were:
1. How to create a Nyquist effect with mono input and stereo ouput?
2. Why makearray does not work (for me)?
About the solutions:
Currently Audacity allows to apply Nyquist effects to a mono track and to a stereo track.
The input is assigned to a variable 's' and it is represented as a 'sound' or an array of two 'sounds'.
The output of the effect is the value of last successfully evaluated expression in the script.
If the output is the sound of the same type as input (mono/stereo), it replaces the input on the track in Audacity.
[What happens if the size is different for the old and new sound?]
(If the output is a text or number, it is displayed in a message box. If the output is an appropriately formatted list, a labels are created on a label track.) If the output is not of correct type, Audacity displays 'Nyquist did not return audio' error message.
The one-or-two-channel limitation is not fundamental and could be changed in future version of Audacity if there is sufficient demand for this new feature and if there is programmer to implement it. Important aspect would the design of the interface. (It should be compatible to the current one which includes the 's' variable and the current behaviour when multiple tracks are selected.)
1. For the first problem, the following steps lead to the solution: A stereo track is created, where input is placed in the first channel and any (e.g., the same or zero) sound is placed in the second channel. The script ignores the second channel and outputs a stereo sound. When writing the script, one is likely to encounter problem caused by multiple evaluating of 's', for example the output might have half the size of the input. The solution is to use '(cue s)' instead of 's'.
2. There is no problem with make-array or vector functions. It turned out that in the case two rules had to be followed: (1) If the input to Nyquist script is mono, Audacity expects mono output, if the input is stereo, Audacity expects stereo output. (2) Audacity does not accept NIL as a sound; likewise it does not accept (vector NIL NIL) as a stereo sound. While this is perhaps different to behaviour of Nyquist when used outside of Audacity, it is consistent and moreover, it is Nyquist itself who sais that (soundp NIL) si not true, which I can see by putting (cond ((soundp NIL) "yes") (T "no")) into Nyquist prompt. Do more recent versions of stand-alone Nyquist behave otherwise?
----------------------------------------------------
As regards your question:
I think you want one track input and two track output for a Nyquist effect.
Then I'd guess you would need to create an addional track with silence (or possibly empty?),
connect them to a single stereo track and a select two of tracks before calling Nyquist.
Than Nyquist can return a stereo track, too.
There might be on other way but I do not know about that.
Stereo tracks are arrays in Nyquist.
Select a part of a stereo track. Then
Code: Select all
(setf ss (make-array 2))
(setf (aref ss 0) (aref s 1))
(setf (aref ss 1) (aref s 0))
ss
The following does the same, but I do not know - is it less expensive?
Code: Select all
(setf x (aref s 0))
(setf (aref s 0) (aref s 1))
(setf (aref s 1) x)
s
To duplicate really, one can introduce 'cue' function -- see one of the later posts here.
Sorry for not testing my script carefully.}}The following does {{not}} what you want - it duplicates {{not}} the sound of left channel.
Modify it to your needs, e.g. Replace "x" on the last line by "(SOMEEFECT x)".
Code: Select all
(setf x (aref s 0))
(setf (aref s 0) x)
(setf (aref s 1) x)
s
[/size]Code: Select all
(setf ss (aref s 0)) (vector (cue ss) (cue ss))
or
[/size]Code: Select all
; our input is in the left channel (setf inputchannel (aref s 0)) ; we ignore the right channel. ; the folowing line is useless a can be deleted !! (setf ignoredchannel (aref s 1)) (setf sL (cue inputchannel)) (setf sR (cue inputchannel)) (display "what is (vector sL sR) " (vector sL sR)) (vector sL sR)
in a later post of myself. See also the two scirpts just bellow that one.}}[/color]
This was certainly not a question for developers. {I mean it is for users as I am.
But I uderstand(?) your feeling it could be a nyquist problem.}