Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Arkham/elm-chords
Parse chords sheets for guitar and ukulele in Elm
https://github.com/Arkham/elm-chords
chord-diagram chords elm guitar hacktoberfest music
Last synced: 2 months ago
JSON representation
Parse chords sheets for guitar and ukulele in Elm
- Host: GitHub
- URL: https://github.com/Arkham/elm-chords
- Owner: Arkham
- License: bsd-3-clause
- Created: 2019-01-15T10:16:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T21:15:03.000Z (almost 4 years ago)
- Last Synced: 2024-08-05T20:31:47.497Z (6 months ago)
- Topics: chord-diagram, chords, elm, guitar, hacktoberfest, music
- Language: Elm
- Homepage: https://package.elm-lang.org/packages/Arkham/elm-chords/latest
- Size: 72.3 KB
- Stars: 42
- Watchers: 6
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elm Chords [![Build Status](https://travis-ci.com/Arkham/elm-chords.svg?branch=master)](https://travis-ci.com/Arkham/elm-chords)
Parse chords sheets for guitar and ukulele in Elm!
## Installation
`elm install Arkham/elm-chords`
## Example
Here's an example of what you could do:
```elm
import Html exposing (Html)
import Chords exposing (Chord, Voicing)
import Chords.Chart
import Instruments.Guitar as Guitarchords : 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 chordErr 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 first
```This 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!## Tests
Pull the repo and run `elm-test`