Example #1
0
function generateOgg($pitches)
{
	$midi = new Midi();

	/*
	$instruments = $midi->getInstrumentList();
	$drumset     = $midi->getDrumset();
	$drumkit     = $midi->getDrumkitList();
	$notes       = $midi->getNoteList();
	*/

	$save_dir = __DIR__.'/tmp/';
	srand((double)microtime()*1000000);
	$file = $save_dir.rand();

	//DEFAULTS
	$rep = 1; //repetitions
	$bpm = 90; //BPM

	$midi->open(480); //timebase=480, quarter note=120
	$midi->setBpm($bpm);
		
	//channel
	$ch = 1;

	//$inst = $_POST["inst$k"];
	$inst = 0;

	// pitch
	//$pitches = array(50,60,70,60,70,60,70,40);

	// volume
	$v = 127;

	$ticksBetweenEvents = 480; // 120 = quarter note

	$t = 0;
	$ts = 0;
	$tn = $midi->newTrack() - 1;

	$midi->addMsg($tn, "0 PrCh ch=$ch p=$inst");
	foreach ($pitches as $n)
	{
		if ($ts == $t+$ticksBetweenEvents) $midi->addMsg($tn, "$ts Off ch=$ch n=$n v=127");
		$t = $ts;
		$midi->addMsg($tn, "$t On ch=$ch n=$n v=$v");
		$ts += $ticksBetweenEvents;
		if ($ts == $t+$ticksBetweenEvents) $midi->addMsg($tn, "$ts Off ch=$ch n=$n v=127");
	}
	$midi->addMsg($tn, "$ts Meta TrkEnd");

	$midi->saveMidFile($file.'.mid', 0666);
	system('/usr/bin/timidity -Ow --output-mono --verbose=-2 --output-file=- '.$file.'.mid | oggenc -q-1 -o '.$file.'.ogg -');
	//$midi->playMidFile($file,$visible,$autostart,$loop,$player);
}
Example #2
0
<?php

