Giter Club home page Giter Club logo

Comments (6)

bbonczek avatar bbonczek commented on September 10, 2024 1

I'll try with pull request :)

from midi.

appsforartists avatar appsforartists commented on September 10, 2024

Did you look at .encode()? Based on both the README and the unit tests, it looks like that does what you want it to do.

from midi.

bbonczek avatar bbonczek commented on September 10, 2024

It is almost, what I am looking for, but not exactly. encode() method allows me to transform MidiConvert object (that is created for example by using MidiConvert.create()) into midi file that can be started in media player.

What I am missing, is feature, that would allow me to transform json into MidiConvert object (deserialize it in other words).

json_midiobject_midifile_schema

from midi.

appsforartists avatar appsforartists commented on September 10, 2024

Ahhh. I don't see a fromJSON(), but I bet you could open a PR for one.

Or, if something quick and dirty is more your style, maybe something like this?

const midi = new Midi()
const encoded = midi.encode.apply(myJSON);
midi.decode(encoded)

It would roundtrip through the encoder, which is a bit wasteful, but it would get you the object you wanted. Alternatively, I'd copy decode, name it static fromJSON, and modify it to parse a JSON object rather than a string.

from midi.

appsforartists avatar appsforartists commented on September 10, 2024

This can close now.

from midi.

 avatar commented on September 10, 2024

How do i use fromJSON() fx to get the midi file i mean how to get the midi file.
Say for example i put the json as input and call fromjson(myjson) then where is the midi file actually?

from midi.

Related Issues (20)

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.