Re: [Audacity-nyquist] Learning warp
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: <edg...@we...> - 2008-08-31 09:28:34
|
Hi irijako, PREFACE: sorry for the delay, but sometimes I have to work and so it took some time to write a more detailed explanation... irijako wrote: > Thanks edgar, your advice seems very interesting to me, but I am afraid > that I do not understand it properly. It would be very helpful if you > give me an example. > > And in my environment, just > > (s-rest 1.0) > > creats a silent track in a length of the current selection in Audacity. > But is this not the right code? This (according to the Nyquist Manual) the right code but unfortunately the Nyquist implementation in Audacity is messed up by defining "1.0" as the length of the Audacity selection. A more detailed explanation can be found under: http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/devel/audacity-nyquist-en.htm#variables Unfortunately this is different from the original Nyquist implementation and makes it ultimate pain to learn time-shifting and warping in Audacity from the related sections in the Nyquist Manual. That's the reason why I do not use the Nyquist transformation environment in Audacity. Now the explanation of "s-rest" and "zero time reference" in Audacity: If I generate a sound in Audacity e.g. via "Genetate > Tone", and then, afterwards, I go to the "Effect" Menu, open the "Nyquist prompt" and write: (at 0.5 (cue s)) I want to to shift the sound 0.5 seconds to the right but it won't work. Here's the explanation why: Nyquist was designed to generate samples from scratch and not to edit already existent sounds, so Nyquist assumes that there were no samples BEFORE Nyquist started. In Audacity, just the opposite is the case. With the code from above, Nyquist is capable to detect that the first 0.5 seconds of the new sound contain only zero samples (silence) so it tries to avoid producing "unneccessary" (from the Nyquist poit of view) zero samples by moving the start time to "0.5". Or in other words: the Nyquist zero start time 0.0 now is 0.5 seconds AFTER the first sample in the Audacity selection. Then Nyquist produces the sound via "cue" at the new start time of 0.0 and gives it back to Audacity. The effect in Audacity is then that NO sample was shifted. So Nyquist did the right thing but the result is wrong. Audacity and Nyquist have a different understanding where a sound starts. In Audacity a sound given to Nyquist starts with the first sample wether zero or not. Nyquist in contrast refuses to produce unnecessary samples and and won't generate the additional zero samples at the beginning, unless you explicitely tell Nyquist to do so (see below). NOTE: Nyquist does not examine the sound given from Audacity. If you give Nyquist a sound of zero samples only (a piece of silence), Nyquist will treat it like any other sound object. The "automatic time shift" only affects zero samples produced or added by Nyquist itself. Now here's a solution how to shift an Audacity sound to the right: To shift a sound 0.5 seconds to the right with Nyquist in an Audacity track you have to tell Nyquist to explicitely produce zero samples (silence) at the beginning of the Audacity selection by writing: (sum (s-rest (/ len *sound-srate*)) ; silence, starting at the first sample (at 0.5 (cue s))) ; the Audacity sound, starting at 0.5 seconds This will work, because "s-rest" tells Nyquist to explicitely produce zero samples from the first to the last sample of the Audacity selection. This way the Nyquist "zero start time" will remain at 0.0, meaning in Audacity: the first sample of the Audacity selection. "at 0.5" now will produce a 0.5 seconds shift to the right. Hope this helps a bit, - edgar P.S. I've just downloaded "chunker.ny" and "SoundShufflingSimple.ny", but still haven't looked at both in more detail. It will probably take another few days to write more details. P.P.S. another solution to shift samples in an Audacity selection is to turn the sound via "snd-fetch-array" into an floating-point array, then move the samples via "aref" from one place to another and the re-convert the array via "snd-from-array" into a sound again. But this version will be VERY SLOW. ----- Original message was: > > Thank you for the replies. > > I am sorry for lack of explanation. > > Just for a reference, I present a plugin that I wrote in order to re-order > sliced segments in audio loop. The plugin askes parameters, the tempo of the > audio loop, how many times the beat will be segmented, and from which > segment each of new segment will be copied. > > http://irijako.up.seesaa.net/image/SoundShufflingSimple.ny > > It works somehow but I would like to learn more proper way of writing codes. > As David mentioned, simple expression like > (sim (at 0 (cue (extract 0.5 1 s))) (at 0.5 (cue (extract 0 0.5 s)))) > generates the last half of the selected audio followed by the entire audio, > but this failure can be somehow rescued by use of (loud) function. I cannot > understand it. If this fundamentally violates the proper use of Nyquist, I > am afraid that Audacity-Nyquist is not the best choice for my aim. > > Thanks edgar, your advice seems very interesting to me, but I am afraid that > I do not understand it properly. It would be very helpful if you give me an > example. > And in my environment, just > (s-rest 1.0) > creats a silent track in a length of the current selection in Audacity. But > is this not the right code? > > Many thanks for further suggestions. > > Irijako -- The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: ________________________________________________________________________ Schon gehört? Bei WEB.DE gibt' s viele kostenlose Spiele: http://games.entertainment.web.de/de/entertainment/games/free/index.html |