Skip to content

Instantly share code, notes, and snippets.

@sidekickDan
Forked from sonnm/mooer.php
Created January 5, 2022 08:28
Show Gist options
  • Save sidekickDan/3e4d602b920ad9daf95ac30367500872 to your computer and use it in GitHub Desktop.
Save sidekickDan/3e4d602b920ad9daf95ac30367500872 to your computer and use it in GitHub Desktop.
Convert GE200 preset file to GE 150
<?php
if (isset($_POST["submit"])) {
$content = file_get_contents($_FILES["file"]["tmp_name"]);
$array = unpack("C*", $content);
//print_r($array);
$effectModule = [];
//FX/COMP 541 - 548
$effectModule['FX/COMP']['TYPE'] = $array[541] - 1;
$effectModule['FX/COMP']['SWITCH'] = $array[542];
$effectModule['FX/COMP']['Data']['ATTACK'] = $array[543];
$effectModule['FX/COMP']['Data']['THRES'] = $array[544];
$effectModule['FX/COMP']['Data']['RATIO'] = $array[545];
$effectModule['FX/COMP']['Data']['LEVEL'] = $array[546];
//DS/OD 549 - 556
$effectModule['DS/OD']['TYPE'] = $array[549] - 1;
$effectModule['DS/OD']['SWITCH'] = $array[542];
$effectModule['DS/OD']['Data']['VOLUME'] = $array[551];
$effectModule['DS/OD']['Data']['TONE'] = $array[552];
$effectModule['DS/OD']['Data']['GAIN'] = $array[553];
//AMP 557 - 564
$effectModule['AMP']['TYPE'] = $array[557] - 1;
$effectModule['AMP']['SWITCH'] = $array[558];
$effectModule['AMP']['Data']['GAIN'] = $array[559];
$effectModule['AMP']['Data']['BASS'] = $array[560];
$effectModule['AMP']['Data']['MID'] = $array[561];
$effectModule['AMP']['Data']['TREBLE'] = $array[562];
$effectModule['AMP']['Data']['PRES'] = $array[563];
$effectModule['AMP']['Data']['MST'] = $array[564];
//CAB 565 - 572
$effectModule['CAB']['TYPE'] = $array[565] - 1;
$effectModule['CAB']['SWITCH'] = $array[566];
$effectModule['CAB']['Data']['TUBE'] = $array[559];
$effectModule['CAB']['Data']['MIC'] = $array[567];
$effectModule['CAB']['Data']['CENTER'] = $array[568];
$effectModule['CAB']['Data']['DISTANCE'] = $array[569];
//NS GATE 573 - 580
$effectModule['NS GATE']['TYPE'] = $array[573] - 1;
$effectModule['NS GATE']['SWITCH'] = $array[574];
$effectModule['NS GATE']['Data']['ATTACK'] = $array[575];
$effectModule['NS GATE']['Data']['RELEASE'] = $array[576];
$effectModule['NS GATE']['Data']['THRES'] = $array[577];
//DELAY 597
$effectModule['DELAY']['TYPE'] = $array[597] - 1;
$effectModule['DELAY']['SWITCH'] = $array[598];
$effectModule['DELAY']['Data']['LEVEL'] = $array[599];
$effectModule['DELAY']['Data']['SUB-D'] = $array[604];
$effectModule['DELAY']['Data']['TIME'] = @array_shift(unpack('S*', $content[862] . $content[863]));
$effectModule['DELAY']['Data']['FEEDBACK'] = $array[600];
//REVERB 605
$effectModule['REVERB']['TYPE'] = $array[605] - 1;
$effectModule['REVERB']['SWITCH'] = $array[606];
$effectModule['REVERB']['Data']['PRE DELAY'] = $array[607];
$effectModule['REVERB']['Data']['LEVEL'] = $array[608];
$effectModule['REVERB']['Data']['DECAY'] = $array[609];
$effectModule['REVERB']['Data']['TONE'] = $array[610];
//EQ 581
$effectModule['EQ']['TYPE'] = $array[581] - 1;
$effectModule['EQ']['SWITCH'] = $array[582];
if ($effectModule['EQ']['TYPE'] == 1) {
$effectModule['EQ']['Data']['80Hz'] = 16 + ($array[583] - 12);
$effectModule['EQ']['Data']['240Hz'] = 16 + ($array[584] - 12);
$effectModule['EQ']['Data']['750Hz'] = 16 + ($array[585] - 12);
$effectModule['EQ']['Data']['2.2KHz'] = 16 + ($array[586] - 12);
$effectModule['EQ']['Data']['6.6KHz'] = 16 + ($array[587] - 12);
} elseif ($effectModule['EQ']['TYPE'] == 2) {
$effectModule['EQ']['Data']['100Hz'] = 16 + ($array[583] - 12);
$effectModule['EQ']['Data']['200Hz'] = 16 + ($array[584] - 12);
$effectModule['EQ']['Data']['400Hz'] = 16 + ($array[585] - 12);
$effectModule['EQ']['Data']['800Hz'] = 16 + ($array[586] - 12);
$effectModule['EQ']['Data']['1.6KHz'] = 16 + ($array[587] - 12);
$effectModule['EQ']['Data']['3.2KHz'] = 16 + ($array[588] - 12);
}
//MOD 589 - 596
$effectModule['MOD']['TYPE'] = $array[589] - 1;
$effectModule['MOD']['SWITCH'] = $array[590];
$effectModule['MOD']['Data']['LEVEL'] = $array[592];
$effectModule['MOD']['Data']['DEPTH'] = $array[593];
$effectModule['MOD']['Data']['RATE'] = $array[591];
$presetName = ucwords(preg_replace('/[^A-Za-z0-9\-]/', '', (trim(substr($content, 524, 16)))));
$fileInfo = [
'app' => 'GE150 Edit',
'app_version' => 'V1.1.0',
'device' => 'MOOER GE150',
'preset_name' => $presetName,
'schema' => 'GE150 Preset',
'device_version' => 'V1.1.0',
];
header('Content-disposition: attachment; filename=' . $presetName . '.mo');
header('Content-Type: application/json');
echo json_encode([
'effectModule' => $effectModule,
'Exp' => [
'VOL_MIN' => 0,
'FUN_SWITCH' => 0,
'VOL_MAX' => 100,
'PARA_CTRL' => 1,
'MODULE_CTRL' => 0,
'VOL_SWITCH' => 0,
],
'fileInfo' => $fileInfo,
]);
exit();
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>GE200 TO GE150</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment