Re: bug? my fault? makearray won't work.

This section is now closed.
Forum rules
Audacity 1.2.x is now obsolete. Please use the current Audacity 2.1.x version.

The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
jan.kolar
Posts: 273
Joined: Sat May 24, 2008 7:01 pm
Operating System: Please select

Re: bug? my fault? makearray won't work.

Post by jan.kolar » Sat May 31, 2008 9:00 pm

Volta-X wrote:(continued from electric-x post. for simultaneous existing)
...
stevethefiddle wrote:"make-array" works within the Audacity implimentation of Nyquist, but as jan says, you cannot return stereo data to a mono track.
he must have identical misunderstandings as you. that is one of them. i didn't need "stereo to mono". needed "mono to stereo". it's obvious.
and... WE CAN MAKE MONO ARRAYS from stereo data with basic script;

Code: Select all

(sum (mult 0.5 (aref s 0)) (mult 0.5 (aref s 1)))
##note: if "make-array" works, we'll get a single mono track. same bug happens in audacity's "stereo to mono" menu.
Can you read? He did not say you need "stereo to mono". He said you cannot force Audacity to put stereo data into a mono track. He nows you claimed you want "a mono to stereo effect". And he formulated well what is the obstacle.
You should concentrate your attaintion to this point if you are indeed interrested in. If I we get sillent, it is mainly
because we do not believe you are interrested in that, and also because of ours insults.

Volta-X wrote:

Code: Select all

s
"S" WORKS AS VARIABLE AND ALSO COMMAND though you didn't seem to expect at all. its often used as dry sound in scripts. returns original sounds, even on nyquist prompt. and other than that i wrote, would go only if you created 2 arrays out of mono in theory.
You seem to have new knowledge about "S". On May 24, 2008, you pressented a script that started by dereferencing (=loosing) the value of s.

Code: Select all

(setf s (make-array 2))
(vector s s)
"S" is a LISP symbol, and it is an atom. And it a variable, because its value is presset by Audacity to what you call "original sound". Therefore it indeed "returns" the "original sound" unless its value is changed, like it happes in the first line of your code. Also, the string "S" is a correct LISP expression, and if evaluated, it returns its own value (preset by Audacity, see above) because it is a variable. I do not know what you mean by "command" in Lisp. Perhaps you mean function (because function is one of the main concepts of LISP, therefore of Nyquist language). Normally "S" is not function, but it can be made to be a function since (almost?) any atom can be made to be a function. I do not recomend doing that, unless for fun.
(Where did I copy from now ????)
Volta-X wrote: and other than that i wrote, would go only if you created 2 arrays out of mono in theory.
Not clear what you want to say.

