Frequency interpolation nyquist plugin

This section is now closed.
Forum rules
Audacity 1.3.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.
steve
Site Admin
Posts: 80677
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Frequency interpolation nyquist plugin

Post by steve » Wed Mar 17, 2010 5:45 pm

Code: Select all

(setq last (snd-copy s))
(seq
(extract 0 (/ (get-duration 1) 3)(sound s))
(extract (- (get-duration 1) (/ (get-duration 1) 3)) (get-duration 1) (sound last)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

hypn666
Posts: 7
Joined: Sun Nov 22, 2009 6:55 pm
Operating System: Please select

Re: Frequency interpolation nyquist plugin

Post by hypn666 » Thu Mar 18, 2010 8:15 am

Wait, what is that code actually doing? Because I need to have all 3 parts (beginning, middle, end) in some kind of variables, so I can do an fft on beg and end and then ifft to rebuild middle.

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

Re: Frequency interpolation nyquist plugin

Post by steve » Thu Mar 18, 2010 5:23 pm

(setq variable (extract start-time end-time behaviour)

I'm not 100% certain about this, but this appears to be correct as far as I can tell:
In your example you assumed that the end time of the full sound was "1", which is not correct because "extract" works on "behaviours" and not on "sounds".
You need to be very careful with behaviours that are linked to sounds - if you "extract" part of "s", the remainder of "s" is destroyed, hence my use of "snd-copy"
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

hypn666
Posts: 7
Joined: Sun Nov 22, 2009 6:55 pm
Operating System: Please select

Re: Frequency interpolation nyquist plugin

Post by hypn666 » Sun Mar 21, 2010 10:50 am

Oh, ok... So I need to copy whole selection 3 times and then extract what I need from them to have beg,mid,end piece? And what is that seq doing? In first extract it extracts beginning from sound s (so I assume s is now not usable anymore for other extracts?) and in second extract it extracts end piece and this last piece is now in "last" variable if Im correct? So isnt that should be something like this?

Code: Select all

(setq beg-piece (snd-copy s))
(setq mid-piece (snd-copy s))
(setq last-piece (snd-copy s))
(seq
	(extract 0 (/ (get-duration 1) 3) (sound beg-piece))
   (extract (/ (get-duration 1) 3) (- (get-duration 1) (/ (get-duration 1) 3)) (sound mid-piece))
	(extract (- (get-duration 1) (/ (get-duration 1) 3)) (get-duration 1) (sound last-piece)))
But still not sure what is that seq, so if those two extracts in your seq was just for last piece I assume I need it 3 times for every piece... But if this is correct I now have all 3 pieces in 3 variables and can do fft and ifft... Other thing is, if I really need that mid-piece, because I will do ifft on fft data from beg and last and then build new mid-piece from scratch...

Thanks.

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

Re: Frequency interpolation nyquist plugin

Post by steve » Sun Mar 21, 2010 9:27 pm

For (seq beh1 beh2 ...) see:
http://www.audacity-forum.de/download/e ... l#index423

This (implementation of *warp* in Audacity) is dealing with an aspect of Nyquist that I do not yet fully understand, but I'm happy to help as far as I can.
In my previous example, the first part and the last part are "extracted" and played one after the other. This code is probably not be the "right way" to do it, but it works.

Let's look at the problem again.....

It would appear that this code should create a track with the last 1/3, followed by the middle 1/3 followed by the first 1/3, but it does not work correctly. Instead of creating "last-bit > mid-bit > first-bit" it creates "last-bit > mid-bit > all of s"

Code: Select all

(sim
(at 0.0 (cue (extract (/ 2 3.0) 1.0 (cue s))))
(at (/ 3.0)(cue (extract (/ 3.0)(/ 2 3.0) (cue s))))
(at (/ 2 3.0)(cue (extract 0.0 (/ 3.0) (cue s)))))
The problem here is that (extract ....) works using a logical start time and a logical stop time.
Take the last line - it says to place the behaviour so that its start time is at 2/3 of the logical duration. However, the behaviour that it is applied to says to extract from s a section that has a logical start time of 0.0 and a logical stop time of 1/3. This should be fine IF the logical stop time was still the same as it was when we started, but as far as I can tell it isn't. We are creating a sound using (sim ....) that starts at 0.0 and ends some-time. Until (sim ....) has been calculated, the logical stop time is unknown. We can solve this problem by explicitly changing the stop time using (extract ...) again:

Code: Select all

(extract 0.0 1.0
(sim
(at 0.0 (cue (extract (/ 2 3.0) 1.0 (cue s))))
(at (/ 3.0)(cue (extract (/ 3.0)(/ 2 3.0) (cue s))))
(at (/ 2 3.0)(cue (extract-abs 0.0 2 (cue s))))
))
There's some useful information here: http://www.audacity-forum.de/download/e ... part3.html

You may be able to get further assistance by posting to the audacity-nyquist mailing list: https://lists.sourceforge.net/lists/lis ... ty-nyquist
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Locked