daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let view = MusicStaffView()
  2.  
  3. let root = MusicPitch(name: .g, accidental: .natural, octave: 3)
  4. let scale = try! MusicScale(root: root, mode: .melodicMinor, direction: .up)
  5. let notes = scale.map { MusicNote(pitch: $0, rhythm: (arc4random() % 2) == 0 ? .quarter : .half) }
  6.  
  7. view.elements = [MusicClef.treble] + notes + [MusicStaffViewBarLine.final]
RAW Paste Data
Top