We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › Use midi file in promidi
Page Index Toggle Pages: 1
Use midi file in promidi (Read 664 times)
Use midi file in promidi
Jun 9th, 2008, 5:13pm
 
Hi,

I would like to use a midi file in promidi but it's impossible. So I use the javax.sound.midi. But the sequencer in this one and promidi are not the same and I can't change the first to the second.

Is there a new version of promidi that can do this operation or another method to use midi files?

Thank you for help
Matthieu
Re: Use midi file in promidi
Reply #1 - Jun 11th, 2008, 11:59pm
 
Quote:
But the sequencer in this one and promidi are not the same and I can't change the first to the second.


I don't get it : what are you trying to do exactly?

Can you give us some code, or some more explanations?
Re: Use midi file in promidi
Reply #2 - Jun 12th, 2008, 3:09pm
 
Thank you for you answer but I was on a wrong way.
Now to resolve my problem by changing the promidi library in a library that can read midi file. I'will give some news. Thanks
Re: Use midi file in promidi
Reply #3 - Jun 13th, 2008, 5:25pm
 
I had modify promidi like this :

I create a MidiSystem class

Code:

package promidi;

import java.io.File;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;

public class MidiSystem {
   private Sequence seq;
 
 
   public MidiSystem(){  
   }
   
   public Sequence getSequence(File file){
       try {
          seq  = javax.sound.midi.MidiSystem.getSequence(file);//the problem
       } catch (InvalidMidiDataException ex) {
       } catch (IOException ex) {
       }
       return seq;
   }
}

A sequence class

package promidi;

public class Sequence{
   public Sequence(){    
   }
}

and I add a method setSequence to the Sequencer class

public void setSequence(Sequence sequence){
this.sequence = sequence;

}

I have a compilation problem with the seq variable that is of type promidi.Sequence and the right component that is javax.sound.midi.Sequence.
How can made the transformation?
Page Index Toggle Pages: 1