Volta-X wrote: "AREF" IS ONLY TO REFER AND GET A PART OF DATA FROM 2-LENGTH DATA. IT CREATES NOTHING NOR EFFECT NOTHING stereo-2-arrays date is a series of one list (i.e. data), not two list (in other word it's 2-length of A list). "aref" ONLY GETS a part of list. and we point a specific part of list with "(s 0or1)". then, noted plugin developers too use "VECTER" to recombine them.
YOU DIDN'T EXPECT THAT AT ALL THAT TOO?
AREF is a function that returns n-th part of array of arbitrary length >=n, and it does do it in a special way,
so that it can be used to modify the content of the array. (Now this is a nice LISP excercise for me: how could that be implemented? Funny is the it is like you would speak about the implementation below. Possibly this way: the core of an array would be a list of symbols, that are variables. aref would return the n-th symbol. OK. OK? Does it work properly with local variables? Yes if the symbol names are globally unique, which is easy to implement. Is there something more to check? How does it work for (setf x (make-array 20)) (dotimes ((aref x 10) 5) (setf (aref x (aref x 10)) 3)) ? Xlisp does not accept that so I am about to do more than is usual. A nice excercise anyway.) Did I ever claim aref would create anything?
Volta-X wrote: stereo-2-arrays date is a series of one list (i.e. data), not two list (in other word it's 2-length of A list). "aref" ONLY GETS a part of list. and we point a specific part of list with "(s 0or1)". then, noted plugin developers too use "VECTER" to recombine them.
Stereo-sound is (in Audacity Nyquist) an array of two sounds. I do not know if it is "a series of one list (i.e. data)",
you seem to speak now about the implementation of arrays. Morever, I have no idea what 'series' would be in XLISP nor in Audacity Nyquist. Aref is a function, it returns (not gets) something (part of an array) if an expression is evaluated whose CDR is Aref.
Volta-X wrote: "(s 0or1)"
A nice typo. Trying to use S as a function (or perhaps 'command' in your terminology). I would never expect S
to be the first item in a list that is going to be evaluated.
As regards VECTOR, I learned that from you. Seems to me that makearrya+setf+aref is much more used in Nyquist internals, at least it was much easier to spot setf+aref since it ususally makes the expressions more compact. One can use any of them to obtain best readibility, convenience or efficiency.
Last edited by jan.kolar on Fri Apr 24, 2015 2:57 pm, edited 3 times in total.
Reason: removed "non-technical" content

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: bug? my fault? makearray won't work.

Post by steve » Sun Jun 01, 2008 6:24 pm

To change the amplitude, one would normally use the "scale" function.
For a mono track that is as simple as "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 volume become half as loud as before (-6dB), while a number of 2 will make the sound become double as loud as before.

For a mono sound, the nyquist code to reduce the amplitude by -6dB would simply be:

Code: Select all

(scale 0.5 s)
In this example, Audacity inserts the selected audio for "s" and the resulting audio is taken back by Audacity into the audio track.

To support both mono and stereo tracks, we would add a little more code as follows: (lines beginning with semicolons are comments)

Code: Select all

;test if stereo
(if (arrayp s)

;if stereo, then scale left and right tracks by 0.5
(vector (scale 0.5 (aref s 0)) (scale 0.5 (aref s 1))))

;otherwise scale the mono track by 0.5
(scale 0.5 s)
For further information, there is documentation about this here: http://www.audacity-forum.de/download/e ... volume.htm

The "mult" function is a slightly more complex function for creating amplitude envelopes. If anyone requires more information about the "mult" function, it is documented here: http://audacityteam.org/help/nyquist2

There is also an introduction to Nyquist programming here: http://audacityteam.org/help/nyquist
and the Version 2.37 nyquist reference manual is here: http://www.audacity-forum.de/download/e ... /home.html

Note to Voltax, this post is not directed at you as you are clearly more advanced, but it may be useful to other users that are just getting started with nyquist commands. Also, I am not jan.kolar, and this can be verified by the forum moderators.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

jan.kolar
Posts: 273
Joined: Sat May 24, 2008 7:01 pm
Operating System: Please select

Re: A bug? Audacity window hides sometimes after Nyquist - F

Post by jan.kolar » Tue Jun 03, 2008 10:43 pm

jan.kolar wrote: Sometimes Audacity's window hides.
What is described in the post http://www.audacityteam.org/forum/viewt ... =10#p18038 above can be most reliably reproduced this way:

Code: Select all

Select some audio (stereo).
Put  "(seq asdf asd)" into Effect > Nyquist command line. Press Debug, then OK, 
When seeing the debug output, switch (using Alt-Tab) to IE explorer (with The Forum or audacity-devel).
Switch back to Audacity.
then again OK.
Now the window hides.
(It does not minimize, it is like minimizing but
   it is still the current one in Alt-TAB list (though it is #2 as regards order) 
  and it is stil the one that recieves keyboard input.)
And it is (most likely to be) fixed in comming 1.3.6 version. I tested with a Leland's build (6a1 unicode) in Windows XP and did not observe the problem anymore.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: bug? my fault? makearray won't work.

Post by Gale Andrews » Wed Jun 04, 2008 6:29 pm

I have started a new topic on "Guidance on Using Forum here:
http://www.audacityteam.org/forum/viewt ... &sk=t&sd=a

Comments welcome.

Does anyone have time to to go through and radically prune this topic, not just remove the rest of the vituperative comments, but reduce the number of posts so that the argument and the conclusion can be seen?

Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

waxcylinder
Forum Staff
Posts: 14685
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: bug? my fault? makearray won't work.

Post by waxcylinder » Thu Jun 05, 2008 9:37 am

I did some pruning on this thread this norning - I removed all the ones that Jan had marked for deletion (BTW Jan: you can always delete your own posting by clicking on the little x icon in the top right of the posting).

I also removed all the ones that added nothing to the technical content of the discussion - and edited some posts to remove some non-relevant content.

I retained all the substantive items with technical tips, scripts etc.

Incidentally this reduced the thread from 6 pages down to 3 (actually 4 pages with this post!) :D

WC
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Locked