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.
    • PeterJonesP
      PeterJones @Jiji M. John
      last edited by PeterJones

      @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
      • Jiji M. JohnJ
        Jiji M. John
        last edited by

        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?

        PeterJonesP 1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Jiji M. John
          last edited by PeterJones

          @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.

          Jiji M. JohnJ 1 Reply Last reply Reply Quote 1
          • Jiji M. JohnJ
            Jiji M. John @PeterJones
            last edited by

            @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?)

            EkopalypseE 1 Reply Last reply Reply Quote 0
            • EkopalypseE
              Ekopalypse @Jiji M. John
              last edited by

              @Jiji-M-John

              Maybe this does what you want.

              Jiji M. JohnJ 1 Reply Last reply Reply Quote 3
              • Jiji M. JohnJ
                Jiji M. John @Ekopalypse
                last edited by

                @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.

                EkopalypseE 1 Reply Last reply Reply Quote 0
                • EkopalypseE
                  Ekopalypse @Jiji M. John
                  last edited by Ekopalypse

                  @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.

                  Jiji M. JohnJ 1 Reply Last reply Reply Quote 4
                  • Jiji M. JohnJ
                    Jiji M. John @Ekopalypse
                    last edited by Jiji M. John

                    @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!

                    EkopalypseE 1 Reply Last reply Reply Quote 2
                    • EkopalypseE
                      Ekopalypse @Jiji M. John
                      last edited by

                      @Jiji-M-John

                      It was my pleasure.

                      1 Reply Last reply Reply Quote 3
                      • Colin BC
                        Colin B
                        last edited by

                        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