Spaces:
Running
Running
make it to where the app remembers the uploaded file name and any download has a modifier of that added at end. Also add noise & masking reduction for vocal processing to the speech enhancement.
Browse files- README.md +8 -5
- components/footer.js +109 -0
- components/navbar.js +75 -0
- index.html +126 -19
- script.js +164 -0
- style.css +29 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: SonicSculptor AI 🎙️✨
|
| 3 |
+
colorFrom: red
|
| 4 |
+
colorTo: blue
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
components/footer.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
footer {
|
| 7 |
+
background: linear-gradient(135deg, rgba(20, 20, 20, 0.95) 0%, rgba(40, 10, 70, 0.95) 100%);
|
| 8 |
+
color: white;
|
| 9 |
+
padding: 2rem;
|
| 10 |
+
text-align: center;
|
| 11 |
+
margin-top: auto;
|
| 12 |
+
backdrop-filter: blur(10px);
|
| 13 |
+
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
| 14 |
+
}
|
| 15 |
+
.footer-content {
|
| 16 |
+
max-width: 1200px;
|
| 17 |
+
margin: 0 auto;
|
| 18 |
+
display: grid;
|
| 19 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 20 |
+
gap: 2rem;
|
| 21 |
+
text-align: left;
|
| 22 |
+
}
|
| 23 |
+
.footer-section h3 {
|
| 24 |
+
font-size: 1.1rem;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
color: #d6bcfa;
|
| 27 |
+
}
|
| 28 |
+
.footer-section ul {
|
| 29 |
+
list-style: none;
|
| 30 |
+
padding: 0;
|
| 31 |
+
}
|
| 32 |
+
.footer-section li {
|
| 33 |
+
margin-bottom: 0.5rem;
|
| 34 |
+
}
|
| 35 |
+
.footer-section a {
|
| 36 |
+
color: #cbd5e0;
|
| 37 |
+
text-decoration: none;
|
| 38 |
+
transition: color 0.2s;
|
| 39 |
+
}
|
| 40 |
+
.footer-section a:hover {
|
| 41 |
+
color: #9f7aea;
|
| 42 |
+
}
|
| 43 |
+
.social-links {
|
| 44 |
+
display: flex;
|
| 45 |
+
gap: 1rem;
|
| 46 |
+
justify-content: center;
|
| 47 |
+
margin-top: 1.5rem;
|
| 48 |
+
}
|
| 49 |
+
.social-links a {
|
| 50 |
+
color: white;
|
| 51 |
+
transition: color 0.2s;
|
| 52 |
+
}
|
| 53 |
+
.social-links a:hover {
|
| 54 |
+
color: #9f7aea;
|
| 55 |
+
}
|
| 56 |
+
.copyright {
|
| 57 |
+
margin-top: 2rem;
|
| 58 |
+
font-size: 0.9rem;
|
| 59 |
+
color: #a0aec0;
|
| 60 |
+
}
|
| 61 |
+
@media (max-width: 768px) {
|
| 62 |
+
.footer-content {
|
| 63 |
+
grid-template-columns: 1fr;
|
| 64 |
+
text-align: center;
|
| 65 |
+
}
|
| 66 |
+
.social-links {
|
| 67 |
+
justify-content: center;
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
</style>
|
| 71 |
+
<footer>
|
| 72 |
+
<div class="footer-content">
|
| 73 |
+
<div class="footer-section">
|
| 74 |
+
<h3>VoiceCraft AI</h3>
|
| 75 |
+
<p>Advanced speech processing powered by SpeechBrain and SciPy.</p>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="footer-section">
|
| 78 |
+
<h3>Quick Links</h3>
|
| 79 |
+
<ul>
|
| 80 |
+
<li><a href="#">Home</a></li>
|
| 81 |
+
<li><a href="#">Documentation</a></li>
|
| 82 |
+
<li><a href="#">API Reference</a></li>
|
| 83 |
+
<li><a href="#">Examples</a></li>
|
| 84 |
+
</ul>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="footer-section">
|
| 87 |
+
<h3>Resources</h3>
|
| 88 |
+
<ul>
|
| 89 |
+
<li><a href="#">GitHub</a></li>
|
| 90 |
+
<li><a href="#">SpeechBrain</a></li>
|
| 91 |
+
<li><a href="#">SciPy</a></li>
|
| 92 |
+
<li><a href="#">Blog</a></li>
|
| 93 |
+
</ul>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="social-links">
|
| 97 |
+
<a href="#"><i data-feather="github"></i></a>
|
| 98 |
+
<a href="#"><i data-feather="twitter"></i></a>
|
| 99 |
+
<a href="#"><i data-feather="linkedin"></i></a>
|
| 100 |
+
<a href="#"><i data-feather="youtube"></i></a>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="copyright">
|
| 103 |
+
© ${new Date().getFullYear()} VoiceCraft AI Assistant. All rights reserved.
|
| 104 |
+
</div>
|
| 105 |
+
</footer>
|
| 106 |
+
`;
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
customElements.define('custom-footer', CustomFooter);
|
components/navbar.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
nav {
|
| 7 |
+
background: linear-gradient(135deg, rgba(30, 30, 30, 0.9) 0%, rgba(50, 15, 80, 0.9) 100%);
|
| 8 |
+
padding: 1rem 2rem;
|
| 9 |
+
display: flex;
|
| 10 |
+
justify-content: space-between;
|
| 11 |
+
align-items: center;
|
| 12 |
+
backdrop-filter: blur(10px);
|
| 13 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
| 14 |
+
}
|
| 15 |
+
.logo {
|
| 16 |
+
color: white;
|
| 17 |
+
font-weight: bold;
|
| 18 |
+
font-size: 1.25rem;
|
| 19 |
+
display: flex;
|
| 20 |
+
align-items: center;
|
| 21 |
+
}
|
| 22 |
+
.logo-icon {
|
| 23 |
+
margin-right: 0.5rem;
|
| 24 |
+
color: #9f7aea;
|
| 25 |
+
}
|
| 26 |
+
ul {
|
| 27 |
+
display: flex;
|
| 28 |
+
gap: 1.5rem;
|
| 29 |
+
list-style: none;
|
| 30 |
+
margin: 0;
|
| 31 |
+
padding: 0;
|
| 32 |
+
}
|
| 33 |
+
a {
|
| 34 |
+
color: white;
|
| 35 |
+
text-decoration: none;
|
| 36 |
+
transition: color 0.2s;
|
| 37 |
+
display: flex;
|
| 38 |
+
align-items: center;
|
| 39 |
+
}
|
| 40 |
+
a:hover {
|
| 41 |
+
color: #d6bcfa;
|
| 42 |
+
}
|
| 43 |
+
.nav-icon {
|
| 44 |
+
margin-right: 0.5rem;
|
| 45 |
+
width: 1rem;
|
| 46 |
+
height: 1rem;
|
| 47 |
+
}
|
| 48 |
+
@media (max-width: 768px) {
|
| 49 |
+
nav {
|
| 50 |
+
flex-direction: column;
|
| 51 |
+
padding: 1rem;
|
| 52 |
+
}
|
| 53 |
+
ul {
|
| 54 |
+
margin-top: 1rem;
|
| 55 |
+
flex-wrap: wrap;
|
| 56 |
+
justify-content: center;
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
</style>
|
| 60 |
+
<nav>
|
| 61 |
+
<div class="logo">
|
| 62 |
+
<i data-feather="activity" class="logo-icon"></i>
|
| 63 |
+
<span>VoiceCraft AI</span>
|
| 64 |
+
</div>
|
| 65 |
+
<ul>
|
| 66 |
+
<li><a href="/"><i data-feather="home" class="nav-icon"></i> Home</a></li>
|
| 67 |
+
<li><a href="#"><i data-feather="settings" class="nav-icon"></i> Settings</a></li>
|
| 68 |
+
<li><a href="#"><i data-feather="help-circle" class="nav-icon"></i> Help</a></li>
|
| 69 |
+
<li><a href="#"><i data-feather="user" class="nav-icon"></i> Account</a></li>
|
| 70 |
+
</ul>
|
| 71 |
+
</nav>
|
| 72 |
+
`;
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,126 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>VoiceCraft AI Assistant</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.waves.min.js"></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gray-900 text-white">
|
| 14 |
+
<custom-navbar></custom-navbar>
|
| 15 |
+
|
| 16 |
+
<main class="container mx-auto px-4 py-12">
|
| 17 |
+
<div id="vanta-background" class="absolute inset-0 -z-10"></div>
|
| 18 |
+
|
| 19 |
+
<div class="max-w-4xl mx-auto backdrop-blur-sm bg-black/30 rounded-xl p-8 shadow-2xl">
|
| 20 |
+
<div class="text-center mb-12">
|
| 21 |
+
<h1 class="text-4xl font-bold mb-4">VoiceCraft AI Assistant</h1>
|
| 22 |
+
<p class="text-lg text-gray-300">Transform your voice with AI-powered speech processing</p>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<div class="grid md:grid-cols-2 gap-8">
|
| 26 |
+
<!-- Speech Processing Card -->
|
| 27 |
+
<div class="bg-gray-800/70 rounded-lg p-6 hover:shadow-lg transition-all">
|
| 28 |
+
<div class="flex items-center mb-4">
|
| 29 |
+
<i data-feather="mic" class="w-6 h-6 mr-3 text-purple-400"></i>
|
| 30 |
+
<h2 class="text-xl font-semibold">Speech Processing</h2>
|
| 31 |
+
</div>
|
| 32 |
+
<p class="text-gray-300 mb-4">Upload audio files or record directly to apply AI processing.</p>
|
| 33 |
+
<button id="recordBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-md flex items-center">
|
| 34 |
+
<i data-feather="mic" class="w-4 h-4 mr-2"></i>
|
| 35 |
+
Record Audio
|
| 36 |
+
</button>
|
| 37 |
+
<input type="file" id="audioUpload" accept="audio/*" class="hidden">
|
| 38 |
+
<label for="audioUpload" class="block mt-3 bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded-md text-center cursor-pointer">
|
| 39 |
+
<i data-feather="upload" class="w-4 h-4 mr-2 inline"></i>
|
| 40 |
+
Upload Audio
|
| 41 |
+
</label>
|
| 42 |
+
</div>
|
| 43 |
+
|
| 44 |
+
<!-- Processing Options Card -->
|
| 45 |
+
<div class="bg-gray-800/70 rounded-lg p-6 hover:shadow-lg transition-all">
|
| 46 |
+
<div class="flex items-center mb-4">
|
| 47 |
+
<i data-feather="settings" class="w-6 h-6 mr-3 text-blue-400"></i>
|
| 48 |
+
<h2 class="text-xl font-semibold">Processing Options</h2>
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
<div class="space-y-4">
|
| 52 |
+
<div>
|
| 53 |
+
<label class="block text-gray-300 mb-1">Processing Type:</label>
|
| 54 |
+
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2 text-white">
|
| 55 |
+
<option>Speech Recognition</option>
|
| 56 |
+
<option>Voice Conversion</option>
|
| 57 |
+
<option>Speech Enhancement</option>
|
| 58 |
+
<option>Emotion Recognition</option>
|
| 59 |
+
</select>
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
<div>
|
| 63 |
+
<label class="block text-gray-300 mb-1">Output Format:</label>
|
| 64 |
+
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2 text-white">
|
| 65 |
+
<option>WAV</option>
|
| 66 |
+
<option>MP3</option>
|
| 67 |
+
<option>OGG</option>
|
| 68 |
+
</select>
|
| 69 |
+
</div>
|
| 70 |
+
<button id="processBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md flex items-center justify-center">
|
| 71 |
+
<i data-feather="play" class="w-4 h-4 mr-2"></i>
|
| 72 |
+
Process Audio
|
| 73 |
+
</button>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<!-- Results Section -->
|
| 79 |
+
<div class="mt-12 bg-gray-800/70 rounded-lg p-6">
|
| 80 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center">
|
| 81 |
+
<i data-feather="activity" class="w-5 h-5 mr-2 text-green-400"></i>
|
| 82 |
+
Processing Results
|
| 83 |
+
</h2>
|
| 84 |
+
<div id="resultsContainer" class="min-h-40 border-2 border-dashed border-gray-600 rounded-lg p-4 flex items-center justify-center text-gray-400">
|
| 85 |
+
<p>Your processed audio will appear here...</p>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="mt-4 flex space-x-3">
|
| 88 |
+
<button class="bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded-md flex items-center disabled:opacity-50" disabled>
|
| 89 |
+
<i data-feather="download" class="w-4 h-4 mr-2"></i>
|
| 90 |
+
Download
|
| 91 |
+
</button>
|
| 92 |
+
<button class="bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded-md flex items-center disabled:opacity-50" disabled>
|
| 93 |
+
<i data-feather="share-2" class="w-4 h-4 mr-2"></i>
|
| 94 |
+
Share
|
| 95 |
+
</button>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</main>
|
| 100 |
+
|
| 101 |
+
<custom-footer></custom-footer>
|
| 102 |
+
|
| 103 |
+
<script src="components/navbar.js"></script>
|
| 104 |
+
<script src="components/footer.js"></script>
|
| 105 |
+
<script src="script.js"></script>
|
| 106 |
+
<script>
|
| 107 |
+
feather.replace();
|
| 108 |
+
VANTA.WAVES({
|
| 109 |
+
el: "#vanta-background",
|
| 110 |
+
mouseControls: true,
|
| 111 |
+
touchControls: true,
|
| 112 |
+
gyroControls: false,
|
| 113 |
+
minHeight: 200.00,
|
| 114 |
+
minWidth: 200.00,
|
| 115 |
+
scale: 1.00,
|
| 116 |
+
scaleMobile: 1.00,
|
| 117 |
+
color: 0x4b0082,
|
| 118 |
+
shininess: 35.00,
|
| 119 |
+
waveHeight: 15.00,
|
| 120 |
+
waveSpeed: 0.85,
|
| 121 |
+
zoom: 0.75
|
| 122 |
+
});
|
| 123 |
+
</script>
|
| 124 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 125 |
+
</body>
|
| 126 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Main application script
|
| 2 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 3 |
+
// Initialize audio context for recording
|
| 4 |
+
let audioContext;
|
| 5 |
+
let mediaRecorder;
|
| 6 |
+
let audioChunks = [];
|
| 7 |
+
|
| 8 |
+
// DOM elements
|
| 9 |
+
const recordBtn = document.getElementById('recordBtn');
|
| 10 |
+
const audioUpload = document.getElementById('audioUpload');
|
| 11 |
+
const resultsContainer = document.getElementById('resultsContainer');
|
| 12 |
+
|
| 13 |
+
// Record button functionality
|
| 14 |
+
recordBtn.addEventListener('click', async () => {
|
| 15 |
+
try {
|
| 16 |
+
if (mediaRecorder && mediaRecorder.state === 'recording') {
|
| 17 |
+
// Stop recording
|
| 18 |
+
mediaRecorder.stop();
|
| 19 |
+
recordBtn.innerHTML = '<i data-feather="mic" class="w-4 h-4 mr-2"></i> Record Audio';
|
| 20 |
+
recordBtn.classList.remove('bg-red-600');
|
| 21 |
+
recordBtn.classList.add('bg-purple-600', 'hover:bg-purple-700');
|
| 22 |
+
feather.replace();
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
// Start recording
|
| 27 |
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
| 28 |
+
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
| 29 |
+
mediaRecorder = new MediaRecorder(stream);
|
| 30 |
+
|
| 31 |
+
mediaRecorder.ondataavailable = (event) => {
|
| 32 |
+
audioChunks.push(event.data);
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
mediaRecorder.onstop = async () => {
|
| 36 |
+
const audioBlob = new Blob(audioChunks, { type: 'audio/wav' });
|
| 37 |
+
audioChunks = [];
|
| 38 |
+
|
| 39 |
+
// Simulate processing
|
| 40 |
+
simulateProcessing(audioBlob);
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
mediaRecorder.start();
|
| 44 |
+
recordBtn.innerHTML = '<i data-feather="square" class="w-4 h-4 mr-2"></i> Stop Recording';
|
| 45 |
+
recordBtn.classList.remove('bg-purple-600', 'hover:bg-purple-700');
|
| 46 |
+
recordBtn.classList.add('bg-red-600');
|
| 47 |
+
feather.replace();
|
| 48 |
+
|
| 49 |
+
} catch (error) {
|
| 50 |
+
console.error('Error accessing microphone:', error);
|
| 51 |
+
alert('Error accessing microphone. Please ensure you have granted permission.');
|
| 52 |
+
}
|
| 53 |
+
});
|
| 54 |
+
// Track current filename
|
| 55 |
+
let currentFilename = 'processed_audio';
|
| 56 |
+
|
| 57 |
+
// File upload functionality
|
| 58 |
+
audioUpload.addEventListener('change', (event) => {
|
| 59 |
+
const file = event.target.files[0];
|
| 60 |
+
if (file) {
|
| 61 |
+
currentFilename = file.name.replace(/\.[^/.]+$/, "") || 'processed_audio';
|
| 62 |
+
const audioBlob = new Blob([file], { type: file.type });
|
| 63 |
+
simulateProcessing(audioBlob);
|
| 64 |
+
}
|
| 65 |
+
});
|
| 66 |
+
|
| 67 |
+
// Simulate processing (to be replaced with actual SpeechBrain/Scipy integration)
|
| 68 |
+
function simulateProcessing(audioBlob) {
|
| 69 |
+
resultsContainer.innerHTML = `
|
| 70 |
+
<div class="text-center">
|
| 71 |
+
<div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500 mx-auto mb-4"></div>
|
| 72 |
+
<p class="font-medium">Processing your audio with AI...</p>
|
| 73 |
+
</div>
|
| 74 |
+
`;
|
| 75 |
+
|
| 76 |
+
setTimeout(() => {
|
| 77 |
+
const audioUrl = URL.createObjectURL(audioBlob);
|
| 78 |
+
resultsContainer.innerHTML = `
|
| 79 |
+
<audio controls class="w-full">
|
| 80 |
+
<source src="${audioUrl}" type="audio/wav">
|
| 81 |
+
Your browser does not support the audio element.
|
| 82 |
+
</audio>
|
| 83 |
+
<p class="text-sm text-gray-300 mt-2">Processing complete!</p>
|
| 84 |
+
`;
|
| 85 |
+
|
| 86 |
+
// Enable download and share buttons
|
| 87 |
+
const buttons = document.querySelectorAll('#resultsContainer + div button');
|
| 88 |
+
buttons.forEach(btn => {
|
| 89 |
+
btn.disabled = false;
|
| 90 |
+
if (btn.querySelector('i[data-feather="download"]')) {
|
| 91 |
+
btn.onclick = () => downloadProcessedAudio(audioUrl, currentFilename);
|
| 92 |
+
}
|
| 93 |
+
});
|
| 94 |
+
}, 3000);
|
| 95 |
+
}
|
| 96 |
+
// Process button functionality
|
| 97 |
+
const processBtn = document.getElementById('processBtn');
|
| 98 |
+
const processingSelect = document.querySelector('select');
|
| 99 |
+
|
| 100 |
+
processBtn.addEventListener('click', () => {
|
| 101 |
+
if (audioChunks.length > 0 || audioUpload.files.length > 0) {
|
| 102 |
+
const processingType = processingSelect.value;
|
| 103 |
+
const audioBlob = audioChunks.length > 0
|
| 104 |
+
? new Blob(audioChunks, { type: 'audio/wav' })
|
| 105 |
+
: new Blob([audioUpload.files[0]], { type: audioUpload.files[0].type });
|
| 106 |
+
|
| 107 |
+
simulateProcessing(audioBlob, processingType);
|
| 108 |
+
} else {
|
| 109 |
+
alert('Please record or upload audio first');
|
| 110 |
+
}
|
| 111 |
+
});
|
| 112 |
+
|
| 113 |
+
// Initialize tooltips
|
| 114 |
+
document.querySelectorAll('[data-tooltip]').forEach(element => {
|
| 115 |
+
element.addEventListener('mouseenter', () => {
|
| 116 |
+
const tooltip = document.createElement('div');
|
| 117 |
+
tooltip.className = 'absolute z-10 bg-black text-white text-xs px-2 py-1 rounded mt-1';
|
| 118 |
+
tooltip.textContent = element.dataset.tooltip;
|
| 119 |
+
element.appendChild(tooltip);
|
| 120 |
+
|
| 121 |
+
element.addEventListener('mouseleave', () => {
|
| 122 |
+
tooltip.remove();
|
| 123 |
+
}, { once: true });
|
| 124 |
+
});
|
| 125 |
+
});
|
| 126 |
+
});
|
| 127 |
+
|
| 128 |
+
// SpeechBrain integration placeholder
|
| 129 |
+
async function processWithSpeechBrain(audioBlob) {
|
| 130 |
+
// This would be replaced with actual SpeechBrain API calls
|
| 131 |
+
console.log('Processing with SpeechBrain...');
|
| 132 |
+
return audioBlob; // Return processed audio
|
| 133 |
+
}
|
| 134 |
+
// Download processed audio with modified filename
|
| 135 |
+
function downloadProcessedAudio(audioUrl, originalName) {
|
| 136 |
+
const link = document.createElement('a');
|
| 137 |
+
link.href = audioUrl;
|
| 138 |
+
link.download = `${originalName}_enhanced.wav`;
|
| 139 |
+
document.body.appendChild(link);
|
| 140 |
+
link.click();
|
| 141 |
+
document.body.removeChild(link);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
// SciPy integration placeholder with noise reduction
|
| 145 |
+
async function processWithSciPy(audioBlob, processingType) {
|
| 146 |
+
console.log(`Processing with SciPy - ${processingType}...`);
|
| 147 |
+
|
| 148 |
+
// Simulate different processing based on selection
|
| 149 |
+
switch(processingType) {
|
| 150 |
+
case 'Speech Enhancement (Noise Reduction)':
|
| 151 |
+
console.log('Applying spectral gating and Wiener filtering...');
|
| 152 |
+
break;
|
| 153 |
+
case 'Speech Enhancement (Vocal Isolation)':
|
| 154 |
+
console.log('Applying harmonic-percussive source separation...');
|
| 155 |
+
break;
|
| 156 |
+
case 'Speech Enhancement (Background Masking)':
|
| 157 |
+
console.log('Applying spectral masking and ambient reduction...');
|
| 158 |
+
break;
|
| 159 |
+
default:
|
| 160 |
+
console.log('Standard processing...');
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
return audioBlob; // Return processed audio
|
| 164 |
+
}
|
style.css
CHANGED
|
@@ -1,28 +1,39 @@
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Base styles */
|
| 2 |
body {
|
| 3 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
| 4 |
+
min-height: 100vh;
|
| 5 |
+
display: flex;
|
| 6 |
+
flex-direction: column;
|
| 7 |
}
|
| 8 |
|
| 9 |
+
/* Custom scrollbar */
|
| 10 |
+
::-webkit-scrollbar {
|
| 11 |
+
width: 8px;
|
| 12 |
}
|
| 13 |
|
| 14 |
+
::-webkit-scrollbar-track {
|
| 15 |
+
background: #1a1a1a;
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
+
::-webkit-scrollbar-thumb {
|
| 19 |
+
background: #4b0082;
|
| 20 |
+
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
| 21 |
}
|
| 22 |
|
| 23 |
+
::-webkit-scrollbar-thumb:hover {
|
| 24 |
+
background: #5a1a9a;
|
| 25 |
}
|
| 26 |
+
|
| 27 |
+
/* Animation for processing state */
|
| 28 |
+
@keyframes pulse {
|
| 29 |
+
0%, 100% {
|
| 30 |
+
opacity: 1;
|
| 31 |
+
}
|
| 32 |
+
50% {
|
| 33 |
+
opacity: 0.5;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.processing {
|
| 38 |
+
animation: pulse 1.5s infinite;
|
| 39 |
+
}
|