Results 1 to 2 of 2
  1. #1
    Ravaa is offline Member
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default Manually edit volume of MIDI file in Java

    Hey all, I'm trying to find a way to manually change the volume (velocity) of a midi file before playback, i.e. directly in the code. This is the code I'm using to play my midi files:

    import javax.sound.midi.*;
    import java.io.*;

    /** Plays a midi file provided on command line */
    public class MidiPlayer {
    public static void main(String args[]) {
    try {
    // From file
    Sequence sequence = MidiSystem.getSequence(new File("C:\\Sounds\\twinkleaccomp.mid"));

    // Create a sequencer for the sequence
    Sequencer sequencer = MidiSystem.getSequencer();
    sequencer.open();
    sequencer.setSequence(sequence);

    // Start playing
    sequencer.start();
    } catch (IOException e) {
    } catch (MidiUnavailableException e) {
    } catch (InvalidMidiDataException e) {
    }
    }
    }

    How can I edit my code so that I can easily change the midi file's volume before I run and compile the code?

    Thank you, any help will be appreciated! :)

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    The standard API doesn't seem to allow for the controls one would expect from a player. I would like for a pure Java player and examine its API.

Similar Threads

  1. Manually adding a component
    By djc in forum NetBeans
    Replies: 3
    Last Post: 04-01-2009, 12:51 PM
  2. Replies: 1
    Last Post: 11-10-2008, 10:49 AM
  3. Handle exception manually
    By John_28 in forum New To Java
    Replies: 2
    Last Post: 06-05-2008, 12:26 PM
  4. Replies: 3
    Last Post: 12-26-2007, 07:42 AM
  5. how to play MIDI in java application?
    By oregon in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 03:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •