Option to copy audio position information

Anything you think is missing, or needs enhancement, goes here.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
4ud4cit4t0r
Posts: 5
Joined: Fri Apr 20, 2018 11:42 am
Operating System: Windows 7

Option to copy audio position information

Post by 4ud4cit4t0r » Mon Jul 30, 2018 10:34 am

Hi,
When loading an audio file in Audacity, you can see the audio position of the cursor on the bottom.
For example: 00h04min24.653sec
When clicking on this field, you can change the format to seconds, frames, samples etc.

I would like to be able to copy the value of this field (no matter what format it is) to the clipboard.
Of course I've already tried right-clicking on the field or just Ctrl+C - nothing worked.

Can you please add the possibility that users can copy those values?
Would be very useful for audio position, and optionally for start and end of selection.
Image

Regards

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

Re: Option to copy audio position information

Post by steve » Tue Jul 31, 2018 10:37 am

4ud4cit4t0r wrote:
Mon Jul 30, 2018 10:34 am
I would like to be able to copy the value of this field (no matter what format it is) to the clipboard.
To do what with it?

This short code can be run in the Nyquist Prompt effect to give the start of a selection in seconds (the caveat being that the Nyquist Prompt effect requires playback to be stopped, and for there to be an audio selection):

Code: Select all

;version 4
;debugflags trace
(format t "~a~%" (get '*selection* 'start))
""
Use copy and paste to ensure that you enter the code exactly as written.
(The two double quotes at the end are required in this code)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

4ud4cit4t0r
Posts: 5
Joined: Fri Apr 20, 2018 11:42 am
Operating System: Windows 7

Re: Option to copy audio position information

Post by 4ud4cit4t0r » Tue Jul 31, 2018 11:18 am

Hi,

It's indeed an interesting way.
I tried it and the first impression was good.

Why I need this information?
I want to cut the silence of many MP3s at the end of the track.
However, instead of re-encoding them, I'll use another program which just cuts them.
With Audacity I find out the starting point of the silence and the whole song length.
I store everything in an Excel table.
(I created AHK scripts for that.)

Thanks.

P.S. But you might remember the wish anyway to add Copy support for these fields... ;)

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

Re: Option to copy audio position information

Post by steve » Tue Jul 31, 2018 12:41 pm

4ud4cit4t0r wrote:
Tue Jul 31, 2018 11:18 am
Why I need this information?
I want to cut the silence of many MP3s at the end of the track.
However, instead of re-encoding them, I'll use another program which just cuts them.
With Audacity I find out the starting point of the silence and the whole song length.
I store everything in an Excel table.
(I created AHK scripts for that.)
How many is "many"?

If it's not a huge number, you could do the whole job (apart from automating the trimming) with MP3Split (or similar).

If it is a huge number, then it would be possible to write a script for Audacity and batch process the files to give a text file output something like:

Code: Select all

name-of-file  123.4216
name-of-other  120.1000
yet-another  67.213
...
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

4ud4cit4t0r
Posts: 5
Joined: Fri Apr 20, 2018 11:42 am
Operating System: Windows 7

Re: Option to copy audio position information

Post by 4ud4cit4t0r » Wed Aug 01, 2018 4:25 pm

It's like 2000 files, but there could be even more.

I'm not sure if a batch might do the job, because I need to find out the start of the silence for each track.
I use an AHK script for that.
Loop start
- open mp3 file with Audacity-
- jump to end
- move cursor x seconds back
- start playback
- check if there is silence -> if yes, pause, copy audio position info, paste it to Excel
- exit
- select next file
Loop end

Is it with Niquist also possible to get the total length of the track?
Your code is fine, but would be even better if I have a second value that is the total length.

P.S. For cutting I would use mp3directCut. - To be honest I haven't checked if an AHK script might be useful there too (as for AHK)

Regards

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

Re: Option to copy audio position information

Post by steve » Wed Aug 01, 2018 5:04 pm

4ud4cit4t0r wrote:
Wed Aug 01, 2018 4:25 pm
Is it with Niquist also possible to get the total length of the track?
Yes.
If the track starts at time = 0, then you can get the end time with:

Code: Select all

(get '*track* 'end-time)
If the track may start earlier or later than time = 0, and you want the length, then:

Code: Select all

(- (get '*track* 'end-time) (get '*track* 'start-time))
4ud4cit4t0r wrote:
Wed Aug 01, 2018 4:25 pm
I'm not sure if a batch might do the job, because I need to find out the start of the silence for each track.
Perhaps you could use, or adapt Silence Finder https://manual.audacityteam.org/man/silence_finder.html
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply