Skip to main content
Topic: Nwctxt to Harmonica Tab (Read 2781 times) previous topic - next topic

Nwctxt to Harmonica Tab

Among other things, I am a diatonic harmonica player.  While I read music without any problem, most harmonica (in the vernacular, usually called ‘harp’) players do not.  But many do read a more or less customary harp tab.  I have written a small Python program (attached) that extracts note position from an nwctxt file and converts it to harp tab.

The way it works is you start with an NWC2 file with a single staff of single melody notes in the key of C.  Export the file to <tmp.nwctxt> and run the conversion program.  This produces the file <tab.txt> that consists of a single line of text containing the harp tab.  This text can be used as is if you know the melody, but it is best copied and inserted into the original NWC2 file as a lyric line.  Being in the key of C is not as restrictive as it sounds.  The diatonic harmonica can be treated as a transposing instrument, and a player typically changes keys by changing harps.  The tab remains the same for all keys.  (For harp players only: This is a 1st position discussion.)

Now, I would be surprised if more than three people on this forum would find this program useful.  The intent of posting it is not necessarily to provide something useful.  Rather, this is intended to provide a small example of the sort of thing that can be done now that Eric has made nwctxt available.  THANK YOU ERIC!  And it is also wonderful that you allow the first character in a lyric word to be a hyphen, as opposed to treating it as a separator.  That turned out to be a stroke of good fortune for me.

I am not a Python programmer, so if my programming style offends a real Python programmer, ‘scuse me…  :-) The program has not been exhaustively tested, but works correctly for a number of cases that I have tried.  And if you don’t like Python, I also have versions in Perl, Ruby, and Lua… I am evaluating some of the scripting programs to determine what to use for a more ambitious project that I have in mind.  But that is for a future discussion.

Re: Nwctxt to Harmonica Tab

Reply #1
I don't play the harmonica, but my career was as a programmer and have manipulated NWC data from clipboards before nwctxt came along.  One suggestion if I may is to examine the nwctxt files before and after you insert your output as lyric text.  Your program, instead of just creating a text file you (or a user) would have to insert back into the lyrics, would create a new nwctxt file.  In this simple scale:
Code: [Select · Download]
NoteWorthyComposer(2.0)
|SongInfo|Title:""|Author:"<Name>"|Lyricist:""|Copyright1:"Copyright ⌐ 2007 <Name>"|Copyright2:"All Rights Reserved"
|AddStaff|Name:"Staff"
|Lyrics|Placement:Bottom|Align:Standard Rules|Offset:0
|Lyric1|Text:"Do re mi fa so la ti do\r\n"
|Clef|Type:Treble
|TimeSig|Signature:Common
|Note|Dur:4th|Pos:-6
|Note|Dur:4th|Pos:-5
|Note|Dur:4th|Pos:-4
|Note|Dur:4th|Pos:-3
|Bar
|Note|Dur:4th|Pos:-2
|Note|Dur:4th|Pos:-1
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:1
!NoteWorthyComposer-End
the lyrics would be inserted just after the "AddStaff" command line.  Those two lines were missing before lyrics were added.

HTH
Since 1998

Re: Nwctxt to Harmonica Tab

Reply #2
Thanks Warren... I had considered doing that, and it is a good suggestion.  It would be simple to accomplish.