if ($_SERVER['HTTP_REFERER'] != "" && !strstr($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME'])) {
    die("REFUSED");
}
require 'classes/midi.class.php';
$params = $_GET;
$instrument = $_GET["instr"];
$chordNotes = explode("_", $_GET["notes"]);
if ($chordNotes) {
    $midi = new Midi();
    $midi->open(480);
    $midi->setBpm(120);
    $track = $midi->newTrack() - 1;
    $midi->addMsg($track, "0 PrCh ch=1 p={$instrument}");
    $time = 20;
    foreach ($chordNotes as $noteDeslocation) {
        $midi->addMsg($track, "{$time} On ch=1 n={$noteDeslocation} v=127");
        $time += 20;
    }
    $time += 1000;
    foreach ($chordNotes as $noteDeslocation) {
        $midi->addMsg($track, "{$time} Off ch=1 n={$noteDeslocation} v=127");
    }
    foreach ($chordNotes as $noteDeslocation) {
        $midi->addMsg($track, "{$time} On ch=1 n={$noteDeslocation} v=127");
        $time += 150;
    }
    $time += 1500;
    foreach ($chordNotes as $noteDeslocation) {
        $midi->addMsg($track, "{$time} Off ch=1 n={$noteDeslocation} v=127");
Example #3
0
 function generateOgg($pitches)
 {
 	//var_dump($pitches);
 	$midi = new Midi();
 
 	/*
 	$instruments = $midi->getInstrumentList();
 	$drumset     = $midi->getDrumset();
 	$drumkit     = $midi->getDrumkitList();
 	$notes       = $midi->getNoteList();
 	*/
 
 	$save_dir = __DIR__.'/tmp/';
 //	srand((double)microtime()*1000000);
 //	$filename = rand();
 	$filename = time();
 	$file = $save_dir.$filename;
 
 	//DEFAULTS
 	$rep = 1; //repetitions
 	$bpm = 90; //BPM
 
 	$midi->open(480); //timebase=480, quarter note=120
 	$midi->setBpm($bpm);
 		
 	//channel
 	$ch = 1;
 
 	//$inst = $_POST["inst$k"];
 	$inst = 0;
 
 	// pitch
 	//$pitches = array(50,60,70,60,70,60,70,40);
 
 	// volume
 	$v = 127;
 
 	$ticksBetweenEvents = 480; // 120 = quarter note
 
 	$t = 0;
 	$ts = 0;
 	$tn = $midi->newTrack() - 1;
 
 	$midi->addMsg($tn, "0 PrCh ch=$ch p=$inst");
 	for($r=0; $r<$rep; $r++)
 	{
 	foreach ($pitches as $n)
 	{
 		$n = $n + (12*5); // REMOVE THIS
 		if ($ts == $t+$ticksBetweenEvents) $midi->addMsg($tn, "$ts Off ch=$ch n=$n v=127");
 		$t = $ts;
 		$midi->addMsg($tn, "$t On ch=$ch n=$n v=$v");
 		$ts += $ticksBetweenEvents;
 		if ($ts == $t+$ticksBetweenEvents) $midi->addMsg($tn, "$ts Off ch=$ch n=$n v=127");
 	}
 	}
 	$midi->addMsg($tn, "$ts Meta TrkEnd");
 
 	$midi->saveMidFile($file.'.mid', 0666);
 //	system('/usr/bin/timidity -A100 -Ow --output-mono --verbose=-2 --reverb=g,100 --output-file=- '.$file.'.mid | oggenc -q2 -o '.$file.'.ogg -');
 
 //we could also make use of FIFOs:
 //http://stackoverflow.com/questions/60942/how-can-i-send-the-stdout-of-one-process-to-multiple-processes-using-preferably
 
 	$command =  '/usr/bin/timidity -A110 -Ow --verbose=-2 --reverb=f,100 --output-file=- '.$file.'.mid | tee >(lame --silent -V6 - '.$file.'.mp3) | oggenc -q1 -o '.$file.'.ogg -';
 //	file_put_contents('command', $command);
 	shell_exec('/bin/bash -c "'.$command.'"');
 	return ($filename);
 
 	//$midi->playMidFile($file,$visible,$autostart,$loop,$player);
 }
Example #4
0
        if ($file != '.' && $file != '..' && $file != 'CVS') {
            unlink("{$dir}/{$file}");
        }
    }
    closedir($handle);
    rmdir($dir);
}
if (!is_dir('tmp')) {
    mkdir('tmp');
}
if (!is_dir($save_dir)) {
    mkdir($save_dir);
}
//---------------------------------------------
require 'midi.class.php';
$midi = new Midi();
$instruments = $midi->getInstrumentList();
$drumset = $midi->getDrumset();
$drumkit = $midi->getDrumkitList();
$notes = $midi->getNoteList();
//---------------------------------------------
$p = $_POST;
$g = $_GET;
//'cause I'm lazy
srand((double) microtime() * 1000000);
$rand = rand();
$f = $rand . '.mid';
$file = $save_dir . $f;
if (isset($g['download'])) {
    $file = $g['download'];
    $filename = 'output.mid';
Example #5
0
if (strcmp($par_request, 'upload_kar') == 0) {
    $file = isset($_FILES['file_kar']) && $_FILES['file_kar']['tmp_name'] != '' ? $_FILES['file_kar']['tmp_name'] : '';
    if ($file != '') {
        $par_dir = getCode();
        // skopiowanie pliku
        $path = "../wap/get/" . $par_dir;
        // TODO: sprawdzi, czy taki kod już jest w filesystemie
        if (mkdir($path) == FALSE) {
            $reason = M1K0_REASON_NO_DIR;
            $par_request = NULL;
        } else {
            copy($file, $path . "/song.midi");
            require '../scripts/midi.class.php';
            require '../scripts/ConvertCharset.class.php';
            $NewEncoding = new ConvertCharset();
            $midi = new Midi();
            $midi->importMid($file, 0);
            $track = $midi->getTrack(0);
            // list of meta events that we are interested in (adjust!)
            $texttypes = array('Text', 'Copyright', 'TrkName', 'InstrName', 'Lyric', 'Marker', 'Cue');
            $lyric = array();
            // poustawianie czasów trwania
            foreach ($track as $msgStr) {
                //print_r($msgStr);
                $msg = explode(' ', $msgStr);
                if ($msg[1] == 'Meta' && in_array($msg[2], $texttypes)) {
                    $milis = (int) ($msg[0] * $midi->getTempo() / $midi->getTimebase() / 1000);
                    $text = $NewEncoding->Convert(substr($msgStr, strpos($msgStr, '"')), "windows-1250", "utf-8");
                    $text = str_replace("_", " ", $text);
                    $text = str_replace("\n", "/", $text);
                    $text = str_replace("\r", "/", $text);
Example #6
0
>Beatnik
<input type="radio" name="engine" value="qt"<?php 
echo $engine == 'qt' ? ' checked' : '';
?>
>QuickTime
<input type="radio" name="engine" value="wm"<?php 
echo $engine == 'wm' ? ' checked' : '';
?>
>Windows Media
<input type="radio" name="engine" value=""<?php 
echo $engine == '' ? ' checked' : '';
?>
>other (default Player)<br><br>
<input type="submit" value=" send ">
</form>
<?php 
if (isset($p['txt'])) {
    $midi = new Midi();
    $midi->importTxt($txt);
    $midi->saveMidFile($file);
    $midi->playMidFile($file, 1, 1, 0, $engine);
    ?>
	<br><br><input type="button" name="download" value="Save as SMF (*.mid)" onClick="self.location.href='sequencer.php?download=<?php 
    echo urlencode($file);
    ?>
'">
<?php 
}
?>
</body>
</html>
<?php

if (isset($_POST['notedata'])) {
    require './midi.class.php';
    $txt = $_POST['notedata'];
    //echo $txt;
    //echo '\r\n \r\n';
    $midi = new Midi();
    //echo "midi made";
    $midi->importTxt($txt);
    //echo $midi->getTrackCount();
    $destFilename = 'output3A.mid';
    //echo $destFilename;
    ///$tracks=$midi->tracks();
    echo $midi->getMid();
    //$midi->downloadMidFile($destFilename); //not from a midi file
    //echo 'Binary test'
    //echo json_encode($binary);
} else {
    echo "not set";
}
Example #8
0
<?php

// test.php
header('Content-Type: text/html; charset=utf-8');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../src/MIDI/midi.class.php";
$admin = new LTE\AdminLte2();
$admin->title("MIDI");
echo $admin;
?>
<section class="container">
<?php 
$midi = new Midi();
$files = glob(__DIR__ . "/../../midifiles/*.mid");
shuffle($files);
$file = $files[0];
$midi->importMid($file);
$track = $midi->getTrack(0);
echo "<h1>" . basename($file) . "</h1>\n";
echo "<pre>";
$tempo = $midi->getTempo();
$bpm = $midi->getBpm();
//returns tempo as beats per minute (0 if tempo not set).
$timebase = $midi->getTimebase();
//returns timebase value.
$trackCount = $midi->getTrackCount();
//returns number of tracks.
$duration = $midi->getDuration();
//in sec
echo "tempo={$tempo}\n";
<br /><br />
<input type="submit" value=" send " />
</div>
</form>

<div style="margin-top:20px">
<?php 
if (isset($_POST['txt'])) {
    $save_dir = 'tmp/';
    srand((double) microtime() * 1000000);
    $file = $save_dir . rand() . '.mid';
    /****************************************************************************
    	MIDI CLASS CODE
    	****************************************************************************/
    require './classes/midi.class.php';
    $midi = new Midi();
    $midi->importTxt($txt);
    $midi->saveMidFile($file, 0666);
    $midi->playMidFile($file, $visible, $autostart, $loop, $player);
    ?>
<br /><br /><input type="button" name="download" value="Save as SMF (*.mid)" onclick="self.location.href='download.php?f=<?php 
    echo urlencode($file);
    ?>
'" />
<?php 
}
?>
</div>

</body>
</html>
Example #10
0
 function checkAndCreateKeysMidiFile()
 {
     global $mosConfig_absolute_path;
     if ($this->getBassNote() != "") {
         $bass = $this->getNote($this->getBassNote());
     } else {
         $bass = $this->getNote($this->getMainNote());
     }
     $chordKeys = $this->getChordBasicNotesAsNumbers();
     $imageFilePath = "{$mosConfig_absolute_path}/components/com_chordbase/keys/" . $bass . "_" . implode("_", $chordKeys) . ".mid";
     $chordNotes = $this->getChordNotesAsNumbers();
     $instrument = 1;
     // Piano
     if (!file_exists($imageFilePath) && $chordNotes) {
         $midi = new Midi();
         $midi->open(480);
         $midi->setBpm(120);
         $track = $midi->newTrack() - 1;
         $midi->addMsg($track, "0 PrCh ch=1 p={$instrument}");
         $time = 20;
         foreach ($chordNotes as $noteDeslocation) {
             $midi->addMsg($track, "{$time} On ch=1 n={$noteDeslocation} v=127");
             $time += 20;
         }
         $time += 1000;
         foreach ($chordNotes as $noteDeslocation) {
             $midi->addMsg($track, "{$time} Off ch=1 n={$noteDeslocation} v=127");
         }
         foreach ($chordNotes as $noteDeslocation) {
             $midi->addMsg($track, "{$time} On ch=1 n={$noteDeslocation} v=127");
             $time += 150;
         }
         $time += 1500;
         foreach ($chordNotes as $noteDeslocation) {
             $midi->addMsg($track, "{$time} Off ch=1 n={$noteDeslocation} v=127");
         }
         $midi->addMsg($track, "{$time} Meta TrkEnd");
         $midi->saveMidFile($imageFilePath);
     }
 }
<?php

if (isset($_POST['notedata'])) {
    require './midi.class.php';
    $txt = $_POST['notedata'];
    //echo $txt;
    //echo '\r\n \r\n';
    $midi = new Midi();
    //echo "midi made";
    $midi->importTxt($txt);
    //echo $midi->getTrackCount();
    $destFilename = 'output3A.mid';
    //echo $destFilename;
    ///$tracks=$midi->tracks();
    //echo $midi->getMid();
    $midi->downloadMidFile($destFilename);
    //not from a midi file
}
Example #12
0
    echo '<option value="' . $i . '"' . (@$_POST['track_num'] == $i ? ' selected="selected"' : '') . '>' . $i . '</option>';
}
?>
</select><br />
<input type="submit" value=" send " />
</div>
</form>
<?php 
if (@$file) {
    echo '<div style="margin-top:20px">File: ' . $_FILES['mid_upload']['name'];
    echo '<hr /><pre>';
    /****************************************************************************
    	MIDI CLASS CODE
    	****************************************************************************/
    require './classes/midi.class.php';
    $midi = new Midi();
    $midi->importMid($file);
    $track = $midi->getTrack((int) $_POST['track_num']);
    // list of meta events that we are interested in (adjust!)
    $texttypes = array('Text', 'Copyright', 'TrkName', 'InstrName', 'Lyric', 'Marker', 'Cue');
    $nothing = 1;
    foreach ($track as $msgStr) {
        $msg = explode(' ', $msgStr);
        if ($msg[1] == 'Meta' && in_array($msg[2], $texttypes)) {
            echo $msg[2] . ': ' . substr($msgStr, strpos($msgStr, '"')) . "\n";
            $nothing = 0;
        }
    }
    if ($nothing) {
        echo 'No events found!';
    }
?>
" method="post">
<div>
<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 " />
</div>
</form>
<hr />
<?php 
if (@$file) {
    /****************************************************************************
    	MIDI CLASS CODE
    	****************************************************************************/
    require './classes/midi.class.php';
    $midi = new Midi();
    $midi->importMid($file);
    $tc = $midi->getTrackCount();
    ?>
<form action="manipulate.php" method="post">
<div>
<input type="hidden" name="file" value="<?php 
    echo isset($file) ? $file : '';
    ?>
" />
<input type="checkbox" name="up"<?php 
    echo isset($_POST['up']) ? ' checked="checked"' : '';
    ?>
 />transpose up (1 octave)
<input type="checkbox" name="down"<?php 
    echo isset($_POST['down']) ? ' checked="checked"' : '';
Example #14
0
         $f = [];
         $f['name'] = basename($file);
         $f['size'] = filesize($file);
         // get midifile info //
         $f['bpm'] = $midi->getBpm();
         //returns tempo as beats per minute (0 if tempo not set).
         $f['timebase'] = $midi->getTimebase();
         //returns timebase value.
         $f['trackCount'] = $midi->getTrackCount();
         //returns number of tracks.
         $dat['files'][] = $f;
     }
     exit(json_encode($dat));
 case 'fileInfo':
     $dat['post'] = $_POST;
     $midi = new Midi();
     $midi->importMid(__DIR__ . "/../../midifiles/" . $_POST['filename']);
     //$track = $midi->getTrack(0);
     $dat['bpm'] = $midi->getBpm();
     //returns tempo as beats per minute (0 if tempo not set).
     $dat['timebase'] = $midi->getTimebase();
     //returns timebase value.
     $dat['trackCount'] = $midi->getTrackCount();
     //returns number of tracks.
     $track = $midi->getTrack(0);
     // list of meta events that we are interested in (adjust!)
     //$texttypes = array('Text','Copyright','TrkName','InstrName','Lyric','Marker','Cue');
     $texttypes = array('TrkName');
     foreach ($track as $msgStr) {
         $msg = explode(' ', $msgStr);
         if ($msg[1] == 'Meta' && $msg[2] == 'TrkName') {
Example #15
0
<?php

error_reporting(E_ALL);

$deleteFlag = false;

/****************************************************************************
MIDI CLASS CODE
****************************************************************************/
require('./classes/midi.class.php');

$midi = new Midi();

$instruments = $midi->getInstrumentList();
$drumset     = $midi->getDrumset();
$drumkit     = $midi->getDrumkitList();
$notes       = $midi->getNoteList();
//---------------------------------------------

if (isset($_POST['player'])){
	$player = $_POST['player'];
	$autostart = isset($_POST['autostart']);
	$loop = isset($_POST['loop']);
	$visible = isset($_POST['visible']);
}else{
	$player = 'default';
	$autostart = true;
	$loop = false;
	$visible = true;
}
		<?php 
if ($_POST["midixmlformhidden"]) {
    // Require PHP MIDI class
    require 'lib/midi_class_v178/classes/midi.class.php';
    // Decode post data
    $mxml = urldecode($_POST["midixmlformhidden"]);
    // TMP save directory
    $save_dir = 'tmp/';
    // Random filename string
    srand((double) microtime() * 1000000);
    $tmpfile = $save_dir . rand() . '.mid';
    // Time-limit
    @set_time_limit(600);
    # 10 minutes
    // Convert XMP and save MIDI file
    $midi = new Midi();
    $midi->importXml($mxml);
    $midi->saveMidFile($tmpfile, 0666);
    // Download file
    $destfilename = 'bassline_explorer.mid';
    //$midi->downloadMidFile($destFilename, $tmpfile);
    // Delete tmp file (not working)
    //sleep(30);
    //unlink($tmpfile);
} else {
    // No post data
    echo "Error: No MIDIXML data received";
}
?>
		<input id="downloadbutton" type="button" name="download" value="Download MIDI File" onclick="self.location.href='download.php?f=<?php 
echo urlencode($tmpfile);
Example #17
0
<?php

$p = $_POST;
$tt = isset($p['tt']) ? $p['tt'] : 0;
$xm = isset($p['xm']) ? $p['xm'] : 0;
$file = isset($_FILES['mid_upload']) && $_FILES['mid_upload']['tmp_name'] != '' ? $_FILES['mid_upload']['tmp_name'] : '';
if ($file != '') {
    require 'midi.class.php';
    $midi = new Midi();
    $midi->importMid($file);
    $xml = $midi->getXml($tt);
    $fn = $_FILES['mid_upload']['name'];
    $a = explode('.', $fn);
    array_pop($a);
    array_push($a, "xml");
    $xn = implode('.', $a);
    //$xn = str_replace('.mid','.xml',$fn);
    if ($xm == 1) {
        header('Content-Type: application/octetstream');
        header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Disposition: attachment; filename="' . $xn . '"');
        header('Pragma: no-cache');
        echo $xml;
        exit;
    }
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Midi2Xml</title>
Example #18
0
MIDI file (*.mid) to upload: <input type="file" name="mid_upload">
<br>
TimestampType:
<input type="radio" name="tt" value="0"<?php 
if ($tt == 0) {
    echo ' checked';
}
?>
> Absolute
<input type="radio" name="tt" value="1"<?php 
if ($tt == 1) {
    echo ' checked';
}
?>
> Delta
<br><br>
<input type="submit" value=" send ">
</form>
<?php 
if ($file != '') {
    require 'midi.class.php';
    $midi = new Midi();
    $midi->importMid($file);
    echo 'File: ' . $_FILES['mid_upload']['name'];
    echo '<hr><pre>';
    echo $midi->getTxt($tt);
    echo '</pre>';
}
?>
</body>
</html>
<?php

error_reporting(E_ALL);
$deleteFlag = false;
/****************************************************************************
MIDI CLASS CODE
****************************************************************************/
require './classes/midi.class.php';
$midi = new Midi();
$instruments = $midi->getInstrumentList();
$drumset = $midi->getDrumset();
$drumkit = $midi->getDrumkitList();
$notes = $midi->getNoteList();
//---------------------------------------------
if (isset($_POST['player'])) {
    $player = $_POST['player'];
    $autostart = isset($_POST['autostart']);
    $loop = isset($_POST['loop']);
    $visible = isset($_POST['visible']);
} else {
    $player = 'default';
    $autostart = true;
    $loop = false;
    $visible = true;
}
if (isset($_POST['publish'])) {
    #unset($_POST['plug']);
    if (isset($_POST['showTxt'])) {
        unset($_POST['showTxt']);
    }
    if (isset($_POST['showXml'])) {
Example #20
0
input {font-family:arial;font-size:11px}
select {font-family:arial;font-size:11px}
option {font-family:arial;font-size:11px}
</style>
</head>
<body>
<form enctype="multipart/form-data" action="manipulate.php" method="POST">
<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 ">
</form>
<hr>
<?php 
if (isset($file)) {
    $plug = isset($p['plug']) ? $p['plug'] : 'wm';
    $midi = new Midi();
    $midi->importMid($file);
    $tc = $midi->getTrackCount();
    ?>
<form action="manipulate.php" method="POST">
<input type="hidden" name="file" value="<?php 
    echo isset($file) ? $file : '';
    ?>
">
<input type="radio" name="plug" value="bk"<?php 
    echo $plug == 'bk' ? ' checked' : '';
    ?>
>Beatnik
<input type="radio" name="plug" value="qt"<?php 
    echo $plug == 'qt' ? ' checked' : '';
    ?>
<?php

if (isset($_GET['f'])) {
    require './classes/midi.class.php';
    //$srcFile = $_GET['f'];
    $srcFile = 'tmp/' . basename($_GET['f'], '.mid') . '.mid';
    $destFilename = 'output.mid';
    $midi = new Midi();
    $midi->downloadMidFile($destFilename, $srcFile);
}
Example #22
0
 private function getTracks()
 {
     if (!isset($privateData['tracks'])) {
         $fretIndex = array(60 => 'easy', 61 => 'easy', 62 => 'easy', 63 => 'easy', 64 => 'easy', 72 => 'medium', 73 => 'medium', 74 => 'medium', 75 => 'medium', 76 => 'medium', 84 => 'hard', 85 => 'hard', 86 => 'hard', 87 => 'hard', 88 => 'hard', 96 => 'expert', 97 => 'expert', 98 => 'expert', 99 => 'expert', 100 => 'expert');
         $difficulties = array_unique(array_values($fretIndex));
         $midi = new Midi();
         // $midi->importMid( 'abeautifullie/notes.mid' );
         // $midi->importMid( 'acdc_thunderstruck/notes.mid' );
         $midi->importMid($this->directoryPath . DIRECTORY_SEPARATOR . 'notes.mid');
         $xmlString = $midi->getXml();
         $xml = simplexml_load_string($xmlString);
         foreach ($xml->Track as $track) {
             $trackName = (string) $track->Event[0]->TrackName;
             if (substr($trackName, 0, 5) == 'PART ') {
                 $trackName = ucfirst(strtolower(substr($trackName, 5)));
                 $parts[] = $trackName;
                 // disabled difficulty levels for track
                 $t0 = $track->xpath('Event[Absolute=0 and child::NoteOn]');
                 foreach ($t0 as $event) {
                     $note = (int) $event->NoteOn[0]['Note'];
                     if (!isset($disabled[$trackName])) {
                         $disabled[$trackName] = array();
                     }
                     // unknown note, let's skip it for now
                     if (!isset($fretIndex[$note])) {
                         break;
                     }
                     $difficulty = $fretIndex[$note];
                     if (!isset($disabled[$trackName][$difficulty])) {
                         $disabled[$trackName][$difficulty] = array();
                     }
                     $disabled[$trackName][$difficulty][$note] = true;
                 }
             }
         }
         // display available difficulties for each track
         $tracks = array();
         foreach ($parts as $track) {
             $trackDifficulties = array();
             foreach ($difficulties as $difficulty) {
                 if (!isset($disabled[$track][$difficulty])) {
                     $trackDifficulties[] = $difficulty;
                 }
             }
             if (count($trackDifficulties) > 0) {
                 $currentTrack = new FOFSongTrack($track);
                 $currentTrack->difficulties = $trackDifficulties;
                 $tracks[] = $currentTrack;
             }
         }
     }
     return $privateData['tracks'];
 }