News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Dtab V1.04 - Work In Progress (DRUM TAB EDITOR)

Started by kevin, July 24, 2014, 02:07:03 AM

Previous topic - Next topic

kevin



 Dtab V1.04 - Work In Progress

        We're been quiet on the DTAB front for a while now, although there's been a Beta releases that address some minor issues but the main package hasn't been updated for a over a year.     It's hard to believe it, but DTAB is approaching it's 15th birthday.  Yes... Dtab started it's life way back in 1999.   It was the the first Drum Tab Editing software that was automated and included playback support.   Which is something we're particularly proud of !  

        Anyway all nostalgia aside, the focus for Dtab V1.04  is to further round out some of the additions from the V1.03 as well as including any fixes and tweaks.    One of the additions is the Drum Tab Importer some time ago was script pre-processing.

        DTAB includes it's own scripting language called DTAB Script.  The script is a very simple BASIC like language.  DTAB users can write import helper scripts in DTAB script that will pre-process a HTML file that has been downloaded from an a drum tab site.   This is particular handy, as some drum tab sites remove the song title/band & tabber information  from the drum tab, and wedge that into the page title or some stylized panel on the page.   Using script you can write a decoder that pulls this information out of the page and returns it to DTAB.  

        In previous editions of the DTAB, user script code couldn't return the actual drum tab body from the page.  This has been addressed in V1.04.   This means that user code now grab not only the song & tabber information (if it's in the html) but it can grab staff lines drum tab body also.    

         Here's an example of a script that decodes Drum Tab pages on the http://www.ultimate-guitar.com/ site.    What happens is DTAB downloads the URL you give it.  IF DTAB contains a decoder script for that URL, it loads and executes the script.   The script is passed some key variablkes about the page, such as it's URL, the PAGETITLE and the RAW HTML..   The script then grabs the basic info about the track from the title and then scans the raw html for the body.   On this particular site, there's multiple PRE tag areas so it just grabs the largest chunk and assumes that is the drum tab.



; ---------------------------------------------------------------------
; [DTAB SCRIPT]--------------------------------------------------------
; ---------------------------------------------------------------------
;  Global INPUT Script Variables
; ---------------------------------------------------------------------
;    PageURL = The full URL of this page
;    RawPage = THe entire document
;  PageTitle = The Title string from the page

; ---------------------------------------------------------------------
;  Script (Info) RETURN Variables
; ---------------------------------------------------------------------
;     SongName = The name of the song (TEXT)
;   ArtistName = The artist/band name (TEXT)
;   TabberName = The name of the tabber (TEXT)
;      DrumTab = The Drum Body  (TEXT)
;DrumTabStatus = Status Flag, did this script find the tab body ?

var StartPos,EndPos,AtPos,TabbedByStart,TabbedByEnd,Tag
   
       ;---------------------------------------------------------------------------------------
       ;-------------------------------------------- -------------------------------------------
       If (InStr(PageTitle,"Ultimate-Guitar.Com",1)>0)
       ;---------------------------------------------------------------------------------------
       ;-------------------------------------------- -------------------------------------------

           Tag = "drum tab by"

           EndPos = InStr( PageTitle, Tag,1)

           If (EndPos>0)
               EndPos = EndPos - 1
               StartPos = 1
               SongName = Trim(Mid(PageTitle, StartPos, EndPos - StartPos))
               Print( "Song:" + SongName)

       AtPos = InStr( PageTitle,"@",1)
if (AtPos>EndPOs)
             StartPos = EndPos + Len(Tag)+1
              ArtistName = Mid(PageTitle, StartPos, AtPos - StartPos)
              ArtistName = Trim(ArtistName)
                      Print( "Artist:" + ArtistName)

endif

           EndIf

; ---------------------------------------------------------------------
; -[ GRAB TAB BODY ]---------------------------------------------------
; ---------------------------------------------------------------------

           Var lp,SearchPos,PreTagStart,PreTagEnd,PreTagSize
           Var PreTagText

   SearchPos =1
   PreTagStart=1
   PreTagEnd=0
   PreTagText=""


  ;    print("_______________________________GET DRUM TAB________________________")

   Tag="<pre>"
   for lp=0 to 3

          SearchPos=instr(WebPage,tag,SearchPos)

  if (SearchPos>0)


PreTagSTart =SearchPos
                       PreTagEnd =instr(WebPage,"</pre>",SearchPos)
if (PreTagEnd>PreTagStart)

PreTagSTart+=Len(Tag)

PreTagSize=PreTagEnd-PreTagStart

                       if (PreTagSize>10)
if (PreTagSize > len(PreTagText) )
PreTagText = Mid(WebPage, PreTagSTart, PreTagEnd - PreTagSTart)
endif

                      endif

SearchPos=PreTagEnd

else
SearchPos=SearchPos+1
endif

  else
lp=10000
  endif
           next

   ; Check the size
   if (Len(PreTagText)>10)

; strip leading tags
Tag="</i>"
                       SearchPos =instr(PreTagText,tag,1)
if (SearchPos>0)
SearchPos+=Len(tag)
PreTagText = Mid(PreTagText, SearchPos, Len(PreTagText) - SearchPos)
endif

DrumTABStatus=1
DrumTAB=PreTagText
   endif

endif

done:

print("End of Program")



kevin

#1


 Dtab V1.04 - Import Tab - Right Click Menu

       One of the big hurdles in developing any software is discovering how the user base actually use the software.   One example that comes to mind, is that DTAB largely assumes the user has some previous experience with text editors such as NotePad or WordPad.   In particular the common CUT/PASTE control keyboard controls such as CTRL-C  to copy something and CTRL-V pastes what was copied.   Now since these short cuts and largely universal between applications right across the Windows platform, we therefore make the assumption the user base is familiar with them also.   But apparently not according to one email, who'd never heard of them..        

       So to help such users out we've added a right click dialog to the Import Tab window, which was the dialog that they'd been struggling to operate.  Admittedly that particular dialog is very sparse, which is was intentional since it's not necessarily meant to be complete text editing kit, rather just a text view of the dialog that the drum tab importer is attempting to parse.    None the less we've added a few right click menu operations that hopefully users are familiar with, such as Cut / Copy / Paste / Select ALL and an Import Tab option.


       Anyway, bellow we're a bit of screen shot of the control as it stands ( Drum Lessons In Drum Tab ).  Will mostly likely add a few other things to the dialog also..  



kevin

#2


 Dtab V1.04  Beta 3 / 4  -  Import Drum Tab  gets  Search / Replace - Strip HTML & Undo  

       Most of the work in this update has been focusing on the import Drum Tab window and the users edit controls.  The dialog already supports classic windows standard keyboard interface for CUT (CTRL-X) / PASTE (CTRL-V) & COPY (CTRL-C) but it was missing a right click menu with those features, which have already been added.

       One of the newer features added to Import Drum Tab page is the right click dialog/menu on the import drum tab page is a strip HTML option.  This is required as if you download a web page and DTAB doesn't have a decoder for this site, then DTAB will try and find the PRE tag blocks in the HTML for you, if it finds a block it just shows you the biggest one on the page.  The assumption being the Drum TAB will be the biggest.     But this is not always the case.  Prior to V1.04 , Dtab would not return the RAW html back to the user, so you'd get nothing when  this occurs.    Now it gives you an option to show the page as raw html if you want.   Of course the raw HTml view of the web page these days isn't just some data, these days pages have reams of client side script code in them.   So being able to do a quick strip on the page will certain help thrown away the unwanted code in the page.  

       While on the subject drum tab sites,  something that users should to be aware of is that some of the bigger tab sites are actually wrappers.  That is, they don't actually store the drum tab on their site at all, rather they effectively show you a framed version of another sites page with their controls on top.   If you cut'n'paste those links into DTAB, you'll be downloading the frame html and not the drum tab as you might expecting.   So it won't be able to decode those links for you.  

        Some other work in progress features would be addition is the Search / Replace Dialog and the UNDO feature in the import drum tab page.    The replace stuff is and working so UNDO is the current focus, at,  it's about 80% working at this time.   There's a few keys it doesn't recording correctly, but hopefully they'll get smoothed out later today.   What this does is make the import tab page more like your average notepad styled text editor.     Got a few more ideas for custom features for this page, but they have might have to be held over until next update.
     
     

kevin

#3


  Dtab V1.04  Beta 5  -  Import Drum Tab  UNDO - Import Drum Tab Site Decoders

       The Undo feature in the Import Tab form ended up taking a few sessions to set up and get testing, but it seems to be working well now.  There may well be some combination's it doesn't capture.  The  Undo cache on the import tab form  has fixed size (last 256 actions),so the structure can't grow exponentially large and bring the edit speed to it's knees.    

       Also been working on some more import scripts for the remote downloader.   For those that are not aware,  DTAB can download and decode the drum tab from the html for you.   The decoders in older editions of DTAB are fairly trivial, but they're very useful when grabbing some of the extra information, that some drum tab sites keep on the tabs that's outside of the of the tab body.   Often stuff like the song and artists names are stored in the page titles for example.   Without the DTAB Script they'd be missed.  

       With DTAB V1.04, we'd boosted the DTAB script support, allowing for more complex processing to be performing in the script completely transparent to the end user.

        For example, the following DTAB SCRIPT example uses a few replace tricks to clean up the imported tab body.   The code grabs the Drum Tab body, strips out some html that appears into,  replaces the staff lines headers and make sure line feeds are windows friendly.    It could go further, but even with that little processing we get some something that we can now import without having to do it all by hand..




; ---------------------------------------------------------------------
; [DTAB SCRIPT V1.04]--------------------------------------------------
; ---------------------------------------------------------------------
;  Global INPUT Script Variables
; ---------------------------------------------------------------------
;    PageURL = The full URL of this page
;    WebPage = THe entire document
;  PageTitle = The Title string from the page

; ---------------------------------------------------------------------
;  Script (Info) RETURN Variables
; ---------------------------------------------------------------------
;     SongName = The name of the song (TEXT)
;   ArtistName = The artist/band name (TEXT)
;   TabberName = The name of the tabber (TEXT)
;      DrumTab = The Drum Body  (TEXT)
;DrumTabStatus = Status Flag, did this script find the tab body ?
; ---------------------------------------------------------------------
; ---------------------------------------------------------------------
; ---------------------------------------------------------------------

var Pos,Tag,HTML

       ;---------------------------------------------------------------------------------------
       ; This script just applies a bit of pre-processing to the page
       ;-------------------------------------------- -------------------------------------------
; http://allysia.tripod.com/tabs.html
       ;-------------------------------------------- -------------------------------------------
       If (InStr(PageURL,"allysia.tripod.com/tabs.html",1)>0)
       ;---------------------------------------------------------------------------------------
       ;-------------------------------------------- -------------------------------------------

   print("allysia.tripod.com/tabs.html")

           Tag = "<!-- // -->"

           Pos = InStr( WebPage, Tag,1)

           If (Pos>0)

; CUT THE HTML JUNK from top of page
Pos+=Len(tag)+1

HTML =right(WebPage,len(webpage)-Pos)

; strip some bogus HTML tags from the page body
HTML=replace(html,"<p>","")
HTML=replace(html,"</p>","")
HTML=replace(html,"<hr>","")

var lp,STAFFLINES,STAFF,NEWSTAFF

STAFFLINES ="C H RdS B F t T "

