Coder Social home page Coder Social logo

phprtmidi's Introduction

PhpRtMidi

Php library for realtime MIDI input/output, thanks to RtMidi and FFI.

Requirements

  • Php >=7.4 (for FFI support)
  • RtMidi v6 library compiled on your system.

Installation

composer require bviguier/php-rtmidi

On MacOS, you can install RtMidi globally thanks to brew.

brew install rtmidi

⚠️ In Linux, package registries often provide librtmidi.so.4 which is the version 3! To compile it manualy:

Features

  • Send midi messages (including system exclusive)
  • Receive midi messages (including system exclusive)
  • Create virtual input or output

Usage

If the RtMidi is not globally available on your system, you have to provide its path. By default, PhpRtMidi try to load the library by its standard name, but the name may depend on your OS or your build. You can also use LIB_RTMIDI_PATH environment variable to provide the path to the library.

This library doesn't match exactly original RtMidi interfaces, but try to expose a straightforward developer experience.

$browser = new \bviguier\RtMidi\MidiBrowser();

$input = $browser->openInput('My Input');
$output = $browser->openOutput('My Output');

echo "Midi thru enabled, use Ctr-C to exit…\n";
while (true) {
    if ($msg = $input->pullMessage()) {
        $output->send($msg);
    }
    usleep(100);
}

Check examples directory to have a better overview of its usage.

phprtmidi's People

Contributors

b-viguier avatar t-geindre avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

t-geindre

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.