Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred

Ui.Meter.Meter

Description

Types to describe meters.

A meter ruler divides up a block analogous to a staff notation meter. It's actually more general, since the meter just says how to divide up a single measure, and only at one level, while the ruler has arbitrary divisions. However, in practice, it's convenient to use a similar organization to staff notation's meter. So by convention the ranks are for section, measure, half note, etc., and Cmd.TimeStep uses abbreviated mnemonics of these durations for the various ruler ranks it can snap to.

However, rank r_2, which corresponds to TimeStep's h, doesn't necessarily correspond to a half note. It actually corresponds to the division below the measure, which in 3+3/8 is a dotted quarter. In the case of 2/4 it would be a quarter note, but to keep the mnemonic names from getting too far from their staff notation counterparts, the 2/4 meter should skip a rank so that r_1 and r_2 both correspond to the same amount of time.

Synopsis

Documentation

data Meter Source #

Duration is of one AbstractMeter, so total duration will be count*dur.

Constructors

Meter 

Instances

Instances details
Monoid Meter Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

mempty :: Meter #

mappend :: Meter -> Meter -> Meter #

mconcat :: [Meter] -> Meter #

Semigroup Meter Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

(<>) :: Meter -> Meter -> Meter #

sconcat :: NonEmpty Meter -> Meter #

stimes :: Integral b => b -> Meter -> Meter #

Show Meter Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

showsPrec :: Int -> Meter -> ShowS #

show :: Meter -> String #

showList :: [Meter] -> ShowS #

Eq Meter Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

(==) :: Meter -> Meter -> Bool #

(/=) :: Meter -> Meter -> Bool #

Pretty.Pretty Meter Source # 
Instance details

Defined in Ui.Meter.Meter

Serialize Meter Source # 
Instance details

Defined in Cmd.Serialize

data MSection Source #

Constructors

MSection 

Fields

Instances

Instances details
Show MSection Source # 
Instance details

Defined in Ui.Meter.Meter

Eq MSection Source # 
Instance details

Defined in Ui.Meter.Meter

Pretty.Pretty MSection Source # 
Instance details

Defined in Ui.Meter.Meter

Serialize MSection Source # 
Instance details

Defined in Cmd.Serialize

sections_drop :: TrackTime -> [MSection] -> [MSection] Source #

Trimming the AbstractMeter from the start will change the labels, but that's probably desired everywhere except a pickup.

type Duration = TrackTime Source #

Duration between ruler marks. Since these are added together, there is a risk of accumulating innaccuracy. I could use rationals if I changed PosMark to rational, but for the moment it's more convenient to stay as TrackTime, and convert to rationals before adding, assuming that TrackTime has enough resolution to figure out what the rational should be.

TODO If I get more inaccuracy problems I should probably just switch to rational, but it's a bit of a pain because Ruler.Marklist and its callers have to change. Also, I'm not even sure if it's a good idea, because TrackTime is still floating point, so there will still be rounding in there somewhere, and this would just put it in more places.

time_to_duration :: TrackTime -> Duration Source #

TODO it's id for now, but maybe I'll want to make it Rational at some point?

data Config Source #

Constructors

Config 

Fields

Instances

Instances details
Generics.Generic Config Source # 
Instance details

Defined in Ui.Meter.Meter

Associated Types

type Generics.Rep Config :: Type -> Type #

Show Config Source # 
Instance details

Defined in Ui.Meter.Meter

Eq Config Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

Pretty.Pretty Config Source # 
Instance details

Defined in Ui.Meter.Meter

Serialize Config Source # 
Instance details

Defined in Cmd.Serialize

type Generics.Rep Config Source # 
Instance details

Defined in Ui.Meter.Meter

data Rank Source #

Constructors

Section 
W 
H 
Q 
E 
S 
T32 
T64 
T128 
T256 

Instances

Instances details
Bounded Rank Source # 
Instance details

Defined in Ui.Meter.Meter

Enum Rank Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

succ :: Rank -> Rank #

pred :: Rank -> Rank #

toEnum :: Int -> Rank #

fromEnum :: Rank -> Int #

enumFrom :: Rank -> [Rank] #

enumFromThen :: Rank -> Rank -> [Rank] #

enumFromTo :: Rank -> Rank -> [Rank] #

enumFromThenTo :: Rank -> Rank -> Rank -> [Rank] #

Show Rank Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

showsPrec :: Int -> Rank -> ShowS #

show :: Rank -> String #

showList :: [Rank] -> ShowS #

Eq Rank Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

(==) :: Rank -> Rank -> Bool #

(/=) :: Rank -> Rank -> Bool #

Ord Rank Source # 
Instance details

Defined in Ui.Meter.Meter

Methods

compare :: Rank -> Rank -> Ordering #

(<) :: Rank -> Rank -> Bool #

(<=) :: Rank -> Rank -> Bool #

(>) :: Rank -> Rank -> Bool #

(>=) :: Rank -> Rank -> Bool #

max :: Rank -> Rank -> Rank #

min :: Rank -> Rank -> Rank #

ShowVal Rank Source # 
Instance details

Defined in Derive.Typecheck

Methods

show_val :: Rank -> Text Source #

Typecheck Rank Source # 
Instance details

Defined in Derive.Typecheck

Pretty.Pretty Rank Source # 
Instance details

Defined in Ui.Meter.Meter

Serialize Rank Source # 
Instance details

Defined in Cmd.Serialize

rank_names :: [(Rank, Text)] Source #

These are mnemonics for staff notation durations, though they may not correspond exactly, as documented in Cmd.Meter.

data LabelConfig Source #

Constructors

BigNumber Int 
Cycle [Label] 

Instances

Instances details
Show LabelConfig Source # 
Instance details

Defined in Ui.Meter.Meter

Eq LabelConfig Source # 
Instance details

Defined in Ui.Meter.Meter

Pretty.Pretty LabelConfig Source # 
Instance details

Defined in Ui.Meter.Meter

Serialize LabelConfig Source # 
Instance details

Defined in Cmd.Serialize

AbstractMeter

data AbstractMeter Source #

An AbstractMeter is a structured description of how a unit of time is broken up into hiererchical sections. A T represents a mark with the unit duration, and a D is a group of Meters. The rank of each mark is determined by its nesting depth.

Previously a T could take a duration, but I didn't wind up using that feature, so I removed it. So meters have to be built of multiples of a unit duration multiplied by some stretch factor.

An AbstractMeter can be created either by declaring it outright, or by declaring a simpler AbstractMeter and subdividing or repeating it.

Constructors

T 
D [AbstractMeter] 

subdivide :: Int -> AbstractMeter -> AbstractMeter Source #

Subdivide each mark into the given number Ds. This has the effect of putting one layer of subdivision under the current structure.

repeat :: Int -> AbstractMeter -> AbstractMeter Source #

Create a layer that repeats the given meter a certain number of times.

regular_subdivision :: [Int] -> AbstractMeter Source #

Form a meter based on regular subdivision. E.g. [4, 4] is 4 groups of 4, [3, 3] is like 9/8, and [4, 3] is 4 groups of 3 (12/8).