Page 3 of 5

Re: possible to make this plugin? ("auto draw wave")

Posted: Wed Apr 02, 2014 8:52 pm
by steve
N871 wrote:they all need to have the same length up to the sample to work well in my max msp program
Not a problem.
If you get the audio as close as possible to the required length with perfect complete samples (as described in my previous post) then you can stretch the entire track a little to fit the required length using this code:

Code: Select all

(setq new-length 100000) ; required length is samples
(force-srate (* (/ new-length len) *sound-srate*) s)

Re: possible to make this plugin? ("auto draw wave")

Posted: Wed Apr 02, 2014 9:34 pm
by N871
wow,..interesting, so you can use this plugin as a high-quality speed shifter?

Re: possible to make this plugin? ("auto draw wave")

Posted: Wed Apr 02, 2014 10:03 pm
by N871
oh and one other thing: do you now a way to "update" the audio when you change the sample rate in a project.
If I change it I have to export all audio and import it again before I see some change in the sample amount per wave cycle.

Re: possible to make this plugin? ("auto draw wave")

Posted: Thu Apr 03, 2014 2:55 am
by steve
I think you may be looking for "Tracks > Resample".

Re: possible to make this plugin? ("auto draw wave")

Posted: Thu Apr 03, 2014 7:25 am
by N871
Thanks, audacity is more powerful than I thought :) If you can just let me now if I can use your last plugin as a high quality speed shifter I'm done.

Re: possible to make this plugin? ("auto draw wave")

Posted: Thu Apr 03, 2014 10:58 am
by steve
N871 wrote:If you can just let me now if I can use your last plugin as a high quality speed shifter I'm done.
It's not particularly "high quality". Audacity's "Change Speed" effect is higher quality, particularly for higher frequency signals, but this one allows very precise (sample accurate) length stretching and the quality is quite good enough for low frequency signals.

Code: Select all

(setq new-length 100000) ; required length is samples
(force-srate (* (/ new-length len) *sound-srate*) s)
Not much to say about it really. Use it in the Nyquist Prompt as before. In the first line replace "100000" with the actual duration that you want (in samples).
If you've not noticed, the Selection Toolbar at the bottom can be set to show the number of samples: http://manual.audacityteam.org/o/man/se ... olbar.html

Re: possible to make this plugin? ("auto draw wave")

Posted: Thu Apr 03, 2014 6:19 pm
by N871
Ok, thank you!

Re: possible to make this plugin? ("auto draw wave")

Posted: Thu Apr 03, 2014 10:33 pm
by N871
this may sound like a strange request, but does someone know how to make a plugin that copies the first half of a selection, deletes it and pastes it back right after the selection.
example: selection = 10 samples in length, the sample order 1 2 3 4 5 6 7 8 9 10 becomes 6 7 8 9 10 1 2 3 4 5 after using the plugin. (1 to 5 was copied, deleted and pasted at the end of the selection)...might sound stupid but very practical to me.
I'm probably making too many demands :) but preferably the plugin shouldn't join the 2 resulting parts. This way I can see where the "cut" is made (between 10 and 1 in my example).

Re: possible to make this plugin? ("auto draw wave")

Posted: Fri Apr 04, 2014 12:03 am
by steve
N871 wrote:preferably the plugin shouldn't join the 2 resulting parts
That part can't be done at present.
Audacity send one lump of audio (the "selection") to Nyquist, and Nyquist can return one lump of audio back to Audacity. Nyquist has no concept of audio clips or anything else about Audacity tracks.
N871 wrote:how to make a plugin that copies the first half of a selection, deletes it and pastes it back right after the selection.
Are we still talking about mono tracks?

Re: possible to make this plugin? ("auto draw wave")

Posted: Fri Apr 04, 2014 8:13 am
by N871
Yes, mono tracks! I will always use the entire track as a selection. Not sure if it is easy to program
the plugin so that it auto-detects the length of a track. If so I could select the full project and have
the plugin processing all tracks ( with different lengths) at once : )