Parse chords sheets for guitar and ukulele in Elm!
elm install Arkham/elm-chords
Here's an example of what you could do:
import Html exposing (Html) import Chords exposing (Chord, Voicing) import Chords.Chart import Instruments.Guitar as Guitar chords : List String chords = [ "Am" , "E" , "C" , "Dm7" , "G" , "F" , "A#" , "C#" ] view : Html msg view = Html.div [] (chords |> List.map (\name -> ( name, Chords.parseChord name ) ) |> List.map (\( name, result ) -> case result of Ok chord -> viewChord chord Err err -> Html.span [] [ Html.text ("Could not parse " ++ name) ] ) ) viewChord : Chord -> Html msg viewChord chord = let config = { tuning = Guitar.defaultTuning , numFrets = 10 } name = Chords.toString chord in case Guitar.voicings config chord of [] -> Html.span [] [ Html.text ("Could not find voicing for chord " ++ name) ] first :: rest -> Chords.Chart.view name firstThis will parse the chords, generate some voicings and display the charts. You should see something like this!
If you'd like to use Ukulele instead, import Instruments.Ukulele and use it in the same way!
Pull the repo and run elm-test
