Codice Midi postato il 27/06/2005 22:37:48 nel forum programmazione, gdrcd e open source
Qualche veterano di php conosce il codice (in php) per far partire un file audio midi o mp3?
Ho provato nei modi più svariati e fantasiosi, ma non ci riesco.
Grazie anticipatamente a chiunque posti in questo 3d.
Pagine → 1
27/06/2005 23:17:49
Questo è il codice classico per inserire musica di sottofondo:
<BGSOUND SRC="nomefile.wav" LOOP=INFINITE>
Con questo codice invece puoi far si che carichi una musica di sottofondo RANDOM ad ogni visita. Se vuoi inserire una sola canzone, bhè, elimina un pò di righe dal codice ed il gioco è fatto..
<?php
// Beginning php
// Saving the page header in the variable $head.
$head = <<<ENDH
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Achtergrondmuziek</title>
</head>
<body topmargin="0" leftmargin="0" text="#ffffff" link="#FE683A" vlink="#000000" alink="#000080" bgcolor="#FFFFFF" background="/images/linker-menu-achtergrond.gif">
ENDH;
// End of page header
// Saving the page footer in the variable $tail.
$tail = <<<ENDT
</body>
</html>
ENDT;
// End of page footer
// Set up variables that will be saved in the cookies
// Define unique cookie prefix
$ID = "Jubal-achtergrondmuziek";
// Cookie lifetime in seconds (in this example, three days)
$cookie_life = 365*24*3600;
// Name of cookie that holds the user`s preference
$n_pref = $ID . "_Preference";
// this part creates a random background music with title
// makes sure the random number really is random
mt_srand ((double) microtime() * 1000000);
// creates a random number
$number = mt_rand (1, 25);
if ($number == (1)) {
$midifile=("/multimedia/midifiles/change_the_world.mid");
$midititle="Change the world";
$timervalue=256000;
}
if ($number == (2)){
$midifile=("/multimedia/midifiles/iwillal.mid");
$midititle="I will always love you";
$timervalue=256000;
}
if ($number == (3)){
$midifile=("/multimedia/midifiles/layla.mid");
$midititle="Layla";
$timervalue=322000;
}
if ($number == (4)){
$midifile=("/multimedia/midifiles/tearsihe.mid");
$midititle="Tears in heaven";
$timervalue=284000;
}
if ($number == (5)){
$midifile=("/multimedia/midifiles/when-you-believe.mid");
$midititle="When you believe";
$timervalue=273000;
}
if ($number == (6)){
$midifile=("/multimedia/midifiles/white_ro.mid");
$midititle="White Rose";
$timervalue=356000;
}
if ($number == (7)){
$midifile=("/multimedia/midifiles/wonderfu.mid");
$midititle="Wonderful World";
$timervalue=247000;
}
if ($number == (8)){
$midifile=("/multimedia/midifiles/1492.mid");
$midititle="1492";
$timervalue=312000;
}
if ($number == (9)){
$midifile=("/multimedia/midifiles/bestfrnd.mid");
$midititle="You`re my best friend";
$timervalue=191000;
}
if ($number == (10)){
$midifile=("/multimedia/midifiles/bohemian.mid");
$midititle="Bohemian Rhapsody";
$timervalue=350000;
}
if ($number == (11)){
$midifile=("/multimedia/midifiles/the_empire_strikes_back.mid");
$midititle="The empire strikes back";
$timervalue=225000;
}
if ($number == (12)){
$midifile=("/multimedia/midifiles/indysong.mid");
$midititle="Indiana Jones";
$timervalue=330000;
}
if ($number == (13)){
$midifile=("/multimedia/midifiles/5thbeethoven.mid");
$midititle="5de Beethoven";
$timervalue=555000;
}
if ($number == (14)){
$midifile=("/multimedia/midifiles/cats_memory.mid");
$midititle="Cats Memory";
$timervalue=240000;
}
if ($number == (15)){
$midifile=("/multimedia/midifiles/d_queen.mid");
$midititle="Dancing Queen";
$timervalue=250000;
}
if ($number == (16)){
$midifile=("/multimedia/midifiles/don`t_cry_for_me_argentina.mid");
$midititle="Don`t cry for me Argentina";
$timervalue=362000;
}
if ($number == (17)){
$midifile=("/multimedia/midifiles/fernando.mid");
$midititle="Fernando";
$timervalue=275000;
}
if ($number == (18)){
$midifile=("/multimedia/midifiles/mammamia.mid");
$midititle="Mammamia";
$timervalue=233000;
}
if ($number == (19)){
$midifile=("/multimedia/midifiles/msaigong.mid");
$midititle="Miss Saigon";
$timervalue=552000;
}
if ($number == (20)){
$midifile=("/multimedia/midifiles/phantom.mid");
$midititle="the Phantom of the Opera";
$timervalue=270000;
}
if ($number == (21)){
$midifile=("/multimedia/midifiles/summerlovegrease.mid");
$midititle="Summerlove Grease";
$timervalue=220000;
}
if ($number == (22)){
$midifile=("/multimedia/midifiles/waterloo.mid");
$midititle="Waterloo";
$timervalue=190000;
}
if ($number == (23)){
$midifile=("/multimedia/midifiles/whatsup.mid");
$midititle="What`s up";
$timervalue=325000;
}
if ($number == (24)){
$midifile=("/multimedia/midifiles/bitdust2.mid");
$midititle="Another one bites the Dust";
$timervalue=192000;
}
if ($number == (25)){
$midifile=("/multimedia/midifiles/i_would_do_anything_for_love.mid");
$midititle="I would do anything for love";
$timervalue=145000;
}
// when a form is used to come to this page
if( isset($preference)) {
if ($preference == "on") {
$$n_pref = "on";
Setcookie($n_pref,"on",time()+$cookie_life);
}
else {
$$n_pref = "off";
Setcookie($n_pref,"off",time()+$cookie_life);
}
}
// users who not have been here before
// the cookie will have no value
if(!$$n_pref) {
$text ="you are new";
Setcookie($n_pref,"on",time()+$cookie_life);
$$n_pref="on";
}
// and the one`s coming back
//
// else {
// $text = $$n_pref;
// }
echo $head;
echo "<table border=0 cellpadding=0 cellspacing=0 width=115><tr><td width=100><img border=0 src=images/logo-online.gif valign=top align=top></td></tr><tr><td><center>";
if ($$n_pref =="on") {
echo "<EMBED SRC=";
echo $midifile;
echo " WIDTH=0 HEIGHT=0 AUTOSTART=TRUE>";
echo "<small><small>Achtergrondmuziek: </small><b>";
echo $midititle;
echo "</b>";
// setTimeout("parent.midiframe.location.href=`midi.html`", timer) ;
echo "<script>setTimeout(`parent.midiframe.location.href=";
echo $PHP_SELF;
echo "?preference=on`,";
echo $timervalue;
echo " );";
echo "</script>";
?>
<form action="<?php echo $PHP_SELF ?>" method="POST">
<input name="preference" type="hidden" value="off">
<input type=submit value="Muziek uit"></form>
<?php
}
else
{
?>
<form action="<?php echo $PHP_SELF ?>" method="POST">
<input name="preference" type="hidden" value="on">
<input type=submit value="Muziek aan"></form>
<?php
echo "<small><small>(Momenteel heeft u geen achtergrondmuziek aan staan)<br></small></small>";
}
echo "</center></td><td width=15></td></tr></table>";
echo $tail;
?>
28/06/2005 12:30:15
La canzone si chiama LYLA!!!!!
30/06/2005 00:56:32
Pongo questa domanda ai gestori delle Land che hanno già integrato il midi nelle schede o a chi conosce la legge:
Ci sono problemi (dal punto di vista legale) se un utente linkasse nella propria scheda una canzone coperta copyright?
Noi gestori cosa dovremmo fare? Pagare la SIAE?
Marco
30/06/2005 18:13:12
Credo che per i midi non ci voglia la SIAE, perché sono adattamenti e non è lo spartito originale. Infatti in genere un midi differisce almeno un po` da ciò che ha scritto in principio l`autore.
Se fossero MP3 dovresti pagare i diritti, che per una radio amatoriale erano circa mi pare 100 o 200 € al mese. Ma tanto non ti controlla nessuno...
Pagine → 1
Rispondi alla Discussione Aggiungi ai Preferiti Inoltra Discussione Forum Programmazione, GDRCD e Open Source Elenco Forum
I dati del generatore di rank sono stati aggiornati!