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! :)