• Login
Community
  • Login

Editing lyrics and chords text files

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
12 Posts 4 Posters 2.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Jiji M. John
    last edited by Jul 29, 2020, 6:40 AM

    Hi! I am always amazed by what Notepad++ can do. It’s like magic. Now to my question. I have to edit a large number of lyrics and chords text files. I was wondering if there was a way to enclose the chords that appear above the lyrics to enclose within square brackets and (here’s the impossible?) make the chords line merge with the lyrics line.

    For example.
    ORIGINAL:
    A D
    Above all powers,
    E A
    Above all kings,
    D E A
    Above all nature and all created things,
    F#m E D
    Above all wisdom and all the ways of man,
    Bm A C#
    You were here before the world began.

    (The chords have all aligned to the left. Actually they are not.)
    AFTER EDITING WITH NOTEPAD++:

    [A]Above all [D]powers,
    [E]Above all [A]kings,
    Above all [D]nature and [E]all created [A]things,
    Above all [F#m]wisdom and [E]all the ways of [D]man,
    [Bm]You were here [A]before the world beg[C#]an.

    Thank you.

    E P 2 Replies Last reply Jul 29, 2020, 11:36 AM Reply Quote 0
    • E
      Ekopalypse @Jiji M. John
      last edited by Jul 29, 2020, 11:36 AM

      @Jiji-M-John

      theoretically this example can be solved but this will not apply to the
      other text files which, I assume, contain other chords and lyrics.
      How should npp know in which bar the A major chord is and
      how the lyrics are sung along with it?
      How would you know that if you didn’t know the song?

      For example:

      A D
      Above all powers,
      

      could be interpreted in different ways

      A         D
      Above all powers,
      
      A      D
      Above all powers,
      
      A               D
      Above all powers,
      
      

      As long as there are no beat information in the lyrics and chords this is difficult/impossible to realize in general.

      1 Reply Last reply Reply Quote 0
      • P
        PeterJones @Jiji M. John
        last edited by PeterJones Jul 29, 2020, 1:03 PM Jul 29, 2020, 1:03 PM

        @Jiji-M-John ,

        Because you did not use the forum’s formatting tools, and didn’t notice in the PREVIEW window while typing your post that whitespace was collapsed, we did not see a true indication of the data. Fortunately, view-source showed that you had more spaces than the forum presents us.

        Here, I hit the </> button on the toolbar just above the forum edit box, and pasted the text where it prompted:

        ORIGINAL:
        A         D
        Above all powers,
        E         A
        Above all kings,
        D          E               A
        Above all nature and all created things,
        F#m        E               D
        Above all wisdom and all the ways of man,
        Bm            A                  C#
        You were here before the world began.
        

        Notice how we can now see that the chords do (somewhat) align above the words where the chords change. But I’m still not 100% sure, because maybe the forum stripped the leading spaces. (That’s implied, because your rules said F#m should go before “wisdom”, but even in view-source, F#m appears to be at the start of the line.) If you had used the forum’s formatting tools, you could have made this easier for us to understand.

        In a programming language, I would just track which column number a chord was in, and then insert that chord in the right place in the next line (I would work backwards in any given line, because otherwise position numbers change).

        pseudocode:
        for each (chord-line, lyric-line) from a pair-of-lines:
            chord-line.chomp()
            lyric-line.chomp()
            for each char-pos from end(chord-line) back to start(chord-line):
                if start-of-chord (possibly compare to regex (?-i)([A-G]\S*):
                    grab chord from regex match $1
                    insert "[chord]" at lyric-line.position(char-pos)
            output modified lyric-line
        

        It might be possible to craft such a thing in regex in Notepad++, but it would be horribly complicated and unreadable, and probably very fragile (meaning a small change to the input would make the regex unusable for another file). Personally, I wouldn’t trust such an expression if I were not the one who crafted it and I (thought) I understood its nuances and restrictions… and even then, I’d use it with a huge grain of salt. I, personally, would take my pseudocode and implement it in the programming language of my choice (I’d say Perl, because text manipulation and regex are a particular forte of Perl’s).

        1 Reply Last reply Reply Quote 2
        • J
          Jiji M. John
          last edited by Jul 29, 2020, 3:11 PM

          Forgive my overthought, but I am new to this community. I have been using Notepad++ off and on, using Google to find the appropriate “formula”. Thanks for the response everyone. But how do I use this pseudocode?

          P 1 Reply Last reply Jul 29, 2020, 5:20 PM Reply Quote 0
          • P
            PeterJones @Jiji M. John
            last edited by PeterJones Jul 29, 2020, 5:21 PM Jul 29, 2020, 5:20 PM

            @Jiji-M-John said in Editing lyrics and chords text files:

            Forgive my overthought, but I am new to this community. I have been using Notepad++ off and on, using Google to find the appropriate “formula”. Thanks for the response everyone. But how do I use this pseudocode?

            The implication from my previous post is that, unless someone else can come up with the fragile regex I described, it cannot be done natively inside Notepad++.

            To use the pseudocode, you would pick a programming language, and translate the pseudocode into that language, and then run that program on the code, rather than trying to make the change inside Notepad++. If you don’t have those skills, you will have to convince someone to write that code for you.

            This forum is not a code forum, and is not a code writing service, so it is not the best place to ask. That said, this could be done in the one of the scripting plugins for Notepad++, which will use the active file in Notepad++ and make the changes. Despite this not being a code-writing service, if it catches the interest of a regular here, someone might write it in one of the scripting plugins for Notepad++ (usually PythonScript) – but you’ll have to be patient, because it might not happen in one day. (If I were to write it, it would be in Perl and use my module to drive Notepad++ from Perl – but it would be the most confusing solution for you, because you’d have to install Perl and the module yourself… and since you didn’t even recognize what to do with pseudocode, I am guessing that installing Perl and Perl modules would be a difficult task for you. If someone did it in PythonScript, that would be less work for you. If no one has chimed in within a few days, I might try to find time to write the code, but it won’t happen right away – and no guarantees it would happen at all.)

            While you’re waiting for someone else to chime in or to see if I can find the time, you might try looking for alternate solutions. It would very much surprise me if there didn’t already exist guitar tablature software that could convert between the standard tabs you showed to something inline or other formats that you might like better – you might want to try a few free guitar tab apps and see if any would do what you like.

            J 1 Reply Last reply Jul 30, 2020, 11:04 AM Reply Quote 1
            • J
              Jiji M. John @PeterJones
              last edited by Jul 30, 2020, 11:04 AM

              @PeterJones Thanks for taking the time to reply and for the suggestions. I have searched in Google and have not found a suitable script or software which could do this sort of job. But I am sure there could be others in search of such a script. Okay, I’ll be patient and wait. Meanwhile, I could start editing my files line by line. (Where’s my magic wand?)

              E 1 Reply Last reply Jul 30, 2020, 5:47 PM Reply Quote 0
              • E
                Ekopalypse @Jiji M. John
                last edited by Jul 30, 2020, 5:47 PM

                @Jiji-M-John

                Maybe this does what you want.

                J 1 Reply Last reply Jul 31, 2020, 3:01 PM Reply Quote 3
                • J
                  Jiji M. John @Ekopalypse
                  last edited by Jul 31, 2020, 3:01 PM

                  @Ekopalypse Sorry, but I am a newbie. How do you run that script in Notepad++? I have installed python and added the module to Notepad++ so that now it can run python scripts. But how do I use the script your mentioned to edit my text files? Please help. And thanks for showing me the script.

                  E 1 Reply Last reply Jul 31, 2020, 3:16 PM Reply Quote 0
                  • E
                    Ekopalypse @Jiji M. John
                    last edited by Ekopalypse Jul 31, 2020, 3:17 PM Jul 31, 2020, 3:16 PM

                    @Jiji-M-John

                    Goto Plugins->PythonScript->New script and give it a meaningful name.
                    A new document with that name opens.
                    Copy the content of my script into it.
                    Save it.
                    Open a chord/lyrics document and goto Plugins->PythonScript->scripts
                    and click the previously saved script.

                    If it doesn’t work, then please open Plugins->PythonScript->Show Console and check if there is an error message. If so, report it back here.

                    J 1 Reply Last reply Jul 31, 2020, 3:26 PM Reply Quote 4
                    • J
                      Jiji M. John @Ekopalypse
                      last edited by Jiji M. John Jul 31, 2020, 3:28 PM Jul 31, 2020, 3:26 PM

                      @Ekopalypse Oh my God, it worked! Never thought it was possible! You are a wizard, man! You’ve saved me hours and hours of labour. Thank you! Thank you!

                      E 1 Reply Last reply Jul 31, 2020, 3:28 PM Reply Quote 2
                      • E
                        Ekopalypse @Jiji M. John
                        last edited by Jul 31, 2020, 3:28 PM

                        @Jiji-M-John

                        It was my pleasure.

                        1 Reply Last reply Reply Quote 3
                        • Colin BC
                          Colin B
                          last edited by Jan 20, 2023, 11:30 PM

                          The transformation between Ultimate-guitar type tab and chord pro is available on this web page. It is a github project

                          https://ultimate.ftes.de << looks like a personal web site.

                          https://github.com/ftes/ultimate-to-chordpro << looks a bit more permanent.

                          Works very well.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors