The MusicalEvent Type
This is the base trait and highest level type for all musical events.
There are two main subtypes of MusicalEvent:
AtomicMusicalEvent- a single event that can be playedSequence- a sequence of events that can be played in order
sealed trait MusicalEvent:
enum AtomicMusicalEvent(duration: Duration, velocity: Velocity) extends MusicalEvent
final case class Sequence(head: AtomicMusicalEvent, tail: MusicalEvent) extends MusicalEvent
Types of AtomicMusicalEvents
Note- a single noteRest- a pause in the musicDrumStroke- a single drum strokeHarmony- a chord or notes in the same voice played at the same time