music-suite / music-score

This repo has been merged into: https://github.com/music-suite/music-suite
http://music-suite.github.io
BSD 3-Clause "New" or "Revised" License
52 stars 10 forks source link

Automatic beaming #223

Closed hanshoglund closed 9 years ago

hanshoglund commented 10 years ago

Some backends (notably musicxml2) does not automatically replace flags with beams for eight notes and below. An algorithm to generate beams would look something like

import Music.Score.Rhythm

class Beamable a where
    beginBeam :: True -> a -> a
    endBeam :: True -> a -> a

addBeams :: Beamable a => TimeSignature -> Rhythm a -> Rhythm a
addBeams = ...

For example

>>> addBeams (2/4) (Group [Beat (1/8) c,Beat (1/8) d,Beat (1/4) e])
addBeams (2/4) (Group [beginBeam $ Beat (1/8) c, endBeam $ Beat (1/8) d, Beat (1/4) e])

It is probably a good idea to start implementing the most common time signatures (2/4, 3/4, 6/8, 4/4 etc) and add the more uncommon cases later.

hanshoglund commented 9 years ago

324 related. Close for now.