diff --git a/README.md b/README.md
index 64c922c..35d9be8 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Inspired by [Friture: A real-time audio analyzer](https://friture.org/) and [Pra
## Features
- **Real-time Audio Analysis**: Standard FFT-based frequency analysis
+
- **Multiple Visualization Modes**:
- Linear, Logarithmic, and Mel frequency scales
- Customizable frequency range (20Hz - 20kHz)
@@ -30,6 +31,8 @@ Inspired by [Friture: A real-time audio analyzer](https://friture.org/) and [Pra
- Adjustable scroll speed
- Multiple interpolation modes
+- **Mobile Friendly**
+
## Usage
diff --git a/index.html b/index.html
index ae352c7..66d3d89 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,8 @@
-
+
+
Paul1365972's Spectrogram
diff --git a/package.json b/package.json
index bf72e5f..77592f5 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"build": "vite build",
"preview": "vite preview --open",
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
- "format": "prettier --write 'src/**/*.{ts,svelte,css}' 'public/**/*.webmanifest' '*.{json,js,ts,html}'"
+ "format": "prettier --write 'src/**/*.{ts,svelte,css}' 'public/**/*.json' '*.{json,js,ts,html}'"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^5.0.3",
diff --git a/public/site.webmanifest b/public/manifest.json
similarity index 71%
rename from public/site.webmanifest
rename to public/manifest.json
index 577641e..08a2915 100644
--- a/public/site.webmanifest
+++ b/public/manifest.json
@@ -1,6 +1,7 @@
{
"name": "Paul1365972's Spectrogram",
"short_name": "Spectrogram",
+ "description": "A spectrogram with pitch estimation and lots of configuration options",
"icons": [
{
"src": "/android-chrome-192x192.png",
@@ -15,5 +16,6 @@
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
- "display": "standalone"
+ "display": "standalone",
+ "start_url": "/"
}
diff --git a/src/components/DualSlider.svelte b/src/components/DualSlider.svelte
index 7515a87..0b87397 100644
--- a/src/components/DualSlider.svelte
+++ b/src/components/DualSlider.svelte
@@ -12,14 +12,17 @@
let lowerPercentage = $derived(inverseLogScale($settings.lowerFrequency, MIN_FREQ, MAX_FREQ))
let upperPercentage = $derived(inverseLogScale($settings.upperFrequency, MIN_FREQ, MAX_FREQ))
- function handleDrag(event: MouseEvent, isLower: boolean) {
+ function handleStart(event: MouseEvent | TouchEvent, isLower: boolean) {
+ event.preventDefault()
const slider = event.currentTarget as HTMLElement
const rect = slider.parentElement!.getBoundingClientRect()
- const startX = event.clientX
+ const startX = event instanceof MouseEvent ? event.clientX : event.touches[0].clientX
const startPos = isLower ? lowerPercentage : upperPercentage
- function onMove(moveEvent: MouseEvent) {
- const delta = (moveEvent.clientX - startX) / rect.width
+ function onMove(moveEvent: MouseEvent | TouchEvent) {
+ const currentX =
+ moveEvent instanceof MouseEvent ? moveEvent.clientX : moveEvent.touches[0].clientX
+ const delta = (currentX - startX) / rect.width
let newPercentage = Math.max(0, Math.min(1, startPos + delta))
if (isLower) {
@@ -31,16 +34,20 @@
}
}
- function onUp() {
+ function onEnd() {
window.removeEventListener('mousemove', onMove)
- window.removeEventListener('mouseup', onUp)
+ window.removeEventListener('mouseup', onEnd)
+ window.removeEventListener('touchmove', onMove)
+ window.removeEventListener('touchend', onEnd)
}
window.addEventListener('mousemove', onMove)
- window.addEventListener('mouseup', onUp)
+ window.addEventListener('mouseup', onEnd)
+ window.addEventListener('touchmove', onMove)
+ window.addEventListener('touchend', onEnd)
}
- function handleDoubleClick(event: MouseEvent, lower: boolean, upper: boolean) {
+ function handleDoubleClick(event: MouseEvent | TouchEvent, lower: boolean, upper: boolean) {
event.stopPropagation()
const defaultSettings = getDefaultSettings()
if (lower && defaultSettings.lowerFrequency < $settings.upperFrequency) {
@@ -68,7 +75,8 @@