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.
Page Index Toggle Pages: 1
looping midi (Read 1158 times)
looping midi
Oct 15th, 2006, 10:50pm
 
Ok, I've been tearing my hair out on this one for long enough, so I need some help. I'm trying to create a looping midi sequence that can dynamically be modified. I want to use a sequencer rather than generating the notes myself, for good timing. I've tried generating the notes myself using the Java short-range timing mechanisms, but it's just not accurate enough.

I originally tried using the new ProMidi 2.0 since it now includes a sequencer, but for some reason I get no audio output. I'm using a MacIntel. Who knows, maybe it's that, but I just can't get any output. The bouncing balls demo gives me errors or nothing, and the sequencer demo is silent as well. I tried rewriting it from scratch following the sequencer logic from the Java Midi documentation, but no luck either. I assume it's some MidiOut problem.

I then tried writing directly in Java using the javax.sound.midi.* libraries, which gives me audio (yeah!) but won't let me loop (ugh!). Apparently Java 1.5.0 added looping, but 1.4.2 doesn't have sequencer looping. If I use the internal 1.4.2 loop markers, I can get it to loop, but then I can't dynamically change the data. And if I try to change the data on-the-fly, it means having two sequencer instances and switching between them, which gives a noticeable delay.

I should also note that want this to run in a browser for pretty much everyone, i.e. avoiding any complicated plug-ins or updaters.

I see two possibilities for help/advice:

1) someone can help me get ProMidi working (at least reassure me that the sequencer does work on other machines)

2) someone can explain to me how I can use Java 1.5 functions from javax.sound.midi.* within Processing.

Any takers?
Re: looping midi
Reply #1 - Oct 16th, 2006, 8:26pm
 
You should be able to do this with promidi library.
You can loop a so-called song, and use addEvent() and removeEvent() to change a track in the sequence as its playing.

But you said you were getting no sound.. Are you trying to control external synths or a softsynth?  What is your midi interface?  What platform are you using?

Re: looping midi
Reply #2 - Oct 17th, 2006, 12:04am
 
As for the looping in ProMidi, thanks for the good news. That's what I figured, looking at the Java classes behind it. I looked over all the classes over at Sun and everything looks like the way I need it. But still no sound at all, even in the easy examples.

I want to use Softsynth, no midi interfaces, so I'm calling the Java synthesizer (= 0). I'll deal with external synths later, once I've mastered the internal synth.

So I did a couple tests: I've tested on Mac PowerPC (400 Mhz), and Mac Intel (2Ghz). Neither one gives me sound from ProMidi.

But I get sound when I call midi directly from Java, both direct notes going out, and through the Java sequencer: I can make a Sequence and the Sequencer outputs fine: ring ding ding. The problem there is of course looping, and all the other things that ProMidi apparently knows how to do.

I'm new to Java, so I don't know how to tame all the 1.4.2 vs. 1.5 crap (I'm still reeling on how they can call it 5.0). So the problem is probably there as well. But whatever the case, I'd prefer using ProMidi instead of my own sauce, because the classes look well built and I'd like to write-up a how-to for my students that they can easily use, which wouldn't be the case if I went directly into Java.

Oh, and I don't have anything fancy installed, like Plumstone. I don't want to use it yet, because I want people online to click and let 'er rip -- no plugins. Maybe I have to install Plumstone? It doesn't say so in the install files, so I haven't installed it yet. That would be bad news if I had to. But that doesn't make sense to me anyway, since I get midi out fine through the Java Synth when I bypass ProMidi.
Page Index Toggle Pages: 1