Git Product home page Git Product logo

itwriter's Introduction

Create Impulse Tracker .it files from a JSON song datastructure.

See the browser demo here and the node demo in the install section below.

Install

npm i itwriter

Run the node example:

cp node_modules/itwriter/example.js .
node example.js
xmp example.it

Use

Basic usage: const bytebuffer = itwriter(song_structure)

More detailed usage:

import itwriter from "itwriter";

// create a 10ms sinewave sample
const sine = [...(new Array(4410))].map((v, i) => Math.sin(i/10));

const it = itwriter({
  "title": "example",
  "bpm": 120,
  "samples": [{
    "name": "sine wave",
    "samplerate": 44100,
    "channels": [sine]
  }],
  "patterns": [{
    "rows": 32,
    "channels": [{
      0: {
        "note": "C-5",
        "instrument": 0,
        "vol": "v64",
      }
    }]
  }],
  "order": [0],
});

// in Node we can write to disk
import fs from "fs";
fs.writeFileSync("example.it", Buffer.from(it));

// in the browser we can download a blob
document.location.href = URL.createObjectURL(new File([it], "example.it"));

See ./example.js for a detailed example of the JSON song structure.

Notes

  • Currently only patterns and 16-bit mono/stereo samples are supported, not instruments.

Technical references used

itwriter's People

Contributors

chr15m avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

itwriter's Issues

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.