Giter Site home page Giter Site logo

Comments (2)

kshoji avatar kshoji commented on June 12, 2024

Yes. This library can play MIDI files.
This library includes javax.sound.midi porting library.
There is a MidiSystem.getSequencer() method, to get a MIDI sequencer instance.
The sequencer can play SMF files on the app's asset, or on the external directory.

Regards,
Kaoru

from usb-midi-driver.

billyjoker avatar billyjoker commented on June 12, 2024

Hi kshoji i've got send midi out as i wanted, it works fine, but i have another 2 issues:

1- When i open and play a midi file it does not perform any sound. I've verified all this steps:

  • No exception handling the midi file.

  • Previously i've got play the midi file with winamp and with a DAW.

  • I've placed soundbank.gm to directory C:\Program Files\Java\jdk1.7.0_45\lib\audio and C:\Program Files (x86)\Java\jre1.8.0_66\lib\audio

  • MidiSystem.getSynthesizer() returns null (i do not know if it is something related with this...)

  • I've got play it successfully with MediaPlayer class

  • My code:

     private Sequencer openMidiFile()
     {
       try {
        Sequencer mSeqr = MidiSystem.getSequencer();
    
        InputStream in = getAssets().open(MIDI_FILE);
        Sequence mSeq = MidiSystem.getSequence(in);
    
        mSeqr.open();
        mSeqr.setSequence(mSeq);
        mSeqr.start(); //it is supposed this execution will perform the play of the file
    
        return mSeqr;
    } catch (MidiUnavailableException e) {
        e.printStackTrace();
    } catch (InvalidMidiDataException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    
    return null;
    }
    

2- Second issue: i0ve implemented a timertask to catch the midievents from the sequencer, but it seems that it is not 100% accurated, i'm using 1ms period, What's the best way to achieve this?

Thanks and happy new year!!

from usb-midi-driver.

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.