Results 1 to 1 of 1
Thread: Determining Midi Length
- 12-08-2007, 11:45 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 1
- Rep Power
- 0
Determining Midi Length
I am uploading midis to my server and I would like to have the server find out what the length of the midi is in seconds. I need a command line utility which will return the length.
I know nothing at all about java programming or how to run a java program.
I found this:
This looks like it might work but I don't have a clue how I would call, compile or whatnot on my server to get an executable program.How to determine the duration of a Midi audio file
This Java tip illustrates a method of determining the duration of a Midi audio file. Developer may use this in gaming applications where there is a need for playing different audios. Further this may also be used in your own media player. Here in this tip a sequencer fires a meta message event when a midi file has finished playing.
// From file
Sequence sequence = MidiSystem.getSequence(new File("midiaudiofile"));
// From URL
sequence = MidiSystem.getSequence(new URL("http://hostname/midiaudiofile"));
// Create a sequencer for the sequence
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
sequencer.setSequence(sequence);
double durationInSecs = sequencer.getMicrosecondLength() / 1000000.0;
Any help would be appreciated,
Usagi
Similar Threads
-
Using reflection to check array type and length
By Java Tip in forum java.langReplies: 0Last Post: 04-14-2008, 08:42 PM -
Finding the exact length of a string in a JLabel (in pixels)
By Clarkey in forum Advanced JavaReplies: 2Last Post: 03-25-2008, 05:49 AM -
Create a VeryLong class that will store an integer of arbitrary length.
By hey in forum New To JavaReplies: 2Last Post: 12-12-2007, 05:01 PM -
help with midi files
By leonard in forum New To JavaReplies: 1Last Post: 08-06-2007, 04:40 PM -
Help with method length
By toby in forum New To JavaReplies: 1Last Post: 07-25-2007, 08:29 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks