Skip to content

Instantly share code, notes, and snippets.

@mmuszynski
Created January 30, 2018 20:59
Show Gist options
  • Save mmuszynski/163d0c90e20aa2d18d893e6562b5cebc to your computer and use it in GitHub Desktop.
Save mmuszynski/163d0c90e20aa2d18d893e6562b5cebc to your computer and use it in GitHub Desktop.
let view = MusicStaffView()
let root = MusicPitch(name: .g, accidental: .natural, octave: 3)
let scale = try! MusicScale(root: root, mode: .melodicMinor, direction: .up)
let notes = scale.map { MusicNote(pitch: $0, rhythm: (arc4random() % 2) == 0 ? .quarter : .half) }
view.elements = [MusicClef.treble] + notes + [MusicStaffViewBarLine.final]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment