PHP Classes

File: duration.php

Recommend this page to a friend!
  Classes of Fluxus   MIDI Class   duration.php   Download  
File: duration.php
Role: Example script
Content type: text/plain
Description: demonstrates how to find the duration of a MIDI file.
Class: MIDI Class
Read, write and manipulate MIDI files and data
Author: By
Last change:
Date: 19 years ago
Size: 1,205 bytes


Class file image Download
= $_POST;
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
body {font-family:arial;font-size:11px;margin:5px;}
input {font-family:arial;font-size:11px}

<form enctype="multipart/form-data" action="duration.php" method="POST" onsubmit="if (this.mid_upload.value==''){alert('Please choose a mid-file to upload!');return false}">
<input type="hidden" name="MAX_FILE_SIZE" value="1048576"><!-- 1 MB -->
MIDI file (*.mid) to upload: <input type="file" name="mid_upload">
<input type="submit" value=" send ">
if ($file!=''){
$midi = new Midi();
    foreach (
$midi->tracks as $track){
$msgStr = $track[count($track)-1];
$time)=explode(" ", $msgStr);
$duration=$maxTime * $midi->getTempo() / $midi->getTimebase() / 1000000;
"Duration [sec]: $duration";