Tgo1014 / Khord

A utility library to help handling lyrics with chords

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Khord

A utility library to help handling lyrics with chords

Usage

Finding chords

val lyric = "C            G#         G\n" +
            "Smoke on the water, and fire in the sky\n" +
            "C            G#   E G A  E G B A  E G A  G E  2x\n" +
            "Smoke on the water"
val chordsList = Khord.find(lyric)
println(chordsList.map { it.chord }.distinct()) // [C, G#, G, E, A, B]

Finding chord info

val lyric = "C            G#\n" +
            "Smoke on the water\n"
val chordsList = Khord.find(lyric)
println(chordsList) // [Chord(chord=C, startIndex=0, endIndex=1), Chord(chord=G#, startIndex=13, endIndex=15)]

Transposing chords

val lyric = "C            G#\n" +
            "Smoke on the water\n"
val chordsList = Khord.transposeText(lyric, ChordRoot.Bb, ChordRoot.C)
println(chordsList) 
// D            Bb
//Smoke on the water

Adding to your porject

1 - Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
      ...
      maven { url 'https://jitpack.io' }
      ...
  }
}

2 - Add the dependency:

dependencies {
  ...
  implementation "com.github.Tgo1014:Khord:${lastRelease}"
  ...
}

About

A utility library to help handling lyrics with chords

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Kotlin 100.0%