> 24) & 0xff)); $r = $r . eputc((($data >> 16) & 0xff)); $r = $r . eputc((($data >> 8 ) & 0xff)); $r = $r . eputc(($data & 0xff)); return($r); } function write16bit($data) { $r = ""; $r = $r . eputc((($data & 0xff00) >> 8)); $r = $r . eputc(($data & 0xff)); return($r); } function mf_write_header_chunk($format,$ntracks,$division) { $r = ""; $ident=0; $length=0; $ident = 0x4d546864; $length = 6; $r = $r . write32bit($ident); $r = $r . write32bit($length); $r = $r . write16bit($format); $r = $r . write16bit($ntracks); $r = $r . write16bit($division); return($r); } function mf_write_track_chunk($track) { $r = ""; $trkhdr = 0x4d54726b; $r = $r . write32bit($trkhdr); $r = $r . write32bit(strlen($track)); return($r); } function WriteVarLen($value) { $buffer=0; $r = ""; $buffer = $value & 0x7f; while(($value >>= 7) > 0) { $buffer <<= 8; $buffer |= 0x80; $buffer += ($value & 0x7f); } while(1){ $r = $r . eputc(($buffer & 0xff)); if($buffer & 0x80) $buffer >>= 8; else return($r); } } function mf_write_tempo($t) { $tempo = (60000000.0 / ($t)); $r = ""; $r = $r . eputc(0); $r = $r . eputc(0xff); $r = $r . eputc(0x51); $r = $r . eputc(3); $r = $r . eputc((0xff & ($tempo >> 16))); $r = $r . eputc((0xff & ($tempo >> 8))); $r = $r . eputc((0xff & $tempo)); return($r); } function mf_write_midi_event($delta_time, $type, $chan, $data) { $i=0; $c = 0; $r = WriteVarLen($delta_time); $c = $type | $chan; $r = $r . eputc($c); for($i = 0; $i < count($data); $i++) $r = $r . eputc($data[$i]); return($r); } function data($p1,$p2) { $r = array(); $r[0] = $p1; $r[1] = $p2; return($r); } function data1($p1) { $r = array(); $r[0] = $p1; return($r); } function end_track() { $r = ""; $r = $r . eputc(0); $r = $r . eputc(0xFF); $r = $r . eputc(0x2f); $r = $r . eputc(0); return($r); } function add_program($prg) { $r = ""; $r = mf_write_midi_event(0,0xc0,0,data1($prg)); return($r); } function note($s,$d,$p,&$td) { $r = ""; $r = $r . mf_write_midi_event($s,0x90,0,data($p,100)); $r = $r . mf_write_midi_event($d,0x80,0,data($p,0)); $td = $td . $r; //return($r); } function volume() { $r = ""; return($r); } function copy_right() { global $copy_right_string; $c = $copy_right_string; $r = ""; $r = $r . eputc(0); $r = $r . eputc(0xff); $r = $r . eputc(0x02); $r = $r . eputc(strlen($c)); $r = $r . $c; return($r); } function track_name($str) { $c = $str; $r = ""; $r = $r . eputc(0); $r = $r . eputc(0xff); $r = $r . eputc(0x03); $r = $r . eputc(strlen($c)); $r = $r . $c; return($r); } function volumeup() { $r = ""; $r = mf_write_midi_event(0,0xB0,0,data(0x07,127)); return($r); } function dotted($nt) { $r = $nt + ($nt/2); return($r); } function fdebug($str,$w=0) { if($w==0) { $f = fopen("debug.txt","a"); } else { $f = fopen("debug.txt","w"); } fputs($f,$str); fputs($f,"\n"); fclose($f); } function get_pitch($nt,$oc) { $nt = strtolower(trim($nt)); $r =0; if($nt == "p") { $r = -1; } else { switch($nt) { case "c" : $r = 0; break; case "c#" : $r = 1; break; case "d" : $r = 2; break; case "d#" : $r = 3; break; case "e" : $r = 4; break; case "f" : $r = 5; break; case "f#" : $r = 6; break; case "g" : $r = 7; break; case "g#" : $r = 8; break; case "a" : $r = 9; break; case "a#" : $r = 10; break; case "b" : $r = 11; break; } $r = 12 + (12*$oc) + $r; } return($r); } function get_time($t,$isd) { $r = 0; switch($t) { case 1 : $r = 1536; break; case 2 : $r = 768; break; case 4 : $r = 384; break; case 8 : $r = 192; break; case 16 : $r = 96; break; case 32 : $r = 48; break; case 64 : $r = 24; break; } if($isd) { $r = $r + ($r/2); } return($r); } function notes2midi() { $r = ""; $rest = 0; global $rtl_notes; $notes = $rtl_notes; $tmp = array(); for($a = 0; $a != count($notes); $a++) { $pt = get_pitch($notes[$a][1],$notes[$a][2]-1); $tm = get_time($notes[$a][0],$notes[$a][3]); if($pt == -1) { $rest = $rest + $tm; } else { note($rest,$tm,$pt,$r); $rest = 0; } } return($r); } $error_rtttl = "Error:d=32,o=5,b=63:4c,4e,4g,c,c,c,c"; $rtl_name = ""; $rtl_props = array(); $rtl_notes = array(); function clean_spaces($str) { $r = ereg_replace(" ","",$str); return($r); } function exist($c,$s) { $s = "!" . $s; $r = strpos($s,$c,0); return($r); } function is_dotted(&$nt) { $r = 0; for($a = 0; $a != strlen($nt); $a++) { if($nt[$a] == ".") { $nt[$a] = ""; $r = 1; break; } } // $b = trim($b); return($r); } function pharse_rtttl($str) { global $rtl_name; global $rtl_props; global $rtl_notes; $r = 0; $cnt = 0; $a = explode(":",$str); if(count($a) == 3) { $rtl_name = $a[0]; $b = explode(",",$a[1]); if(count($b) == 3) { if(exist("o",$a[1]) && exist("d",$a[1]) && exist("b",$a[1]) ) { $c = explode("=",$b[0]); $d = explode("=",$b[1]); $e = explode("=",$b[2]); $rtl_props = array( $c[0] => $c[1], $d[0] => $d[1], $e[0] => $e[1] ); $nts = explode(",",clean_spaces($a[2])); $time = ""; $pitch = ""; $octave = ""; $dotted = 0; while( list($a,$b) = each($nts) ) { $o = $b; list($time) = sscanf($b,"%d"); $b = strrev(substr($b,strlen($time),strlen($b) - strlen($time))); list($octave) = sscanf($b,"%d"); $b = strrev(substr($b,strlen($octave),strlen($b) - strlen($octave))); if(is_dotted($b)) { $dotted = 1; }else { $dotted = 0; } $pitch = $b; if($time == "") $time = $rtl_props["d"]; if($octave == "") $octave = $rtl_props["o"]; $rtl_notes[$cnt] = array($time,$pitch,$octave,$dotted); $cnt++; $r = 1; } } } } return($r); } ?> 7) # $rtl_notes[$tt][2]=7; # $rtl_notes[$tt][1] = trim($rtl_notes[$tt][1]); # } $tmpRun = 0; for($tt=1;$tt0) { $rtlNote2 = $rtl_notes[$tt-1][1]; $rtlOctave2 = $rtl_notes[$tt-1][2]; if($rtlNote==$rtlNote2 && $rtlOctave==$rtlOctave2) $kwsstring = $kwsstring . chr(0) . chr(0) . chr(8) . chr(0); } $kwsBPM = 125; if($rtlTime==1) $tmpTime = (2000 / $rtlBPM) * $kwsBPM; elseif($rtlTime==2) $tmpTime = (1000 / $rtlBPM) * $kwsBPM; elseif($rtlTime==4) $tmpTime = (500 / $rtlBPM) * $kwsBPM; elseif($rtlTime==8) $tmpTime = (250 / $rtlBPM) * $kwsBPM; elseif($rtlTime==16) $tmpTime = (125 / $rtlBPM) * $kwsBPM; elseif($rtlTime==32) $tmpTime = (63 / $rtlBPM) * $kwsBPM; if($rtlDotted) $tmpTime *= 1.5; $tmpTime = ceil($tmpTime); if($tmpTime <= 255) $kwsDur = chr($tmpTime) . chr(0); else { $tmpd = str_pad(dechex($tmpTime),4,"0",STR_PAD_LEFT); $tmpa = hexdec(substr($tmpd,0,2)); $tmpa1 = $tmpa << 1; $tmpb = hexdec(substr($tmpd,2,2)); $kwsDur = $tmpa1 ^ $tmpb; $kwsDur = chr($kwsDur) . chr($tmpa); } if($rtlNote != "p") { if($rtlOctave <= $autoOctave) $rtlOctave = 4; elseif($rtlOctave == $autoOctave+1) $rtlOctave = 5; elseif($rtlOctave >= $autoOctave+2) $rtlOctave = 6; #echo $rtlTime. $rtlNote . $rtlOctave . ""; if(stristr($rtlNote,"c#")) $mNote = 2; elseif(stristr($rtlNote,"c")) $mNote = 1; elseif(stristr($rtlNote,"d#")) $mNote = 4; elseif(stristr($rtlNote,"d")) $mNote = 3; elseif(stristr($rtlNote,"e")) $mNote = 5; elseif(stristr($rtlNote,"f#")) $mNote = 7; elseif(stristr($rtlNote,"f")) $mNote = 6; elseif(stristr($rtlNote,"g#")) $mNote = 9; elseif(stristr($rtlNote,"g")) $mNote = 8; elseif(stristr($rtlNote,"a#")) $mNote = 11; elseif(stristr($rtlNote,"a")) $mNote = 10; elseif(stristr($rtlNote,"b")) $mNote = 12; #echo $mNote . " "; $mNote = (12 * ($rtlOctave - 5)) + $mNote; $kwsNote = chr($mNote) . chr(4); }else { $kwsNote = chr(0) . chr(0); } $kwsstring .= $kwsNote . $kwsDur; } $kwsstring .= $kwsheader; return($kwsstring); #echo "Done"; } function getAutoOctave() { $tOctave = array(); $tOctNum = array(); $tOctCount = array(); global $rtl_notes; for($tCnt=0;$tCnt<=10;$tCnt++) { $tOctCount[$tCnt] = 0; $tOctNum[$tCnt] = $tCnt; } for($tCnt=0;$tCnt $tOctCount[$tj+1]) { $tmpInt = $tOctCount[$tj]; $tmpOctNum = $tOctNum[$tj]; $tOctCount[$tj] = $tOctCount[$tj+1]; $tOctNum[$tj] = $tOctNum[$tj+1]; $tOctCount[$tj+1] = $tmpInt; $tOctNum[$tj+1] = $tmpOctNum; } } } $tmpInt = 0; $tmpOctNum = 3; for($tCnt=0;$tCnt<3;$tCnt++) { if($tOctCount[10-$tCnt]==0) $tmpOctNum -= 1; else $tmpInt += $tOctNum[10-$tCnt]; } $tmpCnt = ($tmpInt / $tmpOctNum) - 1.5; $tmpCnt = ceil($tmpCnt); if($tmpCnt<4) $tmpCnt=4; return($tmpCnt); } ?> An error has occurredAHHHHHHHHHHHHHHHHHHHHMeRWiN's Ringtone Search
MeRWiN's Ringtone Search
Total Ringtones:
Ringtone Categories
Online RTTTL to Kyocera KWS Converter

All ringtones are in both RTTTL and MIDI formats and are for Nokia phones
News

MeRWiN's Ringtone Search (c)2000-2002 Justin Heiner

Unique Hits Today: 0
Page Views Today: 0
Total Unique Hits: 860,252
Total Page Views: 5,304,364
Counting since December 4, 2001