Editing lyrics and chords text files
-
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.
-
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).
-
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?
-
@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.
-
@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?)
-
Maybe this does what you want.
-
@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.
-
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.
-
@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!
-
It was my pleasure.
-
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.