96 lines
3.3 KiB
PHP
Executable File
96 lines
3.3 KiB
PHP
Executable File
<?php
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
session_start();
|
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|
$version = "1.0";
|
|
require "$root/database/credentials.php";
|
|
// Connect the database
|
|
try {
|
|
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
|
|
$user,
|
|
$password,
|
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
|
));
|
|
} catch (Exception $e) {
|
|
die("Error : ".$e->getMessage());
|
|
}
|
|
if (isset($_GET['record'])) {
|
|
$req = $db->prepare('SELECT id, recordist_name, file_name, license, species, sound_type, date, time FROM `records` WHERE id=:id');
|
|
$req->execute(array(
|
|
"id"=>$_GET['record']
|
|
));
|
|
} else {
|
|
$req = $db->prepare('SELECT id, recordist_name, file_name, license, species, sound_type, date, time FROM `records` ORDER BY date DESC, time DESC LIMIT 1');
|
|
$req->execute();
|
|
}
|
|
$data = $req->fetch();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Larynx | Chiro - Canto</title>
|
|
<link rel="stylesheet" type="text/css" href="/styles/style.css">
|
|
</head>
|
|
<?php
|
|
include("$root/analytics/owa.php");
|
|
include("$root/analytics/matomo.php");
|
|
?>
|
|
<?php
|
|
include("$root/analytics/matomo.php");
|
|
?>
|
|
<body>
|
|
<?php include("$root/menu.php");?>
|
|
<?php include("$root/header.php");?>
|
|
<section>
|
|
<h2>Larynx</h2>
|
|
<p>A web tool for bat sound analysis</p>
|
|
<a href="#larynx">
|
|
<div class="arrow bounce"></div>
|
|
</a>
|
|
</section>
|
|
<div id="larynx">
|
|
<h2>Larynx v<?=$version?></h2>
|
|
|
|
<audio src="<?="/storage/records/".$data['file_name']?>" id="audio"></audio>
|
|
<div class="spectrogram">
|
|
<div id="waveform"></div>
|
|
<div id="wave-spectrogram">
|
|
<!-- <canvas id="spectrogram"></canvas> -->
|
|
</div>
|
|
<div class="container row">
|
|
<div class="measures">
|
|
T:
|
|
<span id="cursor-time"></span>
|
|
s F:
|
|
<span id="cursor-frequency"></span>
|
|
kHz
|
|
</div>
|
|
<div class="controls">
|
|
<input type="button" name="play" value="play" id="play">
|
|
<input type="button" value="pause" id="pause">
|
|
<input type="button" value="restart" id="restart">
|
|
</div>
|
|
</div>
|
|
<p class="license"><?=$data['license']?> <?=$data['recordist_name']?></p>
|
|
<div class="settings">
|
|
<input type="checkbox" name="exp_x10" id="exp_x10">
|
|
<label for="exp_x10">exp x10</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php include("$root/footer.php");?>
|
|
</body>
|
|
<script src="/scripts/script.js"></script>
|
|
<script src="https://unpkg.com/wavesurfer.js"></script>
|
|
<script src="https://unpkg.com/wavesurfer.js/dist/plugin/wavesurfer.spectrogram.min.js" type="text/javascript"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/p5.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/addons/p5.sound.js"></script>
|
|
<script src="scripts/spectro.js"></script>
|
|
<!-- <script src="scripts/piano.js"></script> -->
|
|
|
|
</html>
|