for lp=1 to len(STAFFLINES)-1
STAFF=mid(Stafflines,lp,2)
NEWSTAFF =STAFF +"|"
STAFF =STAFF +"-"
HTML=replaceB(HTML,STAFF,NEWSTAFF)
lp+=1
next


; Check if we need to insert line feeds
Tag=Chr(13)+chr(10)
        Pos = InStr( Html, Tag,1)
if (pos<1)
HTML=replace(html,chr(10),Tag)
endif


; cut this at the center tag at the bottom
pos=InStr( Html, "<center>",1)
      if (pos>0)
HTML=left(html,pos-1)
endif



if (len(Html)>100)
DrumTab =HTML
DrumTabStatus =1
endif
           EndIf

endif


done:

print("End of Program")



 

 

kevin

  Dtab V1.04  Beta 8/9  -  Documentation Updates

    This update is finally getting back on track after having to be put on hold, I'm current working my way through adding documentation to the package about the DTAB script feature that's hidden away in the Drum Tab downloader feature.   The scripting just lets us pre-process the the incoming raw HTML before showing it to the user.  For those with a bit BASIC programming knowledge you should be able to write you own scripts for other sites using the tutorial/overview link bellow.  

    If you do write your own scripts make sure you share then with others !

   DTAB Script Tutorial/Language Overview



kevin

#5
Dtab V1.04  Beta 10  -  Import Drum Tab Auto Numeric Tom remapping

  Whenever you look at the lot of hand written Drum Tabs, you inventively run across variations that fall outside of DTAB's default importing behaviors.  One such idea, is the condensed Tom mappings you see in the odd drum tab.    In these tabs, the tom instruments are represented on a single instrument line. So rather than the regular o   styled note heads you might be familiar with, these are replaced with a numeric value from 1 to 9.  These values represent the pitch of the tom.  1 being the highest pitch (smallest tom) through to the lowest (biggest tom).   Normally to import these, we'd have to rewrite those fragments.  Which depending upon the song, might represent a bit of work.  

  So in today's build of DTAB, we've added an automatic remapping service to the importer.   What this service does, is after the song structure is imported into DTAB,  the remapper scans the TOM instrument lines looking for these numeric note heads.   If it find some, these notes are remapped for you.   Since DTAB supports 6 tom lines only, any numeric values above 6 will be ignored.


    Input Example:



  1 + 2 + 3 + 4 +  1 + 2 + 3 + 4 +  
H |x-x-x-x-x-x-x-x-|----------------|
T |----------------|1-2-3-4-5-6-----|
S |----o-------o---|----------------|
B |o-o-----o-o-----|----------------|



  Exported Result:


   Song: [Untitled]
   Artist: [Unknown]
   Timing: 4/4
    Tempo: 120
     Date: 9/16/2014


        #1                 #2

   Hh:| x-x-x-x-x-x-x-x- | ---------------- |
 Tom1:| ---------------- | o--------------- |
 Tom2:| ---------------- | --o------------- |
 Tom3:| ---------------- | ----o----------- |
 Tom4:| ---------------- | ------o--------- |
  SnD:| ----o-------o--- | ---------------- |
 FlT1:| ---------------- | --------o------- |
 FlT2:| ---------------- | ----------o----- |
  BD1:| o-o-----o-o----- | ---------------- |




  The DTAB output is pretty standard drum tab wise, I don't really have a preference either way.   In some songs Numeric toms lines would help compress the output text, but we basically lose what little Dynamic information drum tab gives us about how the note is played.  



kevin

#6
  Dtab V1.04  Beta 10 Cont -  More Domain Importer Scripts

      Been adding some more domain importer scripts to the DTAB importer window.  The scripts are used to decode the link that you either paste into the import window or through the WEB/FETCH dialog on the importer page.    Recent scripts add support for importing drum tabs directly from these web sites tabsbest.combecktabs.net /  guitartabs.cc  & guitaretab.com.