summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 11:45:09 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 11:45:09 +0100
commit371017a31bedaed179d339b9fe371529f22d9ec4 (patch)
tree5156714aa3c4349f69856d46a1d5e1df9f97627f
parent7d022d9a3923eb35f3acd3ed4a1795c497bc53ee (diff)
feat(editor): Scaffold web spectrogram editor
Initial setup for the spectrogram editor tool. - Created tools/editor/index.html, script.js, and style.css. - Added basic structure for WAV loading, visualization, and tool controls.
-rw-r--r--SPEC_EDITOR.md44
-rw-r--r--tools/editor/index.html28
-rw-r--r--tools/editor/script.js11
-rw-r--r--tools/editor/style.css35
4 files changed, 118 insertions, 0 deletions
diff --git a/SPEC_EDITOR.md b/SPEC_EDITOR.md
new file mode 100644
index 0000000..cde0cdd
--- /dev/null
+++ b/SPEC_EDITOR.md
@@ -0,0 +1,44 @@
+# spectrogram editing tool in a browser
+
+The sub-project is about have an editing tool in a browser
+that will allow generating, editing, compacting .spec files
+
+## the idea
+
+We want a web page (html+javascript) capable of:
+ * loading a .wav file and showing the spectrogram (IDCT_SIZE=512)
+ * compacting this spectrogram if needed
+ * generating the .spec file
+ * allowing some editing on the spectrogram
+ * and most importantly: allowing the compression of this spectrogram using elementary bricks like bezier-curves (with a large stroke width /
+ brushes), rectangle, noise addition, etc.
+
+These tools must be available in the web editor (in javascript) as well as
+in c++ equivalent too.
+
+The idea is the compress the .wav spectrogram using elementary bricks and
+simple representation (as well as being dynamic) during the demo: we
+generate the audio on the fly by 'drawing' the spectrograms and passing them
+to the synth
+
+## the work
+
+Analyze the requirement for the HTML tool. It must remain simple and easy to
+use. Don't over-engineer it.
+Still, the tool must have a decent load/save offer, to:
+ * load the .wav
+ * save the .spec
+ * save/export the descriptive compressed version in vectorial form (like the SVG format, in fact)
+ * be able to load this vectorial form
+
+Then we need a reader for the vectorial form in c++ to use in the demo.
+We also need to elementary tools / bricks to: draw a line / bezier curve /
+rectangle, ellipse, etc. in frequency domain, to generate the spectrogram on
+the flight.
+We also need controllable random noise generation to add some 'texture' to
+the spectrogram.
+
+## the files
+the HTML/JS tool should be under tools/editor
+the c++ code should be added to the library under src/audio/
+
diff --git a/tools/editor/index.html b/tools/editor/index.html
new file mode 100644
index 0000000..43a37f9
--- /dev/null
+++ b/tools/editor/index.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Spectrogram Editor</title>
+ <link rel="stylesheet" href="style.css">
+</head>
+<body>
+ <h1>Spectrogram Editor</h1>
+
+ <input type="file" id="wavFileInput" accept=".wav">
+ <label for="wavFileInput">Load WAV File</label>
+
+ <div id="editorContainer">
+ <canvas id="spectrogramCanvas"></canvas>
+ <div id="controls">
+ <h2>Tools</h2>
+ <button id="lineTool">Line</button>
+ <button id="ellipseTool">Ellipse</button>
+ <button id="noiseTool">Noise</button>
+ <!-- Add more tool controls later -->
+ </div>
+ </div>
+
+ <script src="script.js"></script>
+</body>
+</html>
diff --git a/tools/editor/script.js b/tools/editor/script.js
new file mode 100644
index 0000000..9311d6d
--- /dev/null
+++ b/tools/editor/script.js
@@ -0,0 +1,11 @@
+// This is the core JavaScript for the Spectrogram Editor.
+// It handles file loading, visualization, tool interaction, and saving.
+
+// Placeholder for core functionality
+console.log("Spectrogram Editor script loaded.");
+
+// TODO: Implement WAV loading and spectrogram calculation
+// TODO: Implement canvas drawing and event handling for tools
+// TODO: Implement shape generation (strokes, ellipses, noise)
+// TODO: Implement JSON save/load functionality
+// TODO: Implement .spec export functionality
diff --git a/tools/editor/style.css b/tools/editor/style.css
new file mode 100644
index 0000000..f610969
--- /dev/null
+++ b/tools/editor/style.css
@@ -0,0 +1,35 @@
+body {
+ font-family: sans-serif;
+ margin: 20px;
+ background-color: #f4f4f4;
+}
+
+h1, h2 {
+ color: #333;
+}
+
+#editorContainer {
+ display: flex;
+ margin-top: 20px;
+}
+
+#spectrogramCanvas {
+ border: 1px solid #ccc;
+ background-color: #fff;
+ margin-right: 20px;
+}
+
+#controls {
+ border: 1px solid #ccc;
+ padding: 15px;
+ background-color: #eee;
+ min-width: 200px;
+}
+
+#controls button {
+ display: block;
+ width: 100%;
+ margin-bottom: 10px;
+ padding: 10px;
+ cursor: pointer;
+}