Skip to content

Commit

Permalink
Merge branch 'main' into from_borne
Browse files Browse the repository at this point in the history
  • Loading branch information
cervelas authored Jan 29, 2024
2 parents 4f92ed8 + 175c72f commit 09e0228
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
19 changes: 19 additions & 0 deletions borne/Classes/Tube.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,25 @@ public function getLyrics($csvfile){
}
return $lyrics;
}

public function getToplineChannel($tonality){
$top_channel = [
'D' => 10,
'Ab' => 11,
'C' => 9
];
return $top_channel[$tonality];
}

public function getToplinePitch(){
return rand(1,108);
}

public function getStopTopline(){
$sql = "SELECT * FROM midi_actions WHERE name = 'STOP_TOPLINE'";
$results = $this->query($sql);
return $results[0];
}

public function getToplineChannel($tonality){
$top_channel = [
Expand Down
12 changes: 9 additions & 3 deletions borne/create_tube.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
use Classes\Tube;
$midi_tube = new Tube();

$directory = strtolower($song_title);
setlocale(LC_CTYPE, 'fr_FR.UTF-8');
$url = 'http://192.168.1.20:23456/play';

$directory = strtolower($song_title);
$directory = iconv('UTF-8', 'ASCII//IGNORE', $directory);
$directory = str_replace([" ", "'", "", "-", "?", "!", ",", "&"],"", $directory);
$directory = $song_id.'_'.$directory;
Expand All @@ -26,10 +28,10 @@
include "json_init.php";

$url = 'http://192.168.1.20:23456/play';
fwrite($e, "avant");
fwrite($e, $json);

$json = json_encode(json_decode($json));


if(json_last_error() > 0){
echo "ERROR in JSON: " . json_last_error_msg();
var_dump($json);
Expand All @@ -53,6 +55,10 @@
throw new \Exception('SENDING SONG ERROR');
}

// Si on arrive là c'est que tout s'est bien passé !

echo "bravo ! le numero de ta chanson est le " . $json_obj->numero . "<br><a href='/index.php'>retour à la case départ</a>";

/*
if (!file_exists('audio/'.$directory)){
mkdir('audio/'.$directory, 0777, true);
Expand Down
4 changes: 2 additions & 2 deletions borne/did_getTalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$headers = [
'Content-Type: multipart/form-data',
'Accept: application/json',
'Authorization: Basic c2FsdXRAbXluYW1laXNmdXp6eS5jaA:N51ON3CPUu3QXeujqjDKr'
'Authorization: Basic bWFjaGluZUBteW5hbWVpc2Z1enp5LmNo:QTfYIk99xhvh2VOYa1gL3'
];

$file = new CURLFile($cereproc_audio_url, 'audio/mpeg', $_SESSION['song_id'].'.mp3');
Expand All @@ -31,7 +31,7 @@
$headers = [
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Basic c2FsdXRAbXluYW1laXNmdXp6eS5jaA:N51ON3CPUu3QXeujqjDKr'
'Authorization: Basic bWFjaGluZUBteW5hbWVpc2Z1enp5LmNo:QTfYIk99xhvh2VOYa1gL3'
];
$data = '{
"script": {
Expand Down
9 changes: 9 additions & 0 deletions borne/p1.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
"duration": 4
},';
}

if(in_array($section,$stop_topline)){
$note_pitch = $tube1->getChordPitch($stop_topline_note['step'],$stop_topline_note['do_alter'],$stop_topline_note['octave']);
$json .= '{
"beat": '.($measure * 4).',
"note": '.$note_pitch.',
"duration": 4
},';
}

if(in_array($section,$stop_topline)){
$note_pitch = $tube1->getChordPitch($stop_topline_note['step'],$stop_topline_note['do_alter'],$stop_topline_note['octave']);
Expand Down
3 changes: 3 additions & 0 deletions borne/p5.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"channel": 5,
"notes": [';

//$go_arpeggiato_note = $tube5->getGoDrums($song_style);
$measure = 1;

$go_arpeggiato_note = $tube5->getGoDrums($song_style);
$measure = 0;
$keys_used = array();
Expand Down

0 comments on commit 09e0228

Please sign in to comment.