Git Product home page Git Product logo

kamshory / midicreator Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 2.0 3.51 MB

MIDI Creator is a web-based application that can convert sound into MIDI, both sound from files and sound from a microphone directly. MIDI Creator periodically samples the sound, analyzes the frequency, then creates a MIDI notation according to the frequency, volume and duration for that note.

HTML 0.25% CSS 24.23% SCSS 20.37% JavaScript 36.14% Less 19.01%
midi midi-composer midi-files music-composer sound-to-midi midi-creator mp3-to-midi sound-to-midi-converter wav-to-midi audio-to-midi

midicreator's Introduction

MIDI Creator

MIDI Creator is a web-based application that can convert sound into MIDI, both sound from files and sound from a microphone directly. MIDI Creator periodically samples the sound, analyzes the frequency, then creates a MIDI notation according to the frequency, volume and duration for that note.

The resulting MIDI is a single channel MIDI. This MIDI can be imported by the DAW application to become a tone pattern which is then combined with other patterns to become a song.

MIDI Creator is very helpful for composers who do not have the ability to play melodic instruments in making notes.

let options = {};
let mc = new MidiCreator(options);

Constructor Parameters

type object

properties

  1. name: tempo
    type: number
    default value: 130
    description: Tempo or beat per minute

  2. name: ppqn
    type: number
    default value: 96
    description: Pulses per quarter note

  3. name: maxTempo
    type: number
    default value: 720
    description: Maximum tempo (for realtime converting only)

  4. name: channel
    type: number
    default value: 0
    description: Channel number to used

  5. name: pitchMin
    type: number
    default value: 20
    description: Minimum frequency to be process

  6. name: pitchMax
    type: number
    default value: 20000
    description: Maximum frequency to be process

  7. name: thresholdRms
    type: number
    default value: 0.01
    description: Threshold RMS

  8. name: thresholdAmplitude
    type: number
    default value: 0.2
    description: Threshold amplitude

  9. name: resolution
    type: number
    default value: 32
    description: Resolution (note per quarter note or note per bar)

  10. name: sampleRate
    type: number
    default value: 32000
    description: Sample rate (sample per second)

  11. name: minSample
    type: number
    default value: 500
    description: Minimum sampe fo analize frequancy and amplitude

/** 
 * Process local file
 * 
 * @param {File} file Selected file from emelemnt <input type="file">
 */ 
function processLocalFile(file) 
{
    let mc = new MidiCreator({tempo:75, maxTempo:720, resolution:32, sampleRate:32000, channel:3});
    mc.loadLocalAudioFile(file, function(float32Array){
        mc.soundToNote();
        // true to get raw MIDI data (binary)
        let midiData = mc.createMidi(false);
        window.open('data:audio/midi;base64,'+midiData);
    });
}

/** 
 * Process remote file
 * 
 * @param {String} path Remote path. Application will load the file using AJAX request
 */ 
function processRemoteFile(path)
{
    let mc = new MidiCreator({tempo:75, maxTempo:720, resolution:32, sampleRate:32000, channel:3});
    mc.loadRemoteAudioFile(path, function(float32Array){
        mc.soundToNote();
        // true to get raw MIDI data (binary)
        let midiData = mc.createMidi(false);
        window.open('data:audio/midi;base64,'+midiData);
    });
}

MIDI data can be uploaded to server or downloaded as a file.

Demo

https://planetbiru.com/apps/midi-creator/

midicreator's People

Contributors

kamshory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.