Convert Label text to LRC file

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
bigboss97
Posts: 45
Joined: Sat Feb 08, 2020 6:28 am
Operating System: Windows 10

Re: Convert Label text to LRC file

Post by bigboss97 » Sun Mar 21, 2021 11:01 am

I took the loop from pipeclient and added it to the old script. Now it works :)

Code: Select all

def do_command(command):
    """Send one command, and return the response."""
    send_command(command)
    reply=''
    start = time.time()
    while reply == '':
        time.sleep(0.1)  # allow time for reply
        if time.time() - start > 5:
            reply = 'PipeClient: Reply timed-out.'
        else:
            reply= get_response()
    print(reply)
    return reply

bigboss97
Posts: 45
Joined: Sat Feb 08, 2020 6:28 am
Operating System: Windows 10

Re: Convert Label text to LRC file

Post by bigboss97 » Sun Mar 21, 2021 11:24 am

What does the '1' mean?

Code: Select all

[
  [ 1,
    [
      [ 0, 0, "ccc" ],
      [ 1.55871, 1.55871, "aa" ],
      [ 3.26586, 3.26586, "Hello" ] ] ] ]
      
My understanding, there's no newline in labels. For my purpose (label2lrc), I want to have multiple lines. My idea is, allow user to add a label with special characters, e.g.'\n' Then the converter will make a new line. Does this make sense? or any better solution with Audacity?

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

Re: Convert Label text to LRC file

Post by steve » Sun Mar 21, 2021 12:15 pm

bigboss97 wrote:
Sun Mar 21, 2021 11:24 am
What does the '1' mean?
Track index = 1.

The first track is index=0.

bigboss97 wrote:
Sun Mar 21, 2021 11:24 am
My understanding, there's no newline in labels.
It is "possible" to put a newline in a label, but it is not officially supported and will create strange looking labels.
It is not safe to rely on multi-line labels as we don't know if they will work in the future or not.

Second Track000.png
Second Track000.png (5.68 KiB) Viewed 353 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bigboss97
Posts: 45
Joined: Sat Feb 08, 2020 6:28 am
Operating System: Windows 10

Re: Convert Label text to LRC file

Post by bigboss97 » Mon Mar 22, 2021 9:59 am

Another question...
'SetLabel:' modifies existing labels. Is there a way to insert new label through pipe?

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

Re: Convert Label text to LRC file

Post by steve » Mon Mar 22, 2021 10:51 am

bigboss97 wrote:
Mon Mar 22, 2021 9:59 am
Is there a way to insert new label through pipe?
From: https://manual.audacityteam.org/man/scr ... rence.html
AddLabel: Add Label at Selection none Creates a new, empty label at the cursor or at the selection region
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bigboss97
Posts: 45
Joined: Sat Feb 08, 2020 6:28 am
Operating System: Windows 10

Re: Convert Label text to LRC file

Post by bigboss97 » Mon Mar 22, 2021 11:44 am

Thanks, this is exactly what I need.
Now I can Use NewLabelTrack: to insert a new track, use Select: to set the cursor and then AddLabel:.
One thing I couldn't figure out, the number of tracks. I've to ensure that I'm selecting the right (last) track to add the labels.

I love the pipeclient. Now I can test the command one by one :)

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

Re: Convert Label text to LRC file

Post by steve » Mon Mar 22, 2021 11:57 am

bigboss97 wrote:
Mon Mar 22, 2021 11:44 am
I love the pipeclient. Now I can test the command one by one
Super :D That's precisely what I intended the command line interface to be used for.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bigboss97
Posts: 45
Joined: Sat Feb 08, 2020 6:28 am
Operating System: Windows 10

Re: Convert Label text to LRC file

Post by bigboss97 » Mon Mar 22, 2021 9:59 pm

After NewLabelTrack:, I want to do a Select:. How do I find out what's the latest track number?

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

Re: Convert Label text to LRC file

Post by steve » Mon Mar 22, 2021 10:03 pm

You can get the number of tracks and track types from "GetInfo: Type=Tracks".
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bigboss97
Posts: 45
Joined: Sat Feb 08, 2020 6:28 am
Operating System: Windows 10

Re: Convert Label text to LRC file

Post by bigboss97 » Wed Mar 24, 2021 11:13 am

Sorry Steve, I need your help again :)
I want to populate labels in a selected region. But I couldn't find any parameter in GetInfo: to retrieve the start and end of the current selection.

Post Reply