Code Monkey home page Code Monkey logo

purescript-abc-scores's People

Contributors

newlandsvalley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hkailahi

purescript-abc-scores's Issues

Handle the final (empty) bar in each stave

The Abc parser now leaves an empty bar at the end of each stage. This is necessary because there is only a starting bar line defined in each bar. We need to get hold of the barline in this final bar which may have an end-repeat instruction and somehow coalesce it into the penultimate bar, or perhaps display an empty VexFlow barstave to do this.

Triplets don't always beam properly in 4/4

Noticeable if there are two quavers followed by the triplet - all 5 notes are beamed together. It would be clearer if they were separated, and is almost certainly caused by the beatsPerBeam parameter being set at 2 rather than 1 (which gives a more nartural beaming when triplets are absent).

Beaming is non-existent in 3/2

3/2 is a strange time signature - because the beat is every half note which will usually not attract a beam across the entire beat. Perhaps the best compromise is to nominate a beam group of 1/4 - so at least eighth notes will be beamed together as quarter notes.

Fill out each stave to the max permitted width

I've decided that each stave will be of the same length, possibly truncated if we try to fit in too many bars. This is OK because the module is for use in an editor and the user will simply move the overhanging stuff to a new stave line if necessary. This then should make it look nicer when we support individual bar staves of variable width.

Thread the AbcContext properly though individual bars

AbcContext should only be used to thread the context through the translation and should not be used as a parameter to any of the VexFlow API methods that generate a score. This is because it tends to be an 'old' value that us used. Instead, copy the relevant state information to the output of the translation (usually BarSpec) and use this instead. This should ensure that the properly updated version is always used.

Add a function to align the staves at the RHS

My idea (roughly) is:

  • Find the widest stave (ignore the stave bar that just extends the bar line to the desired width)
  • Work out the percentage increase required to 'grow' smaller staves to this max width
  • For all staves where the width is at least (70% ??) of this width, increase the width of each individual stave bar by this percentage.
  • Possibly set the width of the final stave bar so that the total width is max (to avoid rounding errors)

Provide limited support for slurs

These should be supportable if they are entirely intra-bar. There will be a big problem supporting them across bars or even across staves. This is because abc-scores is built entirely around engraving the score of each bar individually. Whilst VexFlow supports slurs spanning bars with an interface that allows you to specify the beginning and end notes from each bar, this approach is extremely awkward here because, by the time you process the notes from the second bar, the notes from the first are no longer in the stack frame.

Add option to reconfigure the canvas based on a justified score size

abc-scores is designed for use within an editor application, where the score is gradually growing. In such an environment, you obviously don't know how big the score is going to grow and so you must use a large enough canvas to accommodate any score.

However, if you right-justify the score, it is likely that you are approaching the finished result. It thus makes sense to add a function that recalculates the canvas configuration based on the dimensions of the justified score. If the user then continues to edit, the editor can go back to the original configuration.

Support ties

These look straightforward when fully contained within a bar but I'm not sure how to provide a tie between bars. (Each bar is given its own staveBar).

Voltas are not always ended properly

A Volta second repeat should end when it hits a double bar line. This happens if the double bar is the last bar but not if it occurs earlier in the stave.

We need to specifiy the beam stem directions

At the moment, all stem directions lie above the note head, irrespective of the position of the notes in the bar. Not too sure why this is as the VexFlow tutorials indicate that this is calculated automatically in VexFlow.

2nd repeat volta is not ended properly

It just displays a horizontal line (mid -volta) and not the line terminated with a small vertical stroke (end volta). i.e. we need to recognise the end-volta state properly when we are shifting the bar ends forward when processing a completed stave.

Handle headers introduced by BodyInfo correctly

i.e. a BodyPart that just consists of an isolated header change. In some cases, these are given an entire stave but should be merged into the next score line. In other cases, they are ignored completely.

Amend the auto-beaming interface to JavaScript

Auto-beaming is OK but a little too crude. We need to customise it further by doing more analysis of the beam groups in the PureScript layer. Currently there is just a single beam group, calculated from the number of beats per beam and the duration of each beat (i.e. the denominator of the time signature). These are passed separately to the JavaScript layer.

As a start, we need to add beamGroups to MusicSpec and, to begin with, calculate a single beam group in the same way, and then use this to calculate auto-beaming. And then we can remove time signature and beats per beam from the JavaScript interface.

Make the Score.js dryer

There are separate methods for engraving a bar according to whether or not the bar contains tuplets. These should be coalesced into a single function.

Quadruplets don't beam properly in 6/8

I'd really like to rely on VexFlow's auto-beaming throughout but this doesn't beam quadruplets properly - joining only 3 of the 4 notes. Presumably it's taking it's instruction from the 6.

Improve the auto-beaming alalysis

On the whole, auto-beaming in VexFlow works like this. You designate one or more 'beam groups' to the bar where a beam group is defined as a fraction of the bar where notes that occupy that fraction are to be beamed together. If you only designate a single beam group, then it is applied to all patterns of notes that inhabit the bar. Otherwise, as far as I can tell, you cycle through the groups until all notes are matched.

By and large, you want a beam group to correspond to a beat. This means you can calculate a single beam group very simply just from the time signature. So, for example, if you have a 9/8 time signature, each beat will occupy a 3/8 fraction; if you have a 2/4 time signature, each beat will occupy 1/4 and so on. For this reason, we use an algorithm that is (almost) entirely based on time signature as illustrated above.

However, very many bars have complexities. For example, in a reel or hornpipe (notated in 4/4) it is conventional to beam the notes for two beats together - i.e. the fraction is 2/4 or 1/2. But some bars if analysed more carefully would benefit from a compound group of (say) (1/4, 1/4, 1/2). Other complications arise when tuplets are present.

Would it be possible to come up with a good algorithm, cheap to compute, which improves on the basic default?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.