vaagi commited on
Commit
26dda4e
·
verified ·
1 Parent(s): 963fc2d

song audio mp3 into musical keyboard/Piano Rolls notes video mp4

Browse files
Files changed (6) hide show
  1. README.md +8 -5
  2. components/footer.js +64 -0
  3. components/header.js +36 -0
  4. index.html +134 -19
  5. script.js +62 -0
  6. style.css +33 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Melody Mapper Magic
3
- emoji: 📈
4
- colorFrom: red
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Melody Mapper Magic 🎹
3
+ colorFrom: purple
4
+ colorTo: gray
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,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background: rgba(30, 30, 30, 0.8);
8
+ backdrop-filter: blur(10px);
9
+ }
10
+ .social-icon:hover {
11
+ color: #a78bfa;
12
+ transform: translateY(-2px);
13
+ }
14
+ </style>
15
+ <footer class="border-t border-gray-700 mt-12">
16
+ <div class="container mx-auto px-4 py-8">
17
+ <div class="grid md:grid-cols-4 gap-8">
18
+ <div>
19
+ <h3 class="text-xl font-bold mb-4 logo">MelodyMapper</h3>
20
+ <p class="text-gray-400">Transforming audio into beautiful piano roll visualizations since 2023.</p>
21
+ </div>
22
+ <div>
23
+ <h4 class="font-semibold mb-4">Product</h4>
24
+ <ul class="space-y-2">
25
+ <li><a href="#" class="text-gray-400 hover:text-purple-300 transition-colors">Features</a></li>
26
+ <li><a href="#" class="text-gray-400 hover:text-purple-300 transition-colors">Pricing</a></li>
27
+ <li><a href="#" class="text-gray-400 hover:text-purple-300 transition-colors">API</a></li>
28
+ </ul>
29
+ </div>
30
+ <div>
31
+ <h4 class="font-semibold mb-4">Company</h4>
32
+ <ul class="space-y-2">
33
+ <li><a href="#" class="text-gray-400 hover:text-purple-300 transition-colors">About</a></li>
34
+ <li><a href="#" class="text-gray-400 hover:text-purple-300 transition-colors">Blog</a></li>
35
+ <li><a href="#" class="text-gray-400 hover:text-purple-300 transition-colors">Careers</a></li>
36
+ </ul>
37
+ </div>
38
+ <div>
39
+ <h4 class="font-semibold mb-4">Connect</h4>
40
+ <div class="flex space-x-4">
41
+ <a href="#" class="social-icon text-gray-400 transition-all duration-200">
42
+ <i data-feather="twitter"></i>
43
+ </a>
44
+ <a href="#" class="social-icon text-gray-400 transition-all duration-200">
45
+ <i data-feather="github"></i>
46
+ </a>
47
+ <a href="#" class="social-icon text-gray-400 transition-all duration-200">
48
+ <i data-feather="instagram"></i>
49
+ </a>
50
+ <a href="#" class="social-icon text-gray-400 transition-all duration-200">
51
+ <i data-feather="youtube"></i>
52
+ </a>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-500 text-sm">
57
+ <p>© 2023 MelodyMapper. All rights reserved.</p>
58
+ </div>
59
+ </div>
60
+ </footer>
61
+ `;
62
+ }
63
+ }
64
+ customElements.define('custom-footer', CustomFooter);
components/header.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomHeader extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background: rgba(30, 30, 30, 0.8);
8
+ backdrop-filter: blur(10px);
9
+ }
10
+ .nav-link:hover {
11
+ color: #a78bfa;
12
+ }
13
+ .logo {
14
+ background: linear-gradient(90deg, #8b5cf6, #6366f1);
15
+ -webkit-background-clip: text;
16
+ -webkit-text-fill-color: transparent;
17
+ }
18
+ </style>
19
+ <nav class="border-b border-gray-700">
20
+ <div class="container mx-auto px-4 py-4 flex justify-between items-center">
21
+ <a href="/" class="text-2xl font-bold logo">MelodyMapper</a>
22
+ <div class="flex items-center space-x-6">
23
+ <a href="/" class="nav-link text-white hover:text-purple-300 transition-colors">Home</a>
24
+ <a href="#" class="nav-link text-white hover:text-purple-300 transition-colors">Features</a>
25
+ <a href="#" class="nav-link text-white hover:text-purple-300 transition-colors">Pricing</a>
26
+ <a href="#" class="nav-link text-white hover:text-purple-300 transition-colors">About</a>
27
+ <button class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-md flex items-center">
28
+ <i data-feather="log-in" class="w-4 h-4 mr-2"></i> Login
29
+ </button>
30
+ </div>
31
+ </div>
32
+ </nav>
33
+ `;
34
+ }
35
+ }
36
+ customElements.define('custom-header', CustomHeader);
index.html CHANGED
@@ -1,19 +1,134 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Melody Mapper Magic | Audio to Piano Roll</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ </head>
12
+ <body class="bg-gradient-to-br from-indigo-900 to-purple-900 min-h-screen text-white">
13
+ <custom-header></custom-header>
14
+
15
+ <main class="container mx-auto px-4 py-8">
16
+ <section class="max-w-4xl mx-auto bg-gray-800 bg-opacity-50 rounded-xl p-6 backdrop-blur-sm">
17
+ <h1 class="text-4xl font-bold mb-6 text-center">Transform Audio to Piano Roll</h1>
18
+ <p class="text-xl mb-8 text-center text-gray-300">Upload your MP3 and watch it transform into beautiful piano roll visualization</p>
19
+
20
+ <div class="grid md:grid-cols-2 gap-8">
21
+ <div class="space-y-6">
22
+ <div class="bg-gray-700 p-6 rounded-lg">
23
+ <h2 class="text-2xl font-semibold mb-4 flex items-center">
24
+ <i data-feather="upload" class="mr-2"></i> Upload Audio
25
+ </h2>
26
+ <div class="border-2 border-dashed border-gray-500 rounded-lg p-8 text-center hover:border-purple-400 transition-colors">
27
+ <input type="file" id="audio-upload" accept=".mp3,.wav" class="hidden">
28
+ <label for="audio-upload" class="cursor-pointer">
29
+ <i data-feather="music" class="w-12 h-12 mx-auto text-purple-400"></i>
30
+ <p class="mt-4">Drag & drop your audio file here</p>
31
+ <p class="text-sm text-gray-400 mt-2">or click to browse files</p>
32
+ </label>
33
+ </div>
34
+ <div id="audio-info" class="mt-4 hidden">
35
+ <p class="text-sm"><span class="font-medium">File:</span> <span id="filename"></span></p>
36
+ <p class="text-sm"><span class="font-medium">Duration:</span> <span id="duration"></span></p>
37
+ </div>
38
+ </div>
39
+
40
+ <div class="bg-gray-700 p-6 rounded-lg">
41
+ <h2 class="text-2xl font-semibold mb-4 flex items-center">
42
+ <i data-feather="sliders" class="mr-2"></i> Settings
43
+ </h2>
44
+ <div class="space-y-4">
45
+ <div>
46
+ <label class="block text-sm font-medium mb-1">Sensitivity</label>
47
+ <input type="range" min="1" max="100" value="50" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer">
48
+ </div>
49
+ <div>
50
+ <label class="block text-sm font-medium mb-1">Note Detection</label>
51
+ <select class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-white">
52
+ <option>Aggressive</option>
53
+ <option selected>Balanced</option>
54
+ <option>Conservative</option>
55
+ </select>
56
+ </div>
57
+ <div>
58
+ <label class="block text-sm font-medium mb-1">Output Format</label>
59
+ <select class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-white">
60
+ <option>MP4 Video</option>
61
+ <option>GIF</option>
62
+ <option>MIDI</option>
63
+ </select>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+
69
+ <div class="bg-gray-700 p-6 rounded-lg">
70
+ <h2 class="text-2xl font-semibold mb-4 flex items-center">
71
+ <i data-feather="video" class="mr-2"></i> Preview
72
+ </h2>
73
+ <div class="aspect-video bg-black rounded-lg flex items-center justify-center">
74
+ <div class="text-center">
75
+ <i data-feather="play" class="w-12 h-12 mx-auto text-purple-400"></i>
76
+ <p class="mt-2">Your piano roll visualization will appear here</p>
77
+ </div>
78
+ </div>
79
+ <div class="mt-4 flex justify-between items-center">
80
+ <div class="flex space-x-2">
81
+ <button class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-md flex items-center">
82
+ <i data-feather="play" class="mr-2"></i> Play
83
+ </button>
84
+ <button class="bg-gray-600 hover:bg-gray-500 px-4 py-2 rounded-md flex items-center">
85
+ <i data-feather="pause" class="mr-2"></i> Pause
86
+ </button>
87
+ </div>
88
+ <button class="bg-indigo-600 hover:bg-indigo-700 px-4 py-2 rounded-md flex items-center">
89
+ <i data-feather="download" class="mr-2"></i> Export
90
+ </button>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </section>
95
+
96
+ <section class="max-w-4xl mx-auto mt-12">
97
+ <h2 class="text-2xl font-semibold mb-6">How It Works</h2>
98
+ <div class="grid md:grid-cols-3 gap-6">
99
+ <div class="bg-gray-800 bg-opacity-50 p-6 rounded-lg">
100
+ <div class="w-12 h-12 bg-purple-500 rounded-full flex items-center justify-center mb-4">
101
+ <i data-feather="upload" class="w-6 h-6"></i>
102
+ </div>
103
+ <h3 class="text-xl font-medium mb-2">Upload Audio</h3>
104
+ <p class="text-gray-300">Upload your MP3 or WAV file. We support most common audio formats.</p>
105
+ </div>
106
+ <div class="bg-gray-800 bg-opacity-50 p-6 rounded-lg">
107
+ <div class="w-12 h-12 bg-indigo-500 rounded-full flex items-center justify-center mb-4">
108
+ <i data-feather="cpu" class="w-6 h-6"></i>
109
+ </div>
110
+ <h3 class="text-xl font-medium mb-2">AI Analysis</h3>
111
+ <p class="text-gray-300">Our algorithm detects notes and converts them to piano roll format.</p>
112
+ </div>
113
+ <div class="bg-gray-800 bg-opacity-50 p-6 rounded-lg">
114
+ <div class="w-12 h-12 bg-blue-500 rounded-full flex items-center justify-center mb-4">
115
+ <i data-feather="video" class="w-6 h-6"></i>
116
+ </div>
117
+ <h3 class="text-xl font-medium mb-2">Visualize & Export</h3>
118
+ <p class="text-gray-300">Watch the visualization and export as video, GIF or MIDI file.</p>
119
+ </div>
120
+ </div>
121
+ </section>
122
+ </main>
123
+
124
+ <custom-footer></custom-footer>
125
+
126
+ <script src="components/header.js"></script>
127
+ <script src="components/footer.js"></script>
128
+ <script src="script.js"></script>
129
+ <script>
130
+ feather.replace();
131
+ </script>
132
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
133
+ </body>
134
+ </html>
script.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Audio upload handling
3
+ const audioUpload = document.getElementById('audio-upload');
4
+ const audioInfo = document.getElementById('audio-info');
5
+ const filename = document.getElementById('filename');
6
+ const duration = document.getElementById('duration');
7
+
8
+ audioUpload.addEventListener('change', function(e) {
9
+ if (e.target.files.length > 0) {
10
+ const file = e.target.files[0];
11
+ filename.textContent = file.name;
12
+
13
+ // Create audio element to get duration
14
+ const audio = new Audio();
15
+ audio.src = URL.createObjectURL(file);
16
+ audio.onloadedmetadata = function() {
17
+ const mins = Math.floor(audio.duration / 60);
18
+ const secs = Math.floor(audio.duration % 60);
19
+ duration.textContent = `${mins}:${secs < 10 ? '0' : ''}${secs}`;
20
+ audioInfo.classList.remove('hidden');
21
+ };
22
+ }
23
+ });
24
+
25
+ // Drag and drop functionality
26
+ const dropArea = document.querySelector('.border-dashed');
27
+
28
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
29
+ dropArea.addEventListener(eventName, preventDefaults, false);
30
+ });
31
+
32
+ function preventDefaults(e) {
33
+ e.preventDefault();
34
+ e.stopPropagation();
35
+ }
36
+
37
+ ['dragenter', 'dragover'].forEach(eventName => {
38
+ dropArea.addEventListener(eventName, highlight, false);
39
+ });
40
+
41
+ ['dragleave', 'drop'].forEach(eventName => {
42
+ dropArea.addEventListener(eventName, unhighlight, false);
43
+ });
44
+
45
+ function highlight() {
46
+ dropArea.classList.add('border-purple-400');
47
+ }
48
+
49
+ function unhighlight() {
50
+ dropArea.classList.remove('border-purple-400');
51
+ }
52
+
53
+ dropArea.addEventListener('drop', handleDrop, false);
54
+
55
+ function handleDrop(e) {
56
+ const dt = e.dataTransfer;
57
+ const files = dt.files;
58
+ audioUpload.files = files;
59
+ const event = new Event('change');
60
+ audioUpload.dispatchEvent(event);
61
+ }
62
+ });
style.css CHANGED
@@ -1,28 +1,43 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
 
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
5
+ }
6
+
7
+ /* Custom scrollbar */
8
+ ::-webkit-scrollbar {
9
+ width: 8px;
10
+ height: 8px;
11
  }
12
 
13
+ ::-webkit-scrollbar-track {
14
+ background: rgba(255, 255, 255, 0.1);
 
15
  }
16
 
17
+ ::-webkit-scrollbar-thumb {
18
+ background: rgba(255, 255, 255, 0.2);
19
+ border-radius: 4px;
 
 
20
  }
21
 
22
+ ::-webkit-scrollbar-thumb:hover {
23
+ background: rgba(255, 255, 255, 0.3);
 
 
 
 
24
  }
25
 
26
+ /* Animation for the upload area */
27
+ @keyframes pulse {
28
+ 0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
29
+ 70% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
30
+ 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
31
  }
32
+
33
+ .border-dashed:hover {
34
+ animation: pulse 2s infinite;
35
+ }
36
+
37
+ /* Responsive adjustments */
38
+ @media (max-width: 768px) {
39
+ .container {
40
+ padding-left: 1rem;
41
+ padding-right: 1rem;
42
+ }
43
+ }