Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-09-2007, 12:45 AM
Member
 
Join Date: Dec 2007
Posts: 1
Usagi is on a distinguished road
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:
Quote:
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;
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.

Any help would be appreciated,
Usagi
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using reflection to check array type and length Java Tip java.lang 0 04-14-2008 09:42 PM
Finding the exact length of a string in a JLabel (in pixels) Clarkey Advanced Java 2 03-25-2008 06:49 AM
Create a VeryLong class that will store an integer of arbitrary length. hey New To Java 2 12-12-2007 06:01 PM
help with midi files leonard New To Java 1 08-06-2007 05:40 PM
Help with method length toby New To Java 1 07-25-2007 09:29 PM


All times are GMT +3. The time now is 03:08 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org