at the end (after extract-abs) I just have to make sure that starting position is the beginning of the selection and the end is the peak, instead
of the peak being the beginning and the end of the selection being the end right? : ) this must be painful to read for somehow who knows how
to code haha
Yes. And for this purpose there is a very convenient feature about how Nyquist works with Audacity.
As far as Nyquist is concerned, the start of the selection is always “time = 0”.
You already have the time of the peak sample - you just need to ensure that you are the correct side of that sample.
For testing you may find it useful to use the Draw tool (http://manual.audacityteam.org/o/man/draw_tool.html) to make one sample noticeably higher than the rest.
When I started with Nyquist I had no more idea than you, and there was less documentation. Fortunately there were a couple of guys willing to help - which is what this forum is about.
Thank you for all the clues : )
A good night’s sleep will do me good, I’m sure I will find the solution tomorrow!
great forum, great people!
edited
It’s still not happening here, would you mind giving the solution so I can see what went wrong?
I tried all sorts of combinations in the extract-abs line. The thing is I could win so much time,
if I could start cutting the tails. Now I’m checking if I can change the 'get’s in some sort of delete command, that would work too…
…seems like that is not the way to go…
How far did you get?
You’ve got that the basic structure (the syntax) is:
(extract-abs )
So we are “extracting” (trimming to) the section between and
and the sound that we are trimming is “track”
So in the original line:
(extract-abs (get-peak (snd-copy *track*)) (get-duration 1) *track*)
“(get-peak (snd-copy track))” is the start position, and the position of peak value.
“(get-duration 1)” is the end position, which is the end of the selection.
“track” is the sound selected in the track.
What you now want is:
(extract-abs 0 (get-peak (snd-copy track)) track)
Did you follow that?
Steve, thank you so much. I completely understand the logic, instead of 0 I used ‘time = 0’ … …
Anyway, this plugin helped me a lot!
not really topic related but…
…the next step is to speed-shift all the recordings so that they are the same in length and pitch.
Normally I use a different software for this, but it seems that Audacity is now able to speed-shift
to a specific sample length. Very happy to see this feature but bit disappointed because it doesn’t seem to work properly.
For example, when I speed-shift some tracks to a length of 862058 samples (one by one), some of them
end up with 862060 samples, others with 862054 samples etc. …
Is there a way to get perfection? has this maybe something to do with audacity not being 64 bit?
Just noticed that the change-percentage automatically changes when typing a new sample length,
this percentage only allows for 3 digits after the point or comma. I would need more… for example 0.3637 instead of 0.364
Do you know if this means game over, or can something be done to overcome the problem?
Unfortunately it’s a bug that crept in when effects were updated in Audacity 2.1.1. It works correctly in Audacity 2.1.0. Also, I’d not noticed the problem until too late in the 2.1.2 release cycle, so it won’t be fixed until version 2.1.3. The good news is, that you can use Nyquist instead.
This is the basic code. To make this into a plug-in (rather than running in the Nyquist Prompt, you could just add the appropriate headers (must be a “version 4” plug-in): Missing features - Audacity Support
;restoresplits 0
;control newlength "New length in samples" int-text "" 44100 1 nil
(force-srate (* (/ newlength len) *sound-srate*) *track*)
thank! in fact I just found a plugin on this website which works just fine, and it has a GUI:
http://wiki.audacityteam.org/wiki/Change_Speed
I only have to calculate the durations in seconds.
it does split the audio but that doesn’t harm the recording, right?
You mean this one? https://forum.audacityteam.org/t/change-speed-stretch-audio-to-a-specified-length/23332/1
If you open the .ny file in your text editor, you will see that most of the code is just handling the input and checking for stupid user errors It’s only when you get to the final line that it actually does something. Does this look familiar:
(force-srate new-srate s)
By the way, if you are interested in working with Nyquist, I would highly recommend using a text editor that has “parentheses matching”, and preferably syntax highlighting for Lisp or Scheme. Lisp / Scheme are not quite the same as XLISP on which Nyquist is based, but they are close enough for syntax highlighting to be useful. Assuming you are on Windows, NotePad++ is a good choice: https://notepad-plus-plus.org/
thanks, but in fact I’m a mac user…but I will look for q good editor.
Very last question, your last codes has 44100 1 nil,
I’m working with a ridiculous high sample rate of 960kHz, so I changed it to 960000.
However, when using 44100 instead it still works fine, is this normal?
so to speedshift to a length of 462058 samples I use:
;restoresplits 0
;control newlength “New length in samples” int-text “” 960000 1 nil
(force-srate (* (/ 462058 len) sound-srate) track)
;control newlength "New length in samples" int-text "" 44100 1 nil
This line creates a control. For it to work in the Nyquist Prompt requires Audacity 2.1.1 or later.
The syntax is described here: http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference#Nyquist_Plug-in_Widgets
Running the code in earlier versions of Audacity will treat the first line as a code comment (the line is ignored).
As you can see, the number “44100” after the keyword “INT-TEXT” is just the default value for the control. The following “1” is the minimum value and “nil” (for numeric-text controls only) means that the maximum value is undefined.
Ok, I just finished the project, I’m encountering a most intriguing bug.
At one point I made a mistake: a few seconds in my project were pitched too high, I fixed this.
But after exporting the .wav I discovered that the mistake is there again! Curiously after changing the name
of the .wav, the mistake is fixed… how is this possible??? Is there still a connection between the .wav and the
audacity files?
Generally it’s a bad idea to overwrite the source files. If you do and you make a mistake, then the source file is gone forever.
Also, you can run into issues because of “dependencies”. See: http://manual.audacityteam.org/o/man/audacity_projects.html#dependencies
You also need to be careful with some media players, particularly the big monstrosities like Windows Media Player and iTunes. Some media players play files from their “library” which may not show which file you are actually playing. If the Audacity project has dependencies, then to prevent you from destroying your project by overwriting a file on which it depends, Audacity will rename the dependency by adding “-old” to the name. Some media players will then get confused, or just confuse the user, about which version of the file it the one in the library.
It’s easy to avoid all of these potential issues - repeat this mantra 10 times a day: “Always use a new name. Always use a new name, Always …”
Thanks Steve, I was using itunes indeed. I saved each adjustment under another name, so the files are safe ; )
Hi Steve, is it possible that the code to speed-shift a track to a specific length contains bugs?
It seems to have kind of ruined my perfect loop points, see attachment…