Last active
February 9, 2017 01:04
-
-
Save ashwin153/d86292dbfc346b48d7e8f9e79db463fd to your computer and use it in GitHub Desktop.
Example song built using swara-music.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Key._ | |
import Phrase._ | |
import Pitch._ | |
// C Major Chord. | |
val cmaj = Set( | |
Note(Pitch(C, 4), volume = 0.60), | |
Note(Pitch(E, 4), volume = 0.50), | |
Note(Pitch(G, 4), volume = 0.45) | |
) | |
// C Major 7 Chord. | |
val cmaj7 = cmaj :+ Note(Pitch(B, 3), volume = 0.50) | |
// G Major 7 Chord. | |
val gmaj = Set( | |
Note(Pitch(G, 4), volume = 0.60), | |
Note(Pitch(B, 4), volume = 0.50), | |
Note(Pitch(D, 5), volume = 0.45) | |
) | |
// G Major 7 Chord. | |
val gmaj7 = gmaj :+ Note(Pitch(F, 3), volume = 0.50) | |
// Piano Phrase. | |
val piano = Phrase( | |
program = GrandPiano, | |
voices = Set( | |
Voice(Seq( | |
Chord(cmaj, Length(1, 4)), | |
Chord(gmaj, Length(1, 2)), | |
Chord(cmaj, Length(1, 4)))), | |
Voice(Seq( | |
Chord(cmaj7, Length(1, 4)), | |
Chord(gmaj7, Length(1, 4)), | |
Chord(cmaj7, Length(1, 16)), | |
Chord(gmaj7, Length(1, 16)), | |
Chord(cmaj7, Length(1, 16)), | |
Chord(gmaj7, Length(1, 16)))), | |
) | |
) | |
// Guitar Phrase. | |
val guitar = new Phrase( | |
program = AcousticGuitar, | |
voices = Set( | |
Voice(Seq( | |
Chord(cmaj, Length(1, 8)), | |
Chord(gmaj7, Length(1, 8)), | |
Chord(gmaj7, Length(3, 4)))) | |
) | |
) | |
// Song Fragment. | |
val fragment = Fragment( | |
key = GMajor, | |
tempo = Tempo(signature = Length(4, 4), bpm = 120.0), | |
phrases = Map(0 -> piano, 1 -> guitar) | |
) | |
// Song. | |
val song = Song(Seq(fragment)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment