* @category PHP
 * @package  /p-schedule/
 * @author   Fukuball Lin <*****@*****.**>
 * @license  No Licence
 * @version  Release: <1.0>
 * @link     http://sarasti.cs.nccu.edu.tw
 */
require_once dirname(dirname(__FILE__)) . "/p-config/application-setter.php";
$db_obj = LMDBAccess::getInstance();
$select_sql = "SELECT " . "id " . "FROM song " . "WHERE is_deleted = '0' " . "AND audio_path!='' " . "AND echonest_track_id!='' " . "AND retrieval_status='success' " . "ORDER BY id";
$query_result = $db_obj->selectCommand($select_sql);
$music_feature_god = new LMMusicFeatureGod();
// get unprocess data
foreach ($query_result as $query_result_data) {
    $song_obj = new LMSong($query_result_data['id']);
    $echonest_analysis_file = AUDIO_ROOT . '/' . $song_obj->getId() . '.json';
    $echonest_analysis = file_get_contents($echonest_analysis_file);
    $echonest_data = json_decode($echonest_analysis);
    $second = $echonest_data->meta->seconds;
    $bar_count = count($echonest_data->bars);
    $beat_count = count($echonest_data->beats);
    $tatum_count = count($echonest_data->tatums);
    $section_count = count($echonest_data->sections);
    $segment_count = count($echonest_data->segments);
    $bar_duration_sum = 0;
    foreach ($echonest_data->bars as $bars_data) {
        $bar_duration_sum = $bar_duration_sum + $bars_data->duration;
    }
    $bar_avg_second = $bar_duration_sum / $bar_count;
    echo "second: {$second} \n";
    echo "bar_count: {$bar_count} \n";
 * @package  /p-schedule/
 * @author   Fukuball Lin <*****@*****.**>
 * @license  No Licence
 * @version  Release: <1.0>
 * @link     http://sarasti.cs.nccu.edu.tw
 */
require_once dirname(dirname(__FILE__)) . "/p-config/application-setter.php";
$db_obj = LMDBAccess::getInstance();
$select_sql = "SELECT " . "id " . "FROM song " . "WHERE is_deleted = '0' " . "AND audio_path!='' " . "AND echonest_track_id!='' " . "AND retrieval_status='success' " . "ORDER BY id";
$query_result = $db_obj->selectCommand($select_sql);
$music_feature_god = new LMMusicFeatureGod();
// get unprocess data
foreach ($query_result as $query_result_data) {
    echo "song_id: " . $query_result_data['id'] . " \n";
    $song_obj = new LMSong($query_result_data['id']);
    $echonest_analysis_file = AUDIO_ROOT . '/' . $song_obj->getId() . '.json';
    $echonest_analysis = file_get_contents($echonest_analysis_file);
    $echonest_data = json_decode($echonest_analysis);
    $song_section_array = array();
    foreach ($echonest_data->bars as $section_data) {
        array_push($song_section_array, $section_data->start);
    }
    array_push($song_section_array, 100000);
    $song_audio_word_array = array();
    $song_audio_word_count_array = array();
    $song_audio_word_timbre_array = array();
    $song_audio_word_count_timbre_array = array();
    foreach ($echonest_data->segments as $segments_data) {
        $pitch_start = $segments_data->start;
        foreach ($song_section_array as $key => $section_start) {
            if ($section_start != 100000) {
Exemplo n.º 3
0
          echo $similar;
          ?>
               </td>
            </tr>
            <?php 
          unset($similar_song_obj);
          unset($artist_obj);
      }
  }
  ?>
      </tbody>
 </table>
 <hr />
 <?php 
  $music_feature_god = new LMMusicFeatureGod();
  $music_feature_id = $music_feature_god->findBySongId($song_obj->getId());
  if ($music_feature_id) {
      $music_feature_obj = new LMMusicFeature($music_feature_id);
      ?>
 <h2>音樂特徵值</h2>
 <table class="table table-bordered table-striped">
    <thead>
       <tr>
          <th>種類</th>
          <th>Feature</th>
          <th>Value</th>
       </tr>
    </thead>
    <tbody>
       <tr>
          <td rowspan="2"></td>
Exemplo n.º 4
0
 * @version  Release: <1.0>
 * @link     http://sarasti.cs.nccu.edu.tw
 */
$song_num = 0;
foreach ($song_list as $song_list_data) {
    $song_num++;
    $song_obj = new LMSong($song_list_data['id']);
    $artist_obj = new LMPerformer($song_obj->performer_id);
    ?>
<tr width="1000px">
   <td width="50px">
      <a href="<?php 
    echo SITE_HOST;
    ?>
/music/song/index.php?song_id=<?php 
    echo $song_obj->getId();
    ?>
"><?php 
    echo $song_obj->getId();
    ?>
</a>
   </td>
   <td width="50px">
      <?php 
    echo $artist_obj->name;
    ?>
   </td>
   <td width="100px">
      <a href="<?php 
    echo SITE_HOST;
    ?>
Exemplo n.º 5
0
 *
 * @category PHP
 * @package  /p-schedule/
 * @author   Fukuball Lin <*****@*****.**>
 * @license  No Licence
 * @version  Release: <1.0>
 * @link     http://sarasti.cs.nccu.edu.tw
 */
require_once dirname(dirname(__FILE__)) . "/p-config/application-setter.php";
$db_obj = LMDBAccess::getInstance();
$select_sql = "SELECT " . "id " . "FROM song " . "WHERE is_deleted = '0' " . "AND audio_path!='' " . "AND echonest_track_id='' " . "AND retrieval_status='queue' " . "ORDER BY id";
$query_result = $db_obj->selectCommand($select_sql);
// get unprocess data
foreach ($query_result as $query_result_data) {
    $song_obj = new LMSong($query_result_data['id']);
    echo "upload " . $song_obj->getId() . " \n";
    $echonest_upload_return = shell_exec('curl -X POST -H "Content-Type:application/octet-stream" ' . '"http://developer.echonest.com/api/v4/track/upload?api_key=' . ECHONEST_KEY . '&filetype=mp3" ' . '--data-binary "@' . $song_obj->audio_path . '"');
    $echonest_upload_return_jdecode = json_decode($echonest_upload_return);
    if ($echonest_upload_return_jdecode->response->status->message == "Success") {
        echo "upload " . $song_obj->getId() . " success. \n";
        echo "analyze " . $song_obj->getId() . " \n";
        $echonest_track_id = $echonest_upload_return_jdecode->response->track->id;
        $echonest_analyze_return = shell_exec('curl -F "api_key=' . ECHONEST_KEY . '" ' . '-F "format=json" -F "id=' . $echonest_track_id . '" ' . '-F "bucket=audio_summary" "http://developer.echonest.com/api/v4/track/analyze"');
        $echonest_analyze_return_jdecode = json_decode($echonest_analyze_return);
        if ($echonest_analyze_return_jdecode->response->status->message == "Success") {
            echo "analyze " . $song_obj->getId() . " success. \n";
            $key = $echonest_analyze_return_jdecode->response->track->audio_summary->key;
            $mode = $echonest_analyze_return_jdecode->response->track->audio_summary->mode;
            $tempo = $echonest_analyze_return_jdecode->response->track->audio_summary->tempo;
            $time_signature = $echonest_analyze_return_jdecode->response->track->audio_summary->time_signature;
            $energy = $echonest_analyze_return_jdecode->response->track->audio_summary->energy;