Giter Club home page Giter Club logo

charttools's People

Contributors

theboxybear avatar thenathannator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

charttools's Issues

Switch from duplicate checks on collection update to on IO (except for notes)

Replace UniqueList, UniqueListEquatable and UniqueTrackObjectCollection with List<>. This would allow track objects to have their position changed without creating new instances and heavily improve performance on collection edits.

To check for duplicates when reading and writing files, I added the DuplicateTrackObjectPolicy property to ReadingConfiguration and WritingConfiguration. If the policy if set to IncludeAll, no duplicate checks are made. Otherwise, only include the first object or throw an exception depending on the policy.

As for the exception type, it would just be Exception for now until I can think of something better (potentially a custom exception?)

Once done, apply ObsoleteAttribute to UniqueList, UniqueListEquatable and UniqueTrackObjectCollection

Create a model for animation tracks

Animation events drive the musician models in games with a 3D background. Since they are shared between instrument variants, they should be stored outside of instruments, on the same level as Song.

Rework removing of uneeded tempo markers to account for anchors.

Create an overload which takes a resolution and does more complex logic to find tick positions for anchors before finding which tempo markers to remove. If the existing method without a resolution is called with a collection containing anchors, throw an exception pointing to the right overload.

Implement field

Once added to C#, review parameters with a backing field and replace the field with the "field" keyword. Unless additional processing is made, replace getters and setters with the auto equivalent.

Add FormattingRules

Parsing and serializing of MIDI is strongly tied with the contents of the ini file. In order to resolve this and make sure both are done correctly according to the ini, a new class would be created to store these rules defined by the charter and specific to the song.

To do:

Unify .NET 5 and .NET 6 code for merging

In order to support .NET 5 and 6, code should be unified to work with both framework so that it can be merged without issues.

  • Despite .NET 6 allowing for a simplified namespace declaration, the old syntax should still be used
  • Do not remove using directives, as some are needed in .NET 5 but not 6
  • FirstOrDefault and Min/MaxBy in Extensions.cs should be kept and marked with the NET preprocessor directive as to only be compiled if running .NET 5

Group animations and instruments

In order to avoid property bloat in the Song class, instruments would be grouped in a InstrumentSet class and animations in AnimationSet. They are to be one of each as properties in the Song class, both gettable and settable.

Add vocals as an instrument

In order to broaden compatibility with Rock Band and Guitar Hero, vocals will be added as an instrument.

The Phrase class will be modified to become a chord and Syllable to be a note.

Question about this library for parsing chart files

Hello!

I stumbled upon this library as I had an idea for creating a tool to convert CloneHero charts into xLights sequences.

I had planned on parsing the chart files with javascript. But when I saw your library, it appears way more robust than anything I would have built.

I am not familiar with .NET code, but I suspect I wouldnt need to write a lot of it given that it seems like a lot of the processing legwork is done with this library. But maybe I am mistaken?

Initially, as a proof of concept, I would like to convert a set of notes (eg. Guitar) into XML (readable by xlights) that looks like something like this:

    <Element type="model" name="Key 1">
      <EffectLayer>
        <Effect ref="0" name="On" startTime="0" endTime="1000" palette="Green"/>
    </Element>
    <Element type="model" name="Key 2">
      <EffectLayer>
        <Effect ref="0" name="On" startTime="1000" endTime="2000" palette="Red"/>
    </Element>

(In the example output provided above, assume the provided CloneHero Chart would have a guitar green note at zero seconds, red note at 1 second, each lasting 1 second).

So my question. Is there a particular function or class within this library that would give me access to some of these values that could generate an XML output similar to what is show above?

Thank you in advance for any information or help you might be able to provide!

Rework chart reading and thread handling

The new way of reading and parsing chart would involve the main thread reading lines from the file and has it encounters a part header, creates a parser object running on a separate thread. As lines are read, they are added to a buffer inside the parser until the end of the part is encountered, at which point it stops adding to the buffer, waits for the next part and creates a new parser. There would be different parser classes for the various types of objects to parse and the right type would be chosen based on the name of the part. For the track parser, it would store the difficulty and instrument it is for.

After reading the file, the main thread would await all the parsers it created and add their results to the song object. This approach offers several advantages:

  • Faster execution from the reading happening simultaneously with the parsing
  • Less concurrent memory usage as the file is never in memory in its entirety
  • Smaller impact on the threadpool from less concurrent threads. Threads are only created for the parts that are present and only when the part is encountered, likely after previous parts are done being parsed.

Missing IO overloads

All classes with FromFile or ToFile methods should have one with a configuration parameter and another without which uses the default as specified in the parser class (ie ChartParser.DefaultReadConfig)

Performance enchantements for parsing and chords

As discussed with mdsitton, several improvements to parsing could be implemented to reduce execution time.

One of the slowdowns comes from the use of a custom FirstOrDefault to find the parent chord of a note or tempo marker for an anchor. Replacing it with binary search would be significally faster than regular enumeration but requires the track objects be in order of position. Clone Hero handles this by giving an error if not in order but in order to respect ChartTool's mission of flexibility with any data for the sake of fixing, it would still need to be able to parse files with out of order track objects. A middle ground would be a property in the configuration to indicate wether to use the fast parse with binary search or slow parse that accepts out of order track objects. A potential third option would try to parse with binary search and if it fails because of out of order track objects, automatically tries again using the slow method.

Another source of slowdowns comes from UniqueTrackObjectCollection which enumerates through all its items in the search of duplicate positions every time an item is added. The eventual fix would be the retirement of such class in favor of the built-in generic list. In order to compensate for the removal of the safety net created by UniqueTrackObjectCollection, the DuplicateTrackObjectPolicy from configuration would be expanded to be used by tracks when reading and writing files.

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.