Javax.sound.midi: Processing MIDI events

Hello,
I've been wondering if there is any way to process MIDI events without using
a Sequencer, for example to take information of the file without play-back?
greets

Cool... Thanks! That was really simple to fix... wish
I would have known that before...You're welcome. You may need to find a good MIDI reference via google (or scroogle if you're a commie) to supplement the info in Sun's documentation.

Similar Messages

  • Author       "javax.sound.midi.InvalidMidiDataException: cannot get soundbank from stream" after java update

    Not sure where to post this issue.
    I am noticing this error since I did the Mac update. The Mac update included the java update. Right now the java version is 1.6.0_31. My Mac OS X version is 10.7.3. I am seeing the problem for all the soundfont files that I am trying to load. The error i get is.
    javax.sound.midi.InvalidMidiDataException: cannot get soundbank from stream
         at javax.sound.midi.MidiSystem.getSoundbank(MidiSystem.java:565)
         at myPackage.MyMusicApp.main(MyMusicApp.java:14)
    Below is a small program I built that shows the code.
    package myPackage;
    import java.io.File;
    import javax.sound.midi.*;
    public class MyMusicApp {
        public static void main(String[] args) {
            try {
                Synthesizer synth = MidiSystem.getSynthesizer(); synth.open();
                File f =  new File("/Users/poorav/eclipseGIT/myApp/soundbanks/1247_KitDRY.sf2");
                Soundbank soundbank = MidiSystem.getSoundbank( f);
                synth.loadAllInstruments(soundbank);
            } catch (Exception e)
                e.printStackTrace();
    I am not sure what the previous build of java I was on, but i know that it was a 1.6 version. Any ideas of what could have caused this?
    thanks

    No satisfactory progress!
    I submitted a bug for this using the Apple bug reporter on 9th April (#11208868) and despite asking for an update, it has been completely ignored (even now). I'm not impressed.
    I then issued a (paid for) Developer Technical Support issue which was credited back to my account a few days later with no explanation. When I asked why, I eventually got: "At this time DTS does not provide code-level support for Java"!
    So, Apple are assuming to responsibility for this problem. I realise that Oracle is mostly responsible for Java but Apple took this crippled version (how much testing did they do?) and updated our customers' machines with it. This has effectively disabled a key feature of our product and has cost us damage to our company's reputation. Still Apple don't care and they rely on the fact that we are too small to sue them. You can see I'm not happy! I naively thought Apple would make some attempt to assist their developers.

  • Javax.sound.midi and external synths?

    Since I don't have a USB-to-MIDI adapter (and I lost my MIDI cables long ago), I gotta just ask: if I had an external MIDI device connected to my computer, would javax.sound.midi.getMidiDeviceInfo() theoretically return a MidiDevice object describing it? Or is javax.sound.midi really just for the computer's own music synthesizer?
    --Chris (invalidname)

    see bug 4356787. MIDI for external devices is broken.
    Add it to your bug parade votes. Let's get Sun to
    address this.will do... not like they're going to fix my other favorite bug (4119391 - RMI in real-world networks)
    Thanks.
    --Chris

  • Capturing the output of a javax.sound.midi.Synthesizer

    Hallo,
    since i can�t convert a MIDI-Sequence to a WAV-File directly, i want to play back the Sequence and capture the sound somewhere "between" the sound-generating synthesizer and the speakers. As far as i understand, i have to obtain a TargetDataLine from an output mixer, so i can read the sound data, since ports aren�t implemented yet. My problem is: How can i obtain such a TargetDataLine?
    With something like
    info = new DataLine.Info(TargetDataLine.class, format);
    line = (TargetDataLine)AudioSystem.getLine(info);
    i get a line to capture microphone input.
    i managed to get a mixer that is opened and started, when the synthesizer is opened, but that mixer only provides com.sun.media.sound.MixerSourceLines.
    Any help will be greatly appreciated.

    Not a reply, I'm afraid.
    I want to combine Midi output with audio output, which is exactly the same question as this thread. The whole thrust of Java sound is to 'unify' Midi and Audio, and yet I've fallen at the first hurdle.
    This thread was opened in Nov last year, yet is still unanswered. Is this right?

  • Where's javax.sound

    Hi
    i've downloaded j2se 1.4.1 but when i try to import javax.sound.* it says it can't find it. Do i need to import anything else eg java.lang or what? I'm pretty sure its not an optional package.
    Please help me

    You aren't easily distracted from a set opinion, huh?
    You got the same answer from me in that thread:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=32
    334
    You'd have to return to your thread to notice,
    though,
    instead of posting a new one...
    I really appreciate your help docjekill, but even when i specify
    javax.sound.midi
    javax.sound.midi.spi
    javax.sound.sampled
    javax.sound.sampled.spi
    all of these i still get the same error.
    I've looked in scr.zip and found other packages, eg javax.swing etc, but no sound packages. Is the download incomplete or did it just stuff up?

  • Where is javax.sound?

    Compiler tells me it doesn't exist, even when setting classpath as follows:
    C:\JDK\bin\javac -classpath C:\JDK\JRC\lib\rt.jar soundApp.java ...
    I have version 1.4.1.

    How old is this application you are trying to use, or how old is the code if you are getting it from another source?
    1.3 through 1.4.1 use javax.sound.midi, javax.sound.midi.spi, javax.sound.sampled, and javax.sound.sampled.spi.
    They dont try to import javax.sound in and of themselves. This may be an old program written back when javax.sound stuff wasnt included in the API and was a part of the Java Media Framework.
    Of course, I could be totally wrong here (as I havent done anything with sound stuff in Java in quite a while.)
    Just a thought.

  • How do I Fade in and out, working with Midi events?

    I'm new to logic.
    How do you set certain virtual instruments(midi events) to fade in or out. I have a string arrangement written, and whenever the strings end it is very abrupt and unnatural. I want them to fade out, as opposed to just cutting like they do. I would also like to know how to fade in. Is it the same process?
    Please help me out if you know how to do this.
    Thanks...

    I'm not sure what you mean about fading the instrument and not the notes. I just want to fade out one note/per instrument at the end of certain passages. Care to expound?
    In general, MIDI does not provide a mechanism to control the volume of individual notes.
    In MIDI (and sequencer terms), a note has a note on, a note number (which key was pressed) and how hard you hit that key (velocity). Then a corresponding note off. There is nothing in a note specification that let's you control the volume of a note through it's duration.
    In MIDI terms, you can use a controller MIDI message, typically #7 which is used for volume, and modify that over the time the note is playing. But this is controlling the volume of the instrument not the individual notes - the same as turning up and down the volume on the instrument. All notes that the instrument is playing are affected equally - if you are holding a chord, the entire chord will ramp in volume. You cannot just ramp the volume of one note within the chord using this method.
    (The closest MIDI can get to controlling individual notes volume is with polyphonic aftertouch, but this is not often supported and is a more advanced technique - given that you are new to this I'm going to ignore it for now to avoid over-complicating things. I mention it to stop all the people chiming in with "you're so wrong Beejay you muppet you can do this with poly aftertouch don't you know anything" blah blah).
    Is that more clear?
    Also, if you wouldn't mind, could you give me a step by step on opening the hyperview in the piano roll?
    Open the piano roll, select View -> Hyperdraw -> Volume.
    You can click/draw in it with the pencil tool to create MIDI volume (CC#7) changes.

  • Phantom Noise During MIDI Events

    Hiya,
    I've searched a bit, but haven't found much. I apologize if this has been covered. (Obligatory disclaimer complete!)
    Starting earlier this week, I noticed a noise would accompany any MIDI notes I'd play on my keyboard through Logic. Frustrating. I'm having some difficulty describing the noise, but I'll try. First, it has a distinct tone, which is the same tone as the note being keyed. Beyond that it's faint, full of static and has a bit of a phasing effect.
    My troubleshooting so far: (restarting, shutting off and on, unplugging and plugging included!)
    1) Removed my usb keyboard from the computer, and played MIDI notes through the caps lock keyboard. Issue persists.
    2) Used the pencil tool to create MIDI events. Issue persists on playback.
    3) Deleted the Logic plist. Issue persists.
    4) Tested similarly in GarageBand. Issue persists.
    It should be mentioned that I'm not having any other audio issues.
    I'm currently reinstalling Logic, but I can't imagine that's going to change much considering the issue is cross application. (I will test older projects sequenced in the Before Time to see if those events phase as well as soon as Logic is done reinstalling.) I'm sure it's a simple solution that I am not familiar with. No doubt I'll kick myself when someone figures it out!
    Thanks in advance!

    tbirdparis wrote:
    It sounds like you might just be hearing electronic interference noise due to the fact that you're using the internal sound of the Mac. In the old days (up to around the time of the G5s), the built in sound on Macs was fairly decent quality, at least in terms of the way it was isolated to reject interference from the electronics running inside the box. More recent models don't seem to be quite as good in this regard,
    This is what I thought when first reading this post last night. I have an old Fender guitar amp from the 50's that has the same sound. The same note, played low in the background with a quieter layer of distortion. (static).
    It will show up most on tones that are closer to a pure sine wave, like some of the Rhodes/El.Piano sounds. You might not notice it on more complex tones. Also will show up more playing quietly.
    What do you have set as the Mac's input device, is it set to Line input, if so try unplugging anything going into the input, just to see if there's some interference.
    Also, what are you monitoring the sound through?
    pancenter-

  • How to match a series of midi events to the tempo?

    hello there, i've got a series of midi events that i'd like to adjust to the tempo -there are only quarter notes. i thought to use flex time but it seems to be working with audio tracks only. any idea?
    as well, i'd like to fix all notes to a same length, which I am not sure how to do either... thanks in advance

    well, i'd like to fix all notes to a same length, which I am not sure how to do either.
    http://help.apple.com/logicpro/mac/10/#lgcp2158341a

  • Randomise midi events in garageband?

    Hi. Anyone know of a plugin or method to randomise midi events in garageband? E.g. I'd like to be able to randomise (to a controlled degree) note velocities (preferably within a specified range perhaps ± one or two points) and note beginnings (± a few miliseconds). It's a big project I'm working on so it'd be nice if there were a plugin or some other automated means of accomplishing this.
    Thank you in advance,
    Niall, Dublin, Ireland

    I'm trying to do a similar thing - I'm no expert but here's a few ideas:
    First you need a Transmitter not a Receiver (confusingly) - it takes signals from your keyboard and Transmits them to other receivers in your program.
    So you have a Device, d, a Transmitter, t, and use MidiSystem.getSequencer() to get a Sequencer, s.
    You also need a Receiver for the sequencer, r.
    add the Transmitter to the Device: t = d.getTransmitter();
    add the Receiver to the Sequencer r = s.getReceiver();
    connect them together: t.setReceiver(r);
    The class where you want to do stuff with incoming midi signals should implement interface ControllerEventListener, i.e. it has a method controlChange(shortMessage event) which will be called when the sequencer receives midi via receiver r. Then, provided the above code is inside this class, you can add the event listener to the sequencer by:
    listenedSoFar = s.addControllerEventListener(this, listened)
    where listened is int[], a list of the kinds of messages you want to deal with. Elements can be between 0-127. Class ShortMessage has constatnts for these like ShortMessage.NOTE_ON etc. listenedSoFar is a list of all the kinds of messages this event listener responds to. If this is the first/only addControllerEventListener then listenedSoFar should equal listened.
    I'm not sure this is exactly right as i'm in the middle of writing my program. If you've already cracked the problem then any tips you have would be appreciated.
    George

  • Mapping specific MIDI events to buttson

    While I'm not ready to depend on MainStage for live use due to the patch change/delayed note bug, I'm still experimenting with it in the hope that the bugs WILL get fixed.
    I have a Roland FC-300 foot controller and I wanted to try and map a couple of switches to Next Patch and Prev Patch, without having to program the FC-300 itself.
    In the default (factory settings) mode, the first two foot switches send Program Change (PC) 1 and 2 respectively. So the actual messages being sent out (assuming midi channel 1) are C0 01 and C0 02 respectively.
    Unfortunately, the LEARN mechanism seems to just detect the C0 part and considers the value (01 or 02) to be a changeable parameter. While that's often what you want, it's NOT useful in this particular situation.
    So the question is, how can I get MainStage to treat the entire MIDI event as a single atomic command so that I can make two buttons to go up and down?
    Thanks,
    David Jameson

    Actually, dhjdhj, it's a lot easier than you think:
    There is a button on the FC 300 called "Mode". (I'm assuming it works just like the one on the FC 200). This will put the FC 300 into one of the modes where the foot switches send midi CC messages, NOT program changes. Just press this button and watch midi input to see when the foot switches send midi CC's. All you need to do is press this button and get in the right mode, no programming necessary.
    Once you do that, simply learn/assign all the footswitches you want - make sure to do this for the next and previous patch buttons in your mainstage layout.
    I've done this and it works great.
    One thing that will surprise you is that the FC footswitches will NOT be in sync with Mainstage. There's no way around this. 1) Mainstage has no midi out (I haven't tried to plugins others have mentioned). 2) NO guitar board I know of takes MIDI in and allows you to only set status lights with it. I think there are some, but none that are big sellers. Even if Mainstage had MIDI out, it wouldn't work anyway until manufacturers support this feature. So your on/off lights on the FC 300 will potentially be out of sync with Mainstage when you change patches. Annoying, but it still works.

  • Scissor tool to divide into several portion midi event in piano roll not affect

    Dears all,
    it seems holding down option in scissor tool mode is not working to divide a midi event in several portions in piano roll.
    If i press alt the scissor turn in a scissor plus + but not affect.
    Can you confirm ?
    Thanks
    -A

    Hi
    Confirmed.
    I'm not sure that this has ever worked in the Piano Roll.
    CCT

  • Midi events start late

    I have noticed that some tracks that have midi events (VST's: RealRPC / Native Instruments) start late the first time that I play the project after opening it. The second time the project plans fine. This also happens when I bounce the project - some midi tracks start late.
    My setup:
    Logic 9 Express
    DAW: Mac Mini Server (i7 quad core 2GHz / 8 MB RAM)
    thanks in advance!

    I'm trying to do a similar thing - I'm no expert but here's a few ideas:
    First you need a Transmitter not a Receiver (confusingly) - it takes signals from your keyboard and Transmits them to other receivers in your program.
    So you have a Device, d, a Transmitter, t, and use MidiSystem.getSequencer() to get a Sequencer, s.
    You also need a Receiver for the sequencer, r.
    add the Transmitter to the Device: t = d.getTransmitter();
    add the Receiver to the Sequencer r = s.getReceiver();
    connect them together: t.setReceiver(r);
    The class where you want to do stuff with incoming midi signals should implement interface ControllerEventListener, i.e. it has a method controlChange(shortMessage event) which will be called when the sequencer receives midi via receiver r. Then, provided the above code is inside this class, you can add the event listener to the sequencer by:
    listenedSoFar = s.addControllerEventListener(this, listened)
    where listened is int[], a list of the kinds of messages you want to deal with. Elements can be between 0-127. Class ShortMessage has constatnts for these like ShortMessage.NOTE_ON etc. listenedSoFar is a list of all the kinds of messages this event listener responds to. If this is the first/only addControllerEventListener then listenedSoFar should equal listened.
    I'm not sure this is exactly right as i'm in the middle of writing my program. If you've already cracked the problem then any tips you have would be appreciated.
    George

  • View two midi events on the piano roll

    Hi, my issue is a follows:
    Take two midi events on two separate channels (eg kick on inst 1 channel 1 and snare on inst 2 channel 2) - when highlighting both strips in the arrange, then opening the piano roll (cmd+6), I used to be able to view both. But in logic 9 only one of them can be viewed.
    I can view both on the piano roll on the arrange, but that's less desirable (takes away space on my arrange screen).
    Any ideas? Thanks a lot.

    Delete the user preferences
    You can resolve many issues by restoring Logic Pro X back to its original settings. This will not impact your media files. To reset your Logic Pro X user preference settings to their original state, do the following:
    Quit Logic Pro
    In the Finder, choose Go to Folder from the Go menu.
    Type ~/Library/Preferences in the "Go to the folder" field.
    Press the Go button.
    Remove the com.apple.logic10.plist file from the Preferences folder. Note that if you have programmed any custom key commands, this will reset them to the defaults. You may wish to export your custom key command as a preset before performing this step. See the Logic Pro X User Manual for details on how to do this. If you are having trouble with a control surface in Logic Pro X, then you may also wish to delete the com.apple.logic.pro.cs file from the preferences folder.
    If you have upgraded from an earlier version of Logic Pro, you should also remove ~/Library/Preferences/Logic/com.apple.logic.pro.
    Restart the computer.
    Note: If you cannot find any of the files mentioned in this tip,you didn't follow the instructions exactly as written

  • Sound midi ok with appletviewer bad on the net

    I write application for sound midi (i want make tempo variations and volume variantion for one voice in midi file)
    The apllet make a very good sound with appletviewer, and a very bad sound when she is on the net (or on my localhost server)
    with applet viewer the JSlider are OK, on the net they are not efficient !
    explications ?
    I am with w2000 and firefox (with IE it is same pb)
    thanks for reply

    Hi, after upgrading to Firefox 17 all browsing slowed down.
    After doing several speed tests with Firefox 17 and IE9 I was getting 75% slower speeds with Firefox.
    After a lot of hassle I got back to v16.0.2 and my speed is back to normal.

Maybe you are looking for