Giter Club home page Giter Club logo

midiparser's Introduction

PHP MIDI Parser

Build Status

Licensed under WTFPL

Installation

Requirements

  • PHP >= 5.3.0

Usage

If you clone the repository, you can run ant sample to run the sample script at ./sample/test.php, which will generate an HTML report.

The following snippet is an example of how to generate a plaintext report.

require_once 'vendor/autoload.php';

use Tmont\Midi\Parsing\FileParser;
use Tmont\Midi\Reporting\TextFormatter;
use Tmont\Midi\Reporting\Printer;

//create a new file parser
$parser = new FileParser();

//replace this path with the path to an actual MIDI file
$parser->load('/path/to/midi/file.mid');

//create a Printer object
$printer = new Printer(new TextFormatter(), $parser);

//output the parse result
$printer->printAll();

Parser Usage

If you want more control over the data, you can use the parser directly. See the print notes sample script for an example of how to do this.

Development

# install dependencies
composer install

# run tests
vendor/bin/phpunit

midiparser's People

Contributors

tmont avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

midiparser's Issues

Parsing / Editing / Writing

Does this parser let me write a file back out? I didn't see an example anywhere of writing the data out to a destination file.

Issue with Time Signature

Hi !
For some reason you transform the denominator of time signature to it's log2 value
But when you compute the user friendly time signature you don't revert the denominator correctly, you compute pow($logDenominator, 2) instead of pow(2, $logDenominator)

// Constructor
parent::__construct(array($numerator, log($denominator, 2), $metronomePulse, $thirtySecondNotesPerQuarterNote));

// Time signature computation
public static function getTimeSignature($numerator, $logarithmicDenominator) {
	return $numerator . '/' . pow($logarithmicDenominator, 2);
}

image

autoload file path

Hi,
I am not getting the file path of autoload.php
require_once dirname(dirname(FILE)) . '/vendor/autoload.php';

Documented examples only show how to use the Reporting, not the MIDI

Hello

I'm in need of a midi parsing lib for PHP. Unfortunately the examples only show how to use the Reporting libs. I really can not read through the Formatter AND Printer code just to figure out how to actually get a list of tracks and notes.

Could you please extend your documentation or examples to show the workflow for only the \Tmont\Midi\Parsing* classes, not involving any of the Printing or Reporting?

Thank you a bunch!

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.