Jump to content

Practice your guitar chords


Achilles
 Share

Recommended Posts

5) I don't really see why you would want everything selected when you press stop.. ?

couldnt figure out a nice way to make double click behave when re-expanding, behavior I saw:

1) selected some chords,

2) hit start

3) hit stop

4) re-expand

-----at this point the only items responding to double click were the items in the previous selection.

by selecting all again this fixed the double click behavior......... not at all clean, but effective.

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Ugly code but functional face.

I am still trying to interact a little nicer with the shockwave object: but as for now it, blocksinput - searches for the bright red progress bar of an active video - clicks on it (thus activating the youtube toolbar) - sends {space} to pause the video - hides the window - puts the mouse back where it was - unblocksinput.

bugs/comments

-- .stop() and .stopplay() have no effect on youtube goodness, or at least not in the manners I have tried, is this normal?

-- If you select the same video that is already playing, it shrinks that video to the upper 90, can I stop this behavior?

.ScaleMode = 3 - the video is not affected by re-selection

-- selecting no items in the listview will have the same effect as selecting all items

-- double right click on an item starts a video of the corresponding chord

#include <Array.au3>
#include <EditConstants.au3>
#include <File.au3>
#Include <GuiListView.au3>
#include <StaticConstants.au3>
#include <Math.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


    Global $Object = ObjCreate("SAPI.SpVoice")
    Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.10")
    Global $vid
    Global $flash = 'a'

;~ splashimageon ("" , ".\spot.jpg" , @desktopwidth , @desktopheight, -1, -1, 3)
tooltip ("Expand to customize selection." & @LF & "Select Start to drill all chords." , @desktopwidth / 2, @desktopheight / 2, "WELCOME" , 1 , 6)

Opt('GUIResizeMode', 802) 
Global Const $WIDTH = 200, $HEIGHT = 300, $B = 10 
Global Const $EXTRA_HEIGHT = 150  
$n = 13
Global $chordData[$n][6] = [['A major', '1.2|1.3|1.4', 'xo|||o' , '_Amajor' , '' , 'http://www.youtube.com/v/CfNAcmoS8UQ?fs=1&amp;hl=en_US&autoplay=1&loop=1'] , _ 
['A suspend 2', '1.2|1.3', 'xo||oo' , '_Asus2', '', 'http://www.youtube.com/v/mOEidi1PUSE?fs=1&amp;hl=en_US&autoplay=1&loop=1'] , ['A major 7', '1.2|1.4', 'xo|o|o' , '_Amajor7', '' , "http://www.youtube.com/v/S0qhvmacYdE?fs=1&amp;hl=en_US&autoplay=1&loop=1"], _
['A suspend 4', '1.2|1.3|2.4', 'xo|||o' , '_Asus4', '', 'http://www.youtube.com/v/HZqDnzyCnSc?fs=1&amp;hl=en_US&autoplay=1&loop=1'], ['A minor', '1.2|1.3|0.4', 'xo|||o', '_Aminor', '', 'http://www.youtube.com/v/NV7LfkGTMr8?fs=1&amp;hl=en_US&autoplay=1&loop=1'], _
['B major 7', '1.1|0.2|1.3|1.5', 'x|||o|', '_Bmajor7', '', 'http://www.youtube.com/v/rIsqPSeK5v0?fs=1&amp;hl=en_US&autoplay=1&loop=1'], ['C major', '2.1|1.2|0.4', 'x||o|o' , '_Cmajor', '', 'http://www.youtube.com/v/WM1bAz2GHeo?fs=1&amp;hl=en_US&autoplay=1&loop=1'], _
['C major 7', '2.1|1.2|2.3|0.4', 'x||||o' , '_Cmajor7', '', 'http://www.youtube.com/v/Bv6GrclZmXc?fs=1&amp;hl=en_US&autoplay=1&loop=1'],  ['C minor', '2.0|2.1|2.2|2.3|2.4|2.5|4.2|4.3|3.4', '||||||' , '_Cminor', '', 'http://www.youtube.com/v/uPhDbzJD160?fs=1&amp;hl=en_US&autoplay=1&loop=1'], _
['D major', '1.3|2.4|1.5', 'xxo|||' , '_Dmajor', '', 'http://www.youtube.com/v/IsZ70ZcapKo?fs=1&amp;hl=en_US&autoplay=1&loop=1'],  ['D major 7', '1.3|0.4|1.5', 'xxo|||' , '_Dmajor7', '', 'http://www.youtube.com/v/7vDSA-YXA6Y?fs=1&amp;hl=en_US&autoplay=1&loop=1'], _
['D minor', '1.3|2.4|0.5', 'xxo|||' , '_Dminor', '', 'http://www.youtube.com/v/oIKCR7R8h3A?fs=1&amp;hl=en_US&autoplay=1&loop=1'], ['G major 7', '2.0|1.1|0.5', '||ooo|' , '_Gmajor7', '', 'http://www.youtube.com/v/sMu6mHJQmrM?fs=1&amp;hl=en_US&autoplay=1&loop=1']]
;~ ['B flat minor', '0.0|0.1|0.2|0.3|0.4|0.5|2.2|2.3|1.4', '||||||' , '_Bflatminor', '']  , ['B flat major', '0.0|0.1|0.2|0.3|0.4|0.5|2.2|2.3|2.4', '||||||' , '_Bflatmajor', ''], _ 
;~ ['B major', '1.0|1.1|1.2|1.3|1.4|1.5|3.2|3.3|3.4', '||||||' , '_Bmajor', ''] , _ 
;~ ,  , _ 
;~ ['D suspend 2', '1.3|2.4', 'xxo||o' , '_Dsus2', ''],  ['D suspend 4', '1.3|2.4|3.5', 'xxo|||', '_Dsus4', ''], ['E major', '1.1|1.2|0.3', 'o||||oo' , '_Emajor', ''], _ 
;~ ['E7', '1.1|0.3', 'o|o||oo' , '_Emajor7', ''], ['E minor', '1.1|1.2', 'o||ooo' , '_Eminor', ''], ['E suspend 4', '1.1|1.2|1.3', 'o|||oo' , '_Esus4', ''], _ 
;~ ['F major 7', '2.2|1.3|0.4', 'xx|||o' , '_Fmajor7', ''] ,  ['G major', '2.0|1.1|2.4|2.5', '||oo||' , '_Gmajor', ''], _
;~ ['G major Barre', '2.0|2.1|2.2|2.3|2.4|2.5|4.1|4.2|3.3', '||||||' , '_GmajorBarre', ''] , ['G minor Barre', '2.0|2.1|2.2|2.3|2.4|2.5|4.1|4.2', '||||||' , '_GminorBarre', ''] , _ 
;~ ['G major 7', '2.0|1.1|0.5', '||ooo|' , '_Gmajor7', '', 'http://www.youtube.com/v/sMu6mHJQmrM?fs=1&amp;hl=en_US&autoplay=1&loop=1'],  ['D sharp minor', '2.0|2.1|2.2|2.3|2.4|2.5|4.2|4.3|3.4', '||||||' , '_Dsharpminor', '4'], _
;~ ['D sharp major', '2.0|2.1|2.2|2.3|2.4|2.5|4.2|4.3|4.4', '||||||' , '_Dsharpmajor', '4']]


 
Global $listview = -1 

Global $checkedList[UBound($chordData)]     
For $i = 0 to UBound($chordData) - 1         
    $checkedList[$i] = 1     
Next 

Global $currentIndex = -1 

$gui = GUICreate('Chord Practice', $WIDTH + $B * 2, $HEIGHT + $B * 8) 
$chordPic = '56]' 

Global $xOffset = 5 

$chordName = GUICtrlCreateLabel('', $B * 2, $B * 2.5, $WIDTH - $B * 2, 32, $SS_CENTER)
GUICtrlSetFont(-1, 20)   
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)    
GUICtrlSetFont(-1, 20, 500, -1, 'Tahoma') 

Global $lblStrum[6]

For $i = 0 to UBound($lblStrum) - 1    
$lblStrum[$i] = GUICtrlCreateLabel('', 31 - $xOffset + 30 * $i, 53, 20, 18, BitOR($SS_CENTER, $SS_CENTERIMAGE))        
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)        
GUICtrlSetFont(-1, 16, 500, -1, 'Tahoma')
Next 

$txtInterval = GUICtrlCreateInput('2', $B, $HEIGHT + $B * 2, 40, 20, $ES_NUMBER) 
GUICtrlCreateUpdown($txtInterval)
GUICtrlCreateLabel('Interval (seconds)', $B + 45, $HEIGHT + $B * 2 +3, 90) 
$startStop = GUICtrlCreateButton('Start', $WIDTH - 40, $HEIGHT + $B * 2, 50, 20)
$btnExpand = GUICtrlCreateButton('>>>', $B, $HEIGHT + $B * 5, $WIDTH, 20) 
$expanded = False 

GUISetState() 



While 1     
    GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')
GUISetState()
    Switch GUIGetMsg()        
    Case $GUI_EVENT_CLOSE   
    exit    
Case $startStop    
    
        If GUICtrlRead($startStop) = 'Start' then 
                
            $int = GUICtrlRead($txtInterval)                
            If $int < 1 then                    
                $int = 1                   
                GUICtrlSetData($txtInterval, $int)            
            EndIf               
            AdlibRegister('_ChangeChordPic', $int * 2000)            
         
            GUICtrlSetState($txtInterval, $GUI_DISABLE)         
            GUICtrlSetState($btnExpand, $GUI_DISABLE)     
            _UpdateCheckedList() 
            
            If $expanded then
                _Contract() 
                EndIf
GUICtrlSetData($startStop, 'Stop')
                _ChangeChordPic()  
                            Else             
                AdlibUnRegister('_ChangeChordPic')          
            GUICtrlSetData($startStop, 'Start')        
            GUICtrlSetState($txtInterval, $GUI_ENABLE)        
            GUICtrlSetState($btnExpand, $GUI_ENABLE)    
     For $i = 0 to _GUICtrlListView_GetItemCount($listview) - 1    
        $checkedList[$i] = 1
If $checkedList[$i] = 1 then         
                _GUICtrlListView_SetItemChecked($listview, $i, True)         
            EndIf
            
next
Endif 

    Case $btnExpand 
ToolTip("")         
        If $expanded then     
            _Contract()        
        Else               
            _Expand()         
        EndIf  
        
    EndSwitch
WEnd 

Func _ChangeChordPic() 
    
    
    $string = 0
            For $i = 0 To UBound($checkedlist) - 1
    $string += $checkedlist[$i]
Next
    
    If $string < 1 Then
        For $i = 0 to _GUICtrlListView_GetItemCount($listview) - 1    
        $checkedList[$i] = 1
If $checkedList[$i] = 1 then         
                _GUICtrlListView_SetItemChecked($listview, $i, True) 
        EndIf
        next    
            else
            endif
     
     ToolTip("") 
        
    If $flash <> 'a' and $T = 1 Then
winactivate($flash)
$startpos = MouseGetPos ()


Do
$x = PixelSearch (310 , 320, 527, 640 , 0xE72727, 1 , 1)        
        Until $x <> 0
        blockinput(1)
        MouseMove($x[0], $x[1], 0)
            MouseClick("left")
              send ("{space}")
              MouseMove($startpos[0], $startpos[1], 0)
              blockinput(0)


Global $T = 0
guisetstate(@SW_HIDE)
Else
    sleep (100)
Endif

    
    Local $index = -1    
    Do        
        $index = Random(0, UBound($checkedlist) - 1, 1)   
    Until $index + 1 <> $currentIndex and $checkedList[$index] = 1  
    $currentIndex = $index
    _SetChord()
    $saychord = StringReplace ($chorddata[$index][0], "A" , "eigh" , 0 , 1)
    $saychord1 = StringReplace ($saychord, "flat" , "phlat")
    $Object.Speak($saychord1, 0)
    call ($chorddata[$index][3])
    
    
EndFunc

Func _UpdateCheckedList()  
    For $i = 0 to _GUICtrlListView_GetItemCount($listview) - 1       
        If _GUICtrlListView_GetItemChecked($listview, $i)  then         
            $checkedList[$i] = 1   
        Else            
            $checkedList[$i] = 0       
        EndIf    
    Next
EndFunc 

Func _Contract()  
    GUICtrlSetState($listview, $GUI_HIDE)   
    $pos = WinGetPos($gui)   
    WinMove($gui, '', $pos[0], $pos[1], $pos[2], $pos[3] - $EXTRA_HEIGHT)    
    GUICtrlSetPos($btnExpand, $B, $HEIGHT + $B * 5, $WIDTH, 20)   
    $expanded = False    
    GUICtrlSetData($btnExpand, '>>>')
EndFunc 

Func _Expand()  
    msgbox (0, '' , 'you must select 1 or more items, otherwise program will exit')
    $pos = WinGetPos($gui)  
    WinMove($gui, '', $pos[0], $pos[1], $pos[2], $pos[3] + $EXTRA_HEIGHT)   
    If $listview <> -1 then         
        GUICtrlSetState($listview, $GUI_SHOW)  
    Else      
        $listview = GUICtrlCreateListView('Chord', $B, $HEIGHT + $B * 5, $WIDTH, $EXTRA_HEIGHT)      
        _GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES ))   ;$LVS_EX_ONECLICKACTIVATE
        _GUICtrlListView_SetColumnWidth($listview, 0, $WIDTH - 30)        
        For $i = 0 to UBound($chordData) - 1    
            _GUICtrlListView_AddItem($listview, $chordData[$i][0])      
            If $checkedList[$i] = 1 then         
                _GUICtrlListView_SetItemChecked($listview, $i, True)         
            EndIf      
        Next   
    EndIf    
    GUICtrlSetPos($btnExpand, $B, $HEIGHT + $B * 5 + $EXTRA_HEIGHT + 5, $WIDTH, 20)  
    $expanded = True   
    GUICtrlSetData($btnExpand, '<<<')
    GUICtrlSetState(-1 , $GUI_ENABLE)
EndFunc 

Func _SetChord()  

     GUISwitch ($gui)
    GUICtrlDelete($chordPic) 
    
    $chordPic = GUICtrlCreateGraphic($B, $B, $WIDTH, $HEIGHT)       
    GUICtrlSetBkColor(-1, 0xFFFFFF)      
    GUICtrlSetColor(-1, 0)   
    GUICtrlSetData($chordName, $chordData[$currentIndex][0])    
    $strum = StringSplit($chordData[$currentIndex][2], '')   
    For $i = 0 to UBound($lblStrum) - 1      
        If $strum[$i + 1] = '|' then $strum[$i + 1] = ''      
            GUICtrlSetData($lblStrum[$i], $strum[$i + 1])    
        Next    
        For $i = 1 to 6      
            GUICtrlSetGraphic($chordPic, $GUI_GR_RECT, $i * 30 - $xOffset, 65, 2, 184)   
        Next    
        GUICtrlSetGraphic($chordPic, $GUI_GR_RECT, 30 - $xOffset, 65, 150, 2)  
        For $i = 0 to 5      
            GUICtrlSetGraphic($chordPic, $GUI_GR_RECT, 30 - $xOffset, 72 + $i * 35, 150, 2) 
        Next        
        $pos = StringSplit($chordData[$currentIndex][1], '|')   
        GUICtrlSetGraphic($chordPic, $GUI_GR_COLOR, 0, 0)  
        GUICtrlCreateLabel ( $chorddata[$currentindex][4], 20 - $xOffset, 88, 10, 13 )
    GUICtrlSetBkColor(-1, 0xFFFFFF)      
    GUICtrlSetColor(-1, 0) 
    GUICtrlSetFont (-1 , '' , 600)
        For $i = 0 to UBound($pos) - 2       
            $stringSplit = StringSplit($pos[$i + 1], '.')      
            GUICtrlSetGraphic($chordPic, $GUI_GR_ELLIPSE, ($stringSplit[2] + 1) * 30 - 15, ($stringSplit[1]) * 35 + 63 + 35/2, 22, 22)   
        Next   
        GUICtrlSetGraphic($chordPic, $GUI_GR_REFRESH)
         sleep (200)    
    EndFunc
    
    

    
    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
        
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo , $GUIActiveX
    $hWndListView = $listview
    If Not IsHWnd($listview) Then $hWndListView = GUICtrlGetHandle($listview)
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
            Case $NM_DblClk
                $currentindex = -1
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                        $CurrentIndex =  _GUICtrlListView_GetHotItem ($hWndlistview)
                        If $CurrentIndex   = -1 Then
                        $CurrentIndex = 0
                    Else
                    If _GUICtrlListView_GetItemChecked($hWndlistview, $CurrentIndex) then
                        _GUICtrlListView_SetItemChecked($hWndlistview, $CurrentIndex, False)
                    Else
                        _GUICtrlListView_SetItemChecked($hWndlistview, $CurrentIndex)
                        
                        _setchord()

    EndIf
EndIf

                Case $NM_RCLICK 
                    
                For $i = 0 to _GUICtrlListView_GetItemCount($hWndlistview) - 1   
            If $checkedList[$i] = 1 then         
                _GUICtrlListView_SetItemChecked($listview, $i, False) 
            
        EndIf    
    Next

                    Case $NM_RDBLCLK 
                        
                        
                        GUISetState (@SW_SHOW , $flash)


                        $CurrentIndex =  _GUICtrlListView_GetHotItem ($hWndlistview)
                        
                        If $CurrentIndex   = -1 Then
                        $CurrentIndex = 0
                        Endif
    
                        
                    If IsDeclared ("flash") AND winexists ("Videos" , "") Then
                        
                        
                        
                _setchord()
                
                    GUISwitch ($flash)
                    GUICtrlCreateObj($oRP, -1, -1, $WIDTH + $B * 2, $HEIGHT + $B * 2)
                    
                    With $oRP
                    .bgcolor = "#ffffff"
                    .Movie = $chordData[$currentindex][5]
                    .ScaleMode = 3
                    .Loop = "True"
                    .wmode = "transparent"
                    .FlashVars = ""
                    .Play()
                EndWith
                
                    send ("{SPACE}")
                     Global $T = 1

            Else
                   
                _setchord()

                If $vid = 1 Then   

               GUISetState (@SW_SHOW , $flash)

                Global $flash = GUICreate("Videos", $WIDTH + $B * 2, $HEIGHT + $B * 2, 310, 320, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))
                $vid = GUICtrlCreateObj($oRP, -1, -1, $WIDTH + $B * 2, $HEIGHT + $B * 2)


                 With $oRP
                .bgcolor = "#ffffff"
                .Movie = $chordData[$currentindex][5]
                .ScaleMode = 3
                .Loop = "True"
                .wmode = "transparent"
                .FlashVars = ""
                
            EndWith            
                send ("{SPACE}")
                Global $T = 1
                    
                    Else
                    
                Global $flash = GUICreate("Videos", $WIDTH + $B * 2, $HEIGHT + $B * 2, 310, 320, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))    
                Global $vid = GUICtrlCreateObj($oRP, -1, -1, $WIDTH + $B * 2, $HEIGHT + $B * 2)
                    
                    With $oRP
                .bgcolor = "#ffffff"
                .Movie = $chordData[$currentindex][5]
                .ScaleMode = 3
                .Loop = "True"
                .wmode = "transparent"
                .FlashVars = ""
                .Play()
            EndWith        
                    send ("{SPACE}")
                    Global $T = 1
                    
                endif
                
                
                    
        
Endif
                
            
        
        EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
 
    
Func _Beep($iNote,$iOctave=4,$iDuration=200,$iPause=0)
        Global $nTempo=0.8
Global $iTone=-1
    $iFrequency=440*2^(($iNote+$iTone)/12+$iOctave+1/6-4)
    Beep($iFrequency, $iDuration/$nTempo)
    If $iPause<>0 Then Sleep($iPause/$nTempo)
    EndFunc

Func _Amajor()
_Beep(1,2,300)
_Beep(8,2,300)
_Beep(1,3,300)
_Beep(5,3,300)
_Beep(8,3,300)
Endfunc

Func _Amajor7()
_Beep(1,2,300)
_Beep(8,2,300)
_Beep(11,2,300)
_Beep(5,3,300)
_Beep(8,3,300)
Endfunc

Func _Asus2()
_Beep(1,2,300)
_Beep(8,2,300)
_Beep(1,3,300)
_Beep(3,3,300)
_Beep(8,3,300)
Endfunc

Func _Asus4()
_Beep(1,2,300)
_Beep(8,2,300)
_Beep(1,3,300)
_Beep(7,3,300)
_Beep(8,3,300)
Endfunc

Func _Aminor()
_Beep(1,2,300)
_Beep(8,2,300)
_Beep(1,3,300)
_Beep(4,3,300)
_Beep(8,3,300)
Endfunc

Func _Bflatminor()
_Beep(9,1,300)
_Beep(2,2,300)
_Beep(9,2,300)
_Beep(2,3,300)
_Beep(5,3,300)
_Beep(9,3,300)
Endfunc

Func _Bflatmajor()
_Beep(9,1,300)
_Beep(2,2,300)
_Beep(9,2,300)
_Beep(2,3,300)
_Beep(6,3,300)
_Beep(9,3,300)
Endfunc

Func _Bmajor()
_Beep(10,1,300)
_Beep(3,2,300)
_Beep(10,2,300)
_Beep(3,3,300)
_Beep(7,3,300)
_Beep(9,3,300)
Endfunc

Func _Bmajor7()
_Beep(3,2,300)
_Beep(7,2,300)
_Beep(1,3,300)
_Beep(3,3,300)
_Beep(10,3,300)
Endfunc

Func _Cmajor()
_Beep(4,2,300)
_Beep(8,2,300)
_Beep(11,2,300)
_Beep(4,3,300)
_Beep(8,3,300)
Endfunc

Func _Cmajor7()
_Beep(4,2,300)
_Beep(8,2,300)
_Beep(2,3,300)
_Beep(4,3,300)
_Beep(8,3,300)
Endfunc

Func _Cminor()
_Beep(11,1,300)
_Beep(4,2,300)
_Beep(11,2,300)
_Beep(4,3,300)
_Beep(7,3,300)
_Beep(11,3,300)
Endfunc

Func _Dmajor()
_Beep(6,2,300)
_Beep(1,3,300)
_Beep(6,3,300)
_Beep(10,3,300)
Endfunc

Func _Dmajor7()
_Beep(6,2,300)
_Beep(1,3,300)
_Beep(4,3,300)
_Beep(10,3,300)
Endfunc

Func _Dminor()
_Beep(6,2,300)
_Beep(1,3,300)
_Beep(4,3,300)
_Beep(9,3,300)
Endfunc

Func _Dsus2()
_Beep(6,2,300)
_Beep(1,3,300)
_Beep(6,3,300)
_Beep(8,3,300)
Endfunc

Func _Dsus4()
_Beep(6,2,300)
_Beep(1,3,300)
_Beep(6,3,300)
_Beep(12,3,300)
Endfunc

Func _Emajor()
_Beep(8,1,300)
_Beep(3,2,300)
_Beep(8,2,300)
_Beep(12,2,300)
_Beep(3,3,300)
_Beep(8,3,300)
Endfunc

Func _Emajor7()
_Beep(8,1,300)
_Beep(3,2,300)
_Beep(6,2,300)
_Beep(12,2,300)
_Beep(3,3,300)
_Beep(8,3,300)
Endfunc

Func _Eminor()
_Beep(8,1,300)
_Beep(3,2,300)
_Beep(8,2,300)
_Beep(11,2,300)
_Beep(3,3,300)
_Beep(8,3,300)
Endfunc

Func _Esus4()
_Beep(8,1,300)
_Beep(3,2,300)
_Beep(8,2,300)
_Beep(1,3,300)
_Beep(3,3,300)
_Beep(8,3,300)
Endfunc

Func _Fmajor7()
_Beep(9,2,300)
_Beep(1,3,300)
_Beep(4,3,300)
_Beep(8,3,300)
Endfunc

Func _Gmajor()
_Beep(11,1,300)
_Beep(3,2,300)
_Beep(6,2,300)
_Beep(11,2,300)
_Beep(6,3,300)
_Beep(11,3,300)
Endfunc

Func _Gmajor7()
_Beep(11,1,300)
_Beep(3,2,300)
_Beep(6,2,300)
_Beep(11,2,300)
_Beep(3,3,300)
_Beep(9,3,300)
Endfunc

Func _Dsharpminor()
_Beep(2,2,300)
_Beep(7,2,300)
_Beep(12,2,300)
_Beep(5,3,300)
_Beep(8,3,300)
_Beep(2,4,300)
Endfunc

Func _Dsharpmajor()
_Beep(2,2,300)
_Beep(7,2,300)
_Beep(12,2,300)
_Beep(5,3,300)
_Beep(9,3,300)
_Beep(2,4,300)
Endfunc

Func _GmajorBarre()
_Beep(11,1,300)
_Beep(6,2,300)
_Beep(11,2,300)
_Beep(3,3,300)
_Beep(6,3,300)
_Beep(11,3,300)
Endfunc

Func _GminorBarre()
_Beep(11,1,300)
_Beep(6,2,300)
_Beep(11,2,300)
_Beep(2,3,300)
_Beep(6,3,300)
_Beep(11,3,300)
Endfunc

;A=1
;A#=2
;B=3
;C=4
;C#=5
;D=6
;Eb=7
;E=8
;F=9
;F#=10
;G=11
;G#=12
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • 4 months later...

I showed this to my son, who is taking lessons. He loves it. His only complaint was that his teacher is teaching him several alternative fingerings, that he wants this to include. He asked me if I could add them, but I am not sure how the fingerings are being coded into the array. Can you give a brief explanation of how you are coding the fingerings in the array?

Link to comment
Share on other sites

Each chord is a zero index array. G 7 ... '2.0|1.1|0.5' means:

2.0 = 3rd fret, 6th sting

1.1 = 2nd fret, 5th string

0.5 = 1st fret, 1st string

However there are some mistakes. In the array it gives the name G major 7 which is a different chord than the one displayed. The same applies for A major 7. These chords are dominant chords, and the proper name is G7 and A7. The major 7th is a different species.

G7
  ooo 
|||||•
|•||||
•|||||

G major7
  ooo 
||||||
|•|||•
•|||||

A7
 o o o
||||||
||•|•|
||||||

A major7
 o   o
|||•||
||•|•|
||||||
Edited by czardas
Link to comment
Share on other sites

elements 2 and 3.

element 2 specifies the finger placements in the order they appear, these will replace the pipe characters in order.

0 based from low to high, such that:

0.0 = first fret - first string (low e)

0.5 = first fret - last string (high e)

*in my implementation element 4 would be utilized as a subscript off to the left of the board notating a first fret other than 1 (for chords higher up the neck).

example:

'C major', '2.1|1.2|0.4', 'x||o|o' , '_Cmajor', '', 'http://www.youtube.com/v/WM1bAz2GHeo?fs=1&amp;hl=en_US&autoplay=1&loop=1'

first string is not played so it gets an x at the top board

second and third are replaced by low c and middle e

fourth is an open string (G) so it gets an o at the top of the board

Fifth is replaced by middle c

and the 6th string is open (E)

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

0 based from low to high, such that:

0.0 = first fret - first string (low e)

0.5 = first fret - 6th string (high e)

The bass is always refered to as the 6th string.

I just checked the other chords with the name major 7. The only one that is correct is F major 7. The others: C, D and B (NOT major) 7 are all dominant chords. E7 has been named correctly.

Edited by czardas
Link to comment
Share on other sites

Indeed those are incorrect, might have been my doing as I was trying to make Microsoft SAM say things properly. I might even opt for triad/type notation if he is just learning, as I probably could have saved craploads of time learning properly first.

While we are nitpicking the first fret is never referred to as 0.

It will get awful confusing awful quickly with 0 based guitar structures, which is why its noted in the parentheses. I changed it to reflect 'last' string, that ones not taken is it? :x

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

The following chord names are correct:

G7
  ooo 
|||||•
|•||||
•|||||

Gmajor7
  ooo 
||||||
|•|||•
•|||||

  A7
xo o o
||||||
||•|•|
||||||

Amajor7
xo   o
|||•||
||•|•|
||||||

  C7
x    o
||||•|
||•|||
|•|•||

Cmajor7
x  ooo
||||||
||•|||
|•||||

  D7
xxo
||||•|
|||•|•
||||||

Dmajor7
xxo
||||||
|||•••
||||||

  E7
o o oo
|||•||
|•||||
||||||

Emajor7
o   oo
||••||
|•||||
||||||

  F7

•|•|••
|||•||
|•||||

Fmajor7
xx   o
||||•|
|||•||
||•|||

  B7
x   o
||•|||
|•|•|•
||||||

Bmajor7
x
||||||
|•|||•
|||•||
||•|•|

Yeah there's quite a lot of confusion with everything being back to front. However it makes things easier to set the open strings as being fret 0. Then frets one, two etc will all be given by the same array index. :x

EDIT

Sorry for nitpicking. Apart from the above, I think the chord diagram graphics are excellent.

Edited by czardas
Link to comment
Share on other sites

Thank you. Not being a guitar player myself, it takes a little to get my mind around it.

I have a son on guitar, and a daughter on violin. I played sax in a jazz band in Middle School, but dropped it and went with vocals after that.

Strings are still a bit of a mystery for me.

Link to comment
Share on other sites

I removed lines 36 & 213 and the script seems to still work fine. Tell me what happens on your end please.

I also added a few guitar chords because I like that way of inputting chords! I got these from http://www.chordbook.com/guitarchords.php because it has been years since I last played guitar.

['Am7', '0.4|1.2', 'xo|o|o'],['A6', '1.2|1.3|1.4|1.5', 'xo||||'],['A11', '1.4', 'xooo|o'],['Am11', '0.4', 'xooo|o']
Edited by jaberwocky6669
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...