Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
@ -1,61 +0,0 @@
|
|||||||
:root {
|
|
||||||
--primary-color: #6A5ACD; /* SlateBlue */
|
|
||||||
--secondary-color: #48D1CC; /* MediumTurquoise */
|
|
||||||
--background-color: #F5F5F5; /* WhiteSmoke */
|
|
||||||
--surface-color: #FFFFFF;
|
|
||||||
--text-color: #333333;
|
|
||||||
--border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
background-color: var(--background-color);
|
|
||||||
color: var(--text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: var(--primary-color);
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
border: none;
|
|
||||||
background-color: var(--surface-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#visualizer {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
font-weight: 700;
|
|
||||||
transition: background-color 0.3s ease, transform 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #5948c1; /* Darker SlateBlue */
|
|
||||||
border-color: #5948c1;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:focus, .btn-primary.focus {
|
|
||||||
box-shadow: 0 0 0 0.2rem rgba(106, 90, 205, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:disabled {
|
|
||||||
background-color: #b5a9e8;
|
|
||||||
border-color: #b5a9e8;
|
|
||||||
}
|
|
||||||
|
|
||||||
#status {
|
|
||||||
color: #6c757d;
|
|
||||||
min-height: 24px;
|
|
||||||
}
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const startButton = document.getElementById('startButton');
|
|
||||||
const canvas = document.getElementById('visualizer');
|
|
||||||
const statusEl = document.getElementById('status');
|
|
||||||
const canvasCtx = canvas.getContext('2d');
|
|
||||||
|
|
||||||
let audioContext;
|
|
||||||
let analyser;
|
|
||||||
let dataArray;
|
|
||||||
let bufferLength;
|
|
||||||
let animationFrameId;
|
|
||||||
let isVisualizing = false;
|
|
||||||
|
|
||||||
const draw = () => {
|
|
||||||
animationFrameId = requestAnimationFrame(draw);
|
|
||||||
|
|
||||||
analyser.getByteTimeDomainData(dataArray);
|
|
||||||
|
|
||||||
canvasCtx.fillStyle = '#f8f9fa'; // Light gray background
|
|
||||||
canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
|
|
||||||
|
|
||||||
const gradient = canvasCtx.createLinearGradient(0, 0, canvas.width, 0);
|
|
||||||
gradient.addColorStop(0, '#6A5ACD'); // SlateBlue
|
|
||||||
gradient.addColorStop(1, '#48D1CC'); // MediumTurquoise
|
|
||||||
canvasCtx.strokeStyle = gradient;
|
|
||||||
|
|
||||||
canvasCtx.lineWidth = 3;
|
|
||||||
canvasCtx.beginPath();
|
|
||||||
|
|
||||||
const sliceWidth = canvas.width * 1.0 / bufferLength;
|
|
||||||
let x = 0;
|
|
||||||
|
|
||||||
for (let i = 0; i < bufferLength; i++) {
|
|
||||||
const v = dataArray[i] / 128.0;
|
|
||||||
const y = v * canvas.height / 2;
|
|
||||||
|
|
||||||
if (i === 0) {
|
|
||||||
canvasCtx.moveTo(x, y);
|
|
||||||
} else {
|
|
||||||
canvasCtx.lineTo(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
x += sliceWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
canvasCtx.lineTo(canvas.width, canvas.height / 2);
|
|
||||||
canvasCtx.stroke();
|
|
||||||
};
|
|
||||||
|
|
||||||
const startVisualization = async () => {
|
|
||||||
if (isVisualizing) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: false });
|
|
||||||
|
|
||||||
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
||||||
analyser = audioContext.createAnalyser();
|
|
||||||
|
|
||||||
const source = audioContext.createMediaStreamSource(stream);
|
|
||||||
source.connect(analyser);
|
|
||||||
|
|
||||||
analyser.fftSize = 2048;
|
|
||||||
bufferLength = analyser.frequencyBinCount;
|
|
||||||
dataArray = new Uint8Array(bufferLength);
|
|
||||||
|
|
||||||
canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
||||||
|
|
||||||
isVisualizing = true;
|
|
||||||
startButton.disabled = true;
|
|
||||||
startButton.innerHTML = `
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-soundwave" viewBox="0 0 16 16">
|
|
||||||
<path fill-rule="evenodd" d="M8.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-1 0v-11a.5.5 0 0 1 .5-.5zm-2 2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zm4 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zm-6 1.5A.5.5 0 0 1 5 6v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm8 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm-10 1A.5.5 0 0 1 3 7v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5zm12 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5z"/>
|
|
||||||
</svg>
|
|
||||||
Visualizing...`;
|
|
||||||
statusEl.textContent = 'Your voice is being visualized in real-time.';
|
|
||||||
|
|
||||||
draw();
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error accessing microphone:', err);
|
|
||||||
statusEl.textContent = 'Could not access microphone. Please check permissions and try again.';
|
|
||||||
statusEl.style.color = 'red';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
startButton.addEventListener('click', startVisualization);
|
|
||||||
|
|
||||||
// Clean up on page unload
|
|
||||||
window.addEventListener('beforeunload', () => {
|
|
||||||
if (audioContext) {
|
|
||||||
audioContext.close();
|
|
||||||
}
|
|
||||||
if (animationFrameId) {
|
|
||||||
cancelAnimationFrame(animationFrameId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
148
index.php
148
index.php
@ -1,43 +1,131 @@
|
|||||||
<!DOCTYPE html>
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
@ini_set('display_errors', '1');
|
||||||
|
@error_reporting(E_ALL);
|
||||||
|
@date_default_timezone_set('UTC');
|
||||||
|
|
||||||
|
$phpVersion = PHP_VERSION;
|
||||||
|
$now = date('Y-m-d H:i:s');
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Real-time Voice Visualizer</title>
|
<title>New Style</title>
|
||||||
<meta name="description" content="A web application that captures audio input in real-time and visualizes it as dynamic charts or graphs.">
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
<style>
|
||||||
<meta name="robots" content="noindex, nofollow">
|
:root {
|
||||||
|
--bg-color-start: #6a11cb;
|
||||||
|
--bg-color-end: #2575fc;
|
||||||
|
--text-color: #ffffff;
|
||||||
|
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||||
|
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||||
|
color: var(--text-color);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
body::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||||
|
animation: bg-pan 20s linear infinite;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
@keyframes bg-pan {
|
||||||
|
0% { background-position: 0% 0%; }
|
||||||
|
100% { background-position: 100% 100%; }
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background: var(--card-bg-color);
|
||||||
|
border: 1px solid var(--card-border-color);
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 2rem;
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
-webkit-backdrop-filter: blur(20px);
|
||||||
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.loader {
|
||||||
|
margin: 1.25rem auto 1.25rem;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||||
|
border-top-color: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
from { transform: rotate(0deg); }
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
.hint {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.sr-only {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px; height: 1px;
|
||||||
|
padding: 0; margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap; border: 0;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
background: rgba(0,0,0,0.2);
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 1rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<main>
|
||||||
<header class="text-center p-4">
|
<div class="card">
|
||||||
<h1>Voice Visualizer</h1>
|
<h1>Analyzing your requirements and generating your website…</h1>
|
||||||
</header>
|
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||||
|
<span class="sr-only">Loading…</span>
|
||||||
<main class="container text-center">
|
|
||||||
<div class="card shadow-sm">
|
|
||||||
<div class="card-body">
|
|
||||||
<canvas id="visualizer" width="800" height="300"></canvas>
|
|
||||||
<p id="status" class="mt-3">Click the button to start visualizing your voice.</p>
|
|
||||||
<button id="startButton" class="btn btn-primary btn-lg mt-2">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-mic-fill" viewBox="0 0 16 16">
|
|
||||||
<path d="M5 3a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0V3z"/>
|
|
||||||
<path d="M3.5 6.5A.5.5 0 0 1 4 7v1a4 4 0 0 0 8 0V7a.5.5 0 0 1 1 0v1a5 5 0 0 1-4.5 4.975V15h3a.5.5 0 0 1 0 1h-7a.5.5 0 0 1 0-1h3v-2.025A5 5 0 0 1 3 8V7a.5.5 0 0 1 .5-.5z"/>
|
|
||||||
</svg>
|
|
||||||
Start Visualization
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWiZZy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||||
|
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||||
|
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
<footer>
|
||||||
<footer class="text-center p-4 mt-5">
|
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||||
<p class="text-muted">Powered by Flatlogic.</p>
|
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user