FSharp.ChordParser icon indicating copy to clipboard operation
FSharp.ChordParser copied to clipboard

Parses and transposes a chord chart.

FSharp.ChordParser

I created this for my dad to allow him to transpose chords and change lyrics to uppercase (and it was also a great opportunity for me to learn FParsec).

UI

UI created with Avalonia.FuncUI.

image

let cmp () = Component (fun ctx ->
    let model, dispatch = ctx.useElmish (init, update)
    
    Grid.create [
        Grid.rowDefinitions "20, *"
        Grid.columnDefinitions "*, 80, *"
        Grid.margin 10
        
        Grid.children [
            // Row labels
            TextBlock.create [
                TextBlock.text "Input Chord Chart"
                TextBlock.horizontalAlignment HorizontalAlignment.Center
                Grid.column 0
            ]
            TextBlock.create [
                TextBlock.text "Output Chord Chart"
                TextBlock.horizontalAlignment HorizontalAlignment.Center
                Grid.column 2
            ]

            // Input Chord Chart
            TextBox.create [
                TextBox.text model.InputChordChart
                TextBox.onTextChanged (fun txt -> dispatch (SetInputChart txt))
                Grid.column 0
                Grid.row 1
            ]

Console

CLI created with FSharp.SystemCommandLine

To try it out against the sample txt file (Song.txt), just run the app; it will output "Song ChordParser.txt".

image