Compare commits

...

75 Commits

Author SHA1 Message Date
32f5262b93 Update Gitea Container Registry URL in workflow configuration 2025-08-18 12:53:10 +00:00
34dc770854 Update devcontainer image to use node:18 for consistency 2025-08-18 12:53:05 +00:00
221fe79f87 Upgrade actions/checkout to v4 and streamline system dependencies installation 2025-08-18 12:41:28 +00:00
b73cf924bc Add .gitattributes for consistent line endings across platforms 2025-08-18 12:40:53 +00:00
8c3744db9b Add PWA support and service worker for offline capabilities
- Create .devcontainer/devcontainer.env and .devcontainer/devcontainer.json for development environment configuration
- Add Gitea Actions README and Docker workflow for building and pushing images
- Update package.json to include @vue/cli-plugin-pwa
- Enhance index.html with manifest link and theme color
- Create public/manifest.webmanifest for PWA configuration
- Implement service worker registration and media session management in registerServiceWorker.js
- Update main.js to register the service worker
- Configure vue.config.js for PWA settings and caching strategies
2025-08-18 07:25:53 -05:00
Kevin Thomas
8595a3f155 Change version to 0.7.0 2025-08-12 20:07:13 -04:00
Kevin Thomas
9f376ae56f Fix comments in json file 2025-08-12 19:56:33 -04:00
Kevin Thomas
cba9cd6e85 Upgrade vue to 2.7.16 2025-08-12 19:42:46 -04:00
Kevin Thomas
7b080e0163 Bump node to 20 and fix some vulnerabilities 2025-08-12 19:38:41 -04:00
Isaac Johnson
0618f9e8d6 Kubernetes Manifest install 2025-08-12 19:38:05 -04:00
Kay Thomas
1c3f09fcb8 Merge pull request #63 from kaythomas0/v0.6.13
v0.6.13
2023-12-11 15:36:03 -05:00
Kevin Thomas
98419b6248 Bump to v0.6.13 2023-12-03 19:33:57 -05:00
Kay Thomas
2d2f1810d1 Merge pull request #62 from kaythomas0/dependabot/npm_and_yarn/axios-1.6.0
Bump axios from 0.21.4 to 1.6.0
2023-12-03 19:24:40 -05:00
Kay Thomas
c9fcf06503 Merge pull request #61 from kaythomas0/dependabot/npm_and_yarn/babel/traverse-7.23.2
Bump @babel/traverse from 7.18.2 to 7.23.2
2023-12-03 19:19:26 -05:00
dependabot[bot]
53c05dfe56 Bump axios from 0.21.4 to 1.6.0
Bumps [axios](https://github.com/axios/axios) from 0.21.4 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.4...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-10 16:37:21 +00:00
dependabot[bot]
2dc54c7347 Bump @babel/traverse from 7.18.2 to 7.23.2
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.18.2 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-18 03:02:56 +00:00
Kay Thomas
bd73809ad9 Merge pull request #60 from kaythomas0/v0.6.12
v0.6.12
2023-07-25 03:22:19 +01:00
Kevin Thomas
3d7c3545ea Bump to v0.6.12 2023-07-19 09:58:18 -07:00
Kay Thomas
02c5fd9660 Merge pull request #59 from kaythomas0/dependabot/npm_and_yarn/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4
2023-07-19 17:57:13 +01:00
dependabot[bot]
d98b23ed40 Bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-19 05:08:43 +00:00
Kay Thomas
d57ea01750 Merge pull request #58 from kaythomas0/dev
Update README.md
2023-04-17 01:42:51 -07:00
Kay Thomas
3cc060fdae Update README.md 2023-04-17 01:42:32 -07:00
Kay Thomas
2f21025d20 Merge pull request #57 from kaythomas0/v0.6.11
v0.6.11
2023-04-17 01:40:29 -07:00
Kay Thomas
bdbbdee48d Upgrade node to 16 2023-04-16 23:36:35 -07:00
Kay Thomas
f442d486a3 Merge pull request #56 from kaythomas0/v0.6.10
v0.6.10
2023-03-16 15:43:46 -07:00
Kevin Thomas
ef3eb1a70a Bump to v0.6.10 2023-03-16 13:41:21 -07:00
Kay Thomas
2bb67a9a22 Merge pull request #55 from kaythomas0/dependabot/npm_and_yarn/webpack-5.76.1
Bump webpack from 5.72.1 to 5.76.1
2023-03-16 13:39:47 -07:00
dependabot[bot]
af2384b790 Bump webpack from 5.72.1 to 5.76.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.72.1 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.72.1...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 01:24:57 +00:00
Kay Thomas
d83639b5c6 Merge pull request #54 from kaythomas0/v0.6.9
v0.6.9
2023-02-15 19:44:29 -08:00
Kevin Thomas
5d3a6fb912 Bump to v0.6.9 2023-02-15 16:56:11 -08:00
Kay Thomas
722e0600f1 Merge pull request #53 from kaythomas0/dependabot/npm_and_yarn/sideway/formula-3.0.1
Bump @sideway/formula from 3.0.0 to 3.0.1
2023-02-15 16:54:17 -08:00
dependabot[bot]
cd65c0b714 Bump @sideway/formula from 3.0.0 to 3.0.1
Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sideway/formula/releases)
- [Commits](https://github.com/sideway/formula/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: "@sideway/formula"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 04:23:55 +00:00
Kay Thomas
d73afdb68c Merge pull request #51 from kaythomas0/v0.6.8
v0.6.8
2023-01-09 12:07:01 -08:00
Kevin Thomas
e72503e91e Bump to v0.6.8 2023-01-09 11:26:07 -08:00
Kay Thomas
294a4e4dec Merge pull request #50 from kaythomas0/dependabot/npm_and_yarn/json5-1.0.2
Bump json5 from 1.0.1 to 1.0.2
2023-01-09 11:24:33 -08:00
dependabot[bot]
21fda5ce04 Bump json5 from 1.0.1 to 1.0.2
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-08 08:05:24 +00:00
Kay Thomas
17301b5b31 Merge pull request #49 from kaythomas0/dev
Update dependabot.yml
2022-11-19 15:58:28 -08:00
Kay Thomas
923f5bb52e Update dependabot.yml 2022-11-19 15:57:32 -08:00
Kay Thomas
0cac4f2d5a Merge pull request #48 from kaythomas0/v0.6.7
v0.6.7
2022-11-17 18:00:01 -08:00
Kay Thomas
5b99b8cfc2 Upgrade Vue CLI 2022-11-17 01:38:35 -08:00
Kay Thomas
1ae403171e Merge pull request #46 from kaythomas0/dev
Disable version updates for npm dependencies
2022-11-10 10:32:29 -08:00
Kevin Thomas
c329f4f70a Disable version updates for npm dependencies 2022-11-10 10:31:43 -08:00
Kay Thomas
f1654d39ca Merge pull request #40 from kaythomas0/v0.6.6
v0.6.6
2022-11-10 10:24:29 -08:00
Kevin Thomas
a698934823 Fix loader-utils vulnerability 2022-11-10 09:27:29 -08:00
Kevin Thomas
0ec92bad85 Add dependabot.yml 2022-11-10 09:23:14 -08:00
Kay Thomas
0bb814e763 Merge pull request #37 from kaythomas0/v0.6.5
v0.6.5
2022-09-23 11:22:41 -07:00
Kay Thomas
621576db14 Bump vuetify from 2.6.6 to 2.6.10
Bumps [vuetify](https://github.com/vuetifyjs/vuetify/tree/HEAD/packages/vuetify) from 2.6.6 to 2.6.10.
- [Release notes](https://github.com/vuetifyjs/vuetify/releases)
- [Commits](https://github.com/vuetifyjs/vuetify/commits/v2.6.10/packages/vuetify)

---
updated-dependencies:
- dependency-name: vuetify
  dependency-type: direct:production
...
2022-09-21 22:58:38 -07:00
Kay Thomas
80969ca029 Merge pull request #35 from kaythomas0/v0.6.4
v0.6.4
2022-09-12 22:29:59 -07:00
Kevin Thomas
26fc54054f Fix bug that causes editing a sample to discard unsaved work 2022-09-11 21:17:45 -07:00
Kay Thomas
8a1fc99fb5 Merge pull request #34 from kaythomas0/v0.6.3
v0.6.3
2022-09-11 17:38:08 -07:00
Kevin Thomas
e6cc5b36c5 Fix typo 2022-09-11 15:11:17 -07:00
Kevin Thomas
6c4c24c166 Fix unwanted display of unsaved work dialog 2022-09-06 02:36:36 -07:00
Kevin Thomas
9466ed692b Use strict sameSite cookies 2022-09-06 02:36:19 -07:00
Kevin Thomas
5ace3d9996 Update package*.json 2022-09-06 02:35:54 -07:00
Kay Thomas
c4642df353 Merge pull request #33 from kaythomas0/v0.6.2
v0.6.2
2022-09-04 20:41:54 -07:00
Kevin Thomas
aca7fbd1e0 Fix sporadic playback with timer 2022-09-04 19:46:31 -07:00
Kay Thomas
90f4d50b7f Merge pull request #32 from kaythomas0/v0.6.1
v0.6.1
2022-08-31 17:01:57 -07:00
Kevin Thomas
66b23f39a6 Fix db migration 2022-08-31 15:37:04 -07:00
Kevin Thomas
4d22dab887 Fix sporadic validation, fix preferences bug 2022-08-31 11:16:23 -07:00
Kay Thomas
bc93b05c4e Merge pull request #31 from kaythomas0/dev
Add another screenshot
2022-08-30 13:29:35 -07:00
Kevin Thomas
60a01908c2 Add another screenshot 2022-08-30 13:28:00 -07:00
Kay Thomas
5879e6d327 Merge pull request #30 from kaythomas0/dev
Update README.md
2022-08-30 13:24:09 -07:00
Kay Thomas
88cbfe0bf1 Update README.md 2022-08-30 13:23:54 -07:00
Kay Thomas
74c7d543c0 Merge pull request #29 from kaythomas0/dev
Update README
2022-08-30 13:23:11 -07:00
Kevin Thomas
dc81a65c7a Update README 2022-08-30 13:22:53 -07:00
Kay Thomas
3358efce1d Merge pull request #28 from kaythomas0/v0.6.0
v0.6.0
2022-08-30 13:12:23 -07:00
Kevin Thomas
2d71af03d0 Move delete sample icon, fix sporadic bug 2022-08-29 14:53:25 -07:00
Kevin Thomas
aae33a6121 Support multiple sporadic samples 2022-08-28 16:31:24 -07:00
Kay Thomas
cc3fe4608d Add reverb and sample playback support for recording 2022-08-26 23:19:19 -07:00
Kay Thomas
38de3595c4 Merge pull request #27 from kaythomas0/reverb
Implement Reverb andSample Playback Mode
2022-08-26 21:13:33 -07:00
Kevin Thomas
4330b04c1f Implement sample playback mode, fix loop points bug 2022-08-26 16:10:40 -07:00
Kay Thomas
70aa906110 Add License to README 2022-08-23 00:04:08 -07:00
Kay Thomas
55851a4cd0 Continue implementing sample playback mode 2022-08-20 03:02:24 -07:00
Kevin Thomas
3c738925bc Start implementing sample playback mode 2022-08-19 22:28:36 -07:00
Kay Thomas
3dbbf4c85d Implement reverb 2022-08-13 23:58:39 -07:00
25 changed files with 16925 additions and 4076 deletions

View File

@@ -0,0 +1,2 @@
CHOKIDAR_USEPOLLING=true
WDS_SOCKET_PORT=0

View File

@@ -0,0 +1,39 @@
{
"name": "Noisedash Dev",
"image": "node:18",
"forwardPorts": [8080, 1432],
"portsAttributes": {
"8080": { "label": "Vue dev server" },
"1432": { "label": "Noisedash API" }
},
"postCreateCommand": "npm install",
"remoteEnv": {
"HOST": "0.0.0.0"
},
"containerEnv": {
"HOST": "0.0.0.0"
},
"runArgs": ["--env-file", ".devcontainer/devcontainer.env"],
"remoteUser": "node",
"customizations": {
"vscode": {
"settings": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.format.enable": true,
"eslint.validate": ["javascript", "vue"],
"terminal.integrated.defaultProfile.linux": "bash",
"vetur.validation.template": true,
"vetur.validation.script": true,
"vetur.validation.style": true
},
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"octref.vetur"
]
}
},
"updateContentCommand": "",
"onCreateCommand": "mkdir -p samples sessions log",
"postStartCommand": "npm run server & npm run serve"
}

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

17
.gitea/README.md Normal file
View File

@@ -0,0 +1,17 @@
Gitea Actions for Docker builds
This folder contains workflows for building and pushing Docker images to the Gitea Container Registry.
Setup
- Ensure Gitea Actions is enabled in your instance and for this repo.
- Create the following repository secrets:
- REGISTRY_HOST: your Gitea host (e.g., gitea.example.com)
- REGISTRY_OWNER: your namespace/user/org (e.g., ryan)
- REGISTRY_REPO: repository name (e.g., noisedash)
- REGISTRY_USERNAME: registry username
- REGISTRY_PASSWORD: registry password or a scoped token
Notes
- The workflow builds on pushes to main/master/dev and on tags v*.*.*.
- It produces multi-arch images (amd64, arm64). Adjust platforms if not needed.
- Image name resolves to: ${REGISTRY_HOST}/${REGISTRY_OWNER}/${REGISTRY_REPO} with tags derived from branch/tag/sha.

View File

@@ -0,0 +1,61 @@
name: build-and-push-docker
on:
push:
branches: [ main, master, dev ]
tags:
- 'v*.*.*'
pull_request:
branches: [ main, master, dev ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install system Dependencies
run: |
apt-get update && apt-get install -y curl jq docker.io
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: gitea.purpleraft.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_HOST }}/${{ env.REGISTRY_OWNER }}/${{ env.REGISTRY_REPO }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Build (PR only)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push (branches/tags)
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

8
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
# Disable version updates for npm dependencies
open-pull-requests-limit: 0

BIN
.github/noisedash-screenshot-4.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -1,8 +1,8 @@
FROM node:14
FROM node:20
LABEL maintainer="kaythomas@pm.me"
WORKDIR /var/noisedash
COPY package*.json ./
RUN npm install
RUN npm install --force
COPY . .
ENV NODE_ENV production
RUN npm run build

View File

@@ -11,7 +11,7 @@ Self-hostable web tool for generating ambient noises
* Generate and customize ambient noises and user-uploadable samples (leveraging [Tone.js](https://github.com/Tonejs/Tone.js/))
* Save "noise profiles" so you can easily switch between your created soundscapes. Import and export them for easy sharing, record them for use elsewhere
* Fine-tune your noises with audio processing tools like filters, LFOs, and effects
* Upload and edit audio samples (e.g rain, wind, thunder) to combine with your generated noises
* Upload and edit audio samples (e.g rain, wind, thunder) to combine with your generated noises. Add effects to them and set playback modes
* Use admin tools to manage multiple users
* Mobile friendly
@@ -23,6 +23,9 @@ Requires docker and docker-compose
* Download the provided [docker-compose.yml file](https://github.com/kaythomas0/noisedash/blob/main/docker-compose.yml)
* In the same directory as the docker-compose file, created a folder called `config`, and inside it, put the provided [config file](https://github.com/kaythomas0/noisedash/blob/main/config/default.json)
* `maxSampleSize` is in bytes - 10GB by default
* Keep `tls` as `false` if using an external web server like nginx
* `production.json` exists in the source code and is left empty intentionally for the reason outlined here: https://github.com/node-config/node-config/wiki/Strict-Mode#node_env-value-of-node_env-did-not-match-any-deployment-config-file-names=
* Edit the config file to your preference
* Bring the container up:
@@ -34,9 +37,26 @@ docker-compose up -d
(Raspberry Pi compatible images are available, see armv7 images on [Docker Hub](https://hub.docker.com/repository/docker/noisedash/noisedash))
## Kubernetes
You can apply the manifest.yaml in the kubernetes folder to install Noisedash into your Kubernetes cluster.
Optionally, uncomment the last lines in the file to also create an ingress. The ingress, commented out by default, needs to have the clusterIssuser annotation set to your cluster issuer (default: letsencrypt-prod) and the ingress class set to your Ingress class (default: Nginx)
``` bash
$ kubectl apply -f ./kubernetes/manifest.yaml
persistentvolumeclaim/db-pvc created
persistentvolumeclaim/samples-pvc created
deployment.apps/noisedash created
service/noisedash created
configmap/noisedashcfg created
ingress.networking.k8s.io/noisedashingress created
```
## From Source
Requires node 14 and npm
Requires node 20 and npm
* Clone the repo:
@@ -65,3 +85,21 @@ npm run server-prod
# Contributing
See [CONTRIBUTING.md](https://github.com/kaythomas0/noisedash/blob/main/CONTRIBUTING.md)
# License
Noisedash, a self-hostable web tool for generating ambient noises
Copyright (C) 2021 Kay Thomas <kaythomas@pm.me>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -3,9 +3,9 @@
"listeningPort": 1432,
"sessionFileStorePath": "sessions",
"sampleUploadPath": "samples",
"maxSampleSize": 10737418240, // In bytes, 10GB by default
"maxSampleSize": 10737418240,
"logFile": "log/noisedash.log",
"tls": false, // Keep this as false if using an external web server like nginx
"tls": false,
"tlsKey": "certs/key.pem",
"tlsCert": "certs/cert.pem"
}

View File

@@ -1 +1 @@
{} // Left empty intentionally: https://github.com/node-config/node-config/wiki/Strict-Mode#node_env-value-of-node_env-did-not-match-any-deployment-config-file-names=
{}

240
kubernetes/manifest.yaml Normal file
View File

@@ -0,0 +1,240 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: samples-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: noisedash
spec:
replicas: 1
selector:
matchLabels:
app: noisedash
template:
metadata:
labels:
app: noisedash
spec:
containers:
- name: noisedash
image: noisedash/noisedash:latest
ports:
- containerPort: 1432
volumeMounts:
- name: db
mountPath: /var/noisedash/db
- name: samples
mountPath: /var/noisedash/samples
- name: config
mountPath: /var/noisedash/config/default.json
subPath: config.json
volumes:
- name: db
persistentVolumeClaim:
claimName: db-pvc
- name: samples
persistentVolumeClaim:
claimName: samples-pvc
- name: config
configMap:
name: noisedashcfg
---
apiVersion: v1
kind: Service
metadata:
name: noisedash
spec:
selector:
app: noisedash
ports:
- protocol: TCP
port: 80
targetPort: 1432
---
apiVersion: v1
kind: ConfigMap
metadata:
name: noisedashcfg
data:
config.json: |
{
"Server": {
"listeningPort": 1432,
"sessionFileStorePath": "sessions",
"sampleUploadPath": "samples",
"maxSampleSize": 10737418240,
"logFile": "log/noisedash.log",
"tls": false,
"tlsKey": "certs/key.pem",
"tlsCert": "certs/cert.pem"
}
}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
labels:
app.kubernetes.io/instance: noisedash
name: noisedashingress
spec:
rules:
- host: noisedash.freshbrewed.science
http:
paths:
- backend:
service:
name: noisedash
port:
number: 80
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- noisedash.freshbrewed.science
secretName: noisedash-tls
builder@DESKTOP-QADGF36:~/Workspaces/pyplanereport$
builder@DESKTOP-QADGF36:~/Workspaces/pyplanereport$ cat noiseall.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: samples-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: noisedash
spec:
replicas: 1
selector:
matchLabels:
app: noisedash
template:
metadata:
labels:
app: noisedash
spec:
containers:
- name: noisedash
image: noisedash/noisedash:latest
ports:
- containerPort: 1432
volumeMounts:
- name: db
mountPath: /var/noisedash/db
- name: samples
mountPath: /var/noisedash/samples
- name: config
mountPath: /var/noisedash/config/default.json
subPath: config.json
volumes:
- name: db
persistentVolumeClaim:
claimName: db-pvc
- name: samples
persistentVolumeClaim:
claimName: samples-pvc
- name: config
configMap:
name: noisedashcfg
---
apiVersion: v1
kind: Service
metadata:
name: noisedash
spec:
selector:
app: noisedash
ports:
- protocol: TCP
port: 80
targetPort: 1432
---
apiVersion: v1
kind: ConfigMap
metadata:
name: noisedashcfg
data:
config.json: |
{
"Server": {
"listeningPort": 1432,
"sessionFileStorePath": "sessions",
"sampleUploadPath": "samples",
"maxSampleSize": 10737418240,
"logFile": "log/noisedash.log",
"tls": false,
"tlsKey": "certs/key.pem",
"tlsCert": "certs/cert.pem"
}
}
# ---
# apiVersion: networking.k8s.io/v1
# kind: Ingress
# metadata:
# annotations:
# cert-manager.io/cluster-issuer: letsencrypt-prod
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
# nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
# labels:
# app.kubernetes.io/instance: noisedash
# name: noisedashingress
# spec:
# rules:
# - host: noisedash.freshbrewed.science
# http:
# paths:
# - backend:
# service:
# name: noisedash
# port:
# number: 80
# path: /
# pathType: ImplementationSpecific
# tls:
# - hosts:
# - noisedash.freshbrewed.science
# secretName: noisedash-tls

19975
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "noisedash",
"version": "0.5.0",
"version": "0.7.0",
"private": true,
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
"scripts": {
@@ -12,11 +12,11 @@
},
"dependencies": {
"@vscode/sqlite3": "^5.0.8",
"axios": "^0.21.4",
"axios": "^1.6.0",
"config": "^3.3.6",
"connect-history-api-fallback": "^1.6.0",
"cookie-parser": "^1.4.5",
"core-js": "^3.22.7",
"core-js": "^3.23.5",
"express": "^4.18.1",
"express-session": "^1.17.3",
"multer": "^1.4.5-lts.1",
@@ -25,18 +25,19 @@
"path": "^0.12.7",
"session-file-store": "^1.5.0",
"tone": "^14.7.77",
"vue": "^2.6.11",
"vue": "^2.7.16",
"vue-router": "^3.5.4",
"vuetify": "^2.6.6",
"vuetify": "^2.6.10",
"winston": "^3.3.3"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "^5.0.4",
"@vue/cli-plugin-eslint": "^5.0.4",
"@vue/cli-plugin-router": "^5.0.4",
"@vue/cli-service": "^5.0.4",
"@vue/cli-plugin-pwa": "^5.0.8",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-eslint": "^5.0.8",
"@vue/cli-plugin-router": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/eslint-config-standard": "^6.1.0",
"eslint": "^7.32.0",
"eslint-plugin-html": "^6.2.0",
@@ -44,11 +45,11 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"eslint-plugin-vue": "^7.20.0",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "^2.5.0",
"vue-template-compiler": "^2.6.11",
"vue-cli-plugin-vuetify": "^2.5.8",
"vue-template-compiler": "^2.7.16",
"vuetify-loader": "^1.7.3"
},
"bugs": "https://github.com/kaythomas0/noisedash/issues",

View File

@@ -5,6 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<meta name="theme-color" content="#121212">
<link rel="manifest" href="<%= BASE_URL %>manifest.webmanifest">
<title><%= htmlWebpackPlugin.options.title %></title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">

View File

@@ -0,0 +1,16 @@
{
"name": "Noisedash",
"short_name": "Noisedash",
"start_url": "/",
"display": "standalone",
"background_color": "#121212",
"theme_color": "#121212",
"description": "Ambient noise generator",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
]
}

View File

@@ -36,7 +36,8 @@ app.use(session({
store: new FileStore(fileStoreOptions),
secret: sessionSecret,
resave: true,
saveUninitialized: true
saveUninitialized: true,
cookie: { sameSite: 'strict' }
}))
app.use((req, res, next) => {
const msgs = req.session.messages || []

View File

@@ -59,20 +59,46 @@ module.exports = function () {
} else {
const userVersion = row.user_version
if (userVersion < 1) {
db.run('ALTER TABLE samples ADD COLUMN fade_in REAL DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_points_enabled INTEGER DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_start REAL DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_end REAL DEFAULT 0')
db.serialize(() => {
if (userVersion < 1) {
db.run('ALTER TABLE samples ADD COLUMN fade_in REAL DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_points_enabled INTEGER DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_start REAL DEFAULT 0')
db.run('ALTER TABLE samples ADD COLUMN loop_end REAL DEFAULT 0')
db.run('PRAGMA user_version = 1')
}
db.run('PRAGMA user_version = 1')
}
if (userVersion < 2) {
db.run('ALTER TABLE users ADD COLUMN preferences TEXT DEFAULT "{}"')
if (userVersion < 2) {
db.run('ALTER TABLE users ADD COLUMN preferences TEXT DEFAULT "{}"')
db.run('PRAGMA user_version = 2')
}
db.run('PRAGMA user_version = 2')
}
if (userVersion < 3) {
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_enabled INTEGER DEFAULT 0')
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_pre_delay REAL DEFAULT 0')
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_decay REAL DEFAULT 0')
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_wet INTEGER DEFAULT 0')
db.run('ALTER TABLE profiles_samples ADD COLUMN playback_mode TEXT DEFAULT "continuous"')
db.run('ALTER TABLE profiles_samples ADD COLUMN sporadic_min INTEGER DEFAULT 30')
db.run('ALTER TABLE profiles_samples ADD COLUMN sporadic_max INTEGER DEFAULT 300')
db.run('PRAGMA user_version = 3')
}
if (userVersion < 4) {
db.run('UPDATE users SET preferences = ? WHERE preferences = ?',
['{"accentColor":{"alpha":1,"hex":"#607D8B","hexa":"#607D8BFF","hsla":{"h":200,"s":18,"l":46,"a":1},"hsva":{"h":200,"s":31,"v":55,"a":1},"hue":200,"rgba":{"r":96,"g":125,"b":139,"a":1}}}', '{}'],
(err) => {
if (err) {
logger.error(err)
} else {
db.run('PRAGMA user_version = 4')
}
})
}
})
}
})
})

View File

@@ -59,10 +59,28 @@ router.post('/profiles', (req, res) => {
profileID = this.lastID
req.body.samples.forEach(s => {
db.run('INSERT INTO profiles_samples (profile, sample, volume) VALUES (?, ?, ?)', [
db.run(`INSERT INTO profiles_samples(
profile,
sample,
volume,
reverb_enabled,
reverb_pre_delay,
reverb_decay,
reverb_wet,
playback_mode,
sporadic_min,
sporadic_max)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
profileID,
s.id,
s.volume
s.volume,
s.reverbEnabled,
s.reverbPreDelay,
s.reverbDecay,
s.reverbWet,
s.playbackMode,
s.sporadicMin,
s.sporadicMax
],
(err) => {
if (err) {
@@ -204,10 +222,28 @@ router.put('/profiles/:profileId', (req, res) => {
})
req.body.samples.forEach(s => {
db.run('INSERT INTO profiles_samples (profile, sample, volume) VALUES (?, ?, ?)', [
db.run(`INSERT INTO profiles_samples(
profile,
sample,
volume,
reverb_enabled,
reverb_pre_delay,
reverb_decay,
reverb_wet,
playback_mode,
sporadic_min,
sporadic_max)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
req.params.profileId,
s.id,
s.volume
s.volume,
s.reverbEnabled,
s.reverbPreDelay,
s.reverbDecay,
s.reverbWet,
s.playbackMode,
s.sporadicMin,
s.sporadicMax
],
(err) => {
if (err) {
@@ -355,6 +391,13 @@ router.get('/profiles/:profileId', (req, res) => {
samples.id,
name,
profiles_samples.volume,
profiles_samples.reverb_enabled as reverbEnabled,
profiles_samples.reverb_pre_delay as reverbPreDelay,
profiles_samples.reverb_decay as reverbDecay,
profiles_samples.reverb_wet as reverbWet,
profiles_samples.playback_mode as playbackMode,
profiles_samples.sporadic_min as sporadicMin,
profiles_samples.sporadic_max as sporadicMax,
fade_in as fadeIn,
loop_points_enabled as loopPointsEnabled,
loop_start as loopStart,
@@ -382,6 +425,13 @@ router.get('/profiles/:profileId', (req, res) => {
sample.loopPointsEnabled = row.loopPointsEnabled === 1
sample.loopStart = row.loopStart
sample.loopEnd = row.loopEnd
sample.reverbEnabled = row.reverbEnabled === 1
sample.reverbPreDelay = row.reverbPreDelay
sample.reverbDecay = row.reverbDecay
sample.reverbWet = row.reverbWet
sample.playbackMode = row.playbackMode
sample.sporadicMin = row.sporadicMin
sample.sporadicMax = row.sporadicMax
samples.push(sample)
})

View File

@@ -72,6 +72,8 @@ router.post('/users', (req, res) => {
return res.sendStatus(500)
}
const defaultPreferences = '{"accentColor":{"alpha":1,"hex":"#607D8B","hexa":"#607D8BFF","hsla":{"h":200,"s":18,"l":46,"a":1},"hsva":{"h":200,"s":31,"v":55,"a":1},"hue":200,"rgba":{"r":96,"g":125,"b":139,"a":1}}}'
if (row.count !== 0) {
if (!req.user) {
return res.sendStatus(401)
@@ -94,15 +96,16 @@ router.post('/users', (req, res) => {
return res.sendStatus(500)
}
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload)
VALUES (?, ?, ?, ?, ?, ?, ?)`, [
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload, preferences)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
req.body.username,
hashedPassword,
salt,
req.body.name,
req.body.isAdmin,
req.body.darkMode,
req.body.canUpload
req.body.canUpload,
defaultPreferences
], (err) => {
if (err) {
logger.error(err)
@@ -125,15 +128,16 @@ router.post('/users', (req, res) => {
return res.sendStatus(500)
}
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload)
VALUES (?, ?, ?, ?, ?, ?, ?)`, [
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload, preferences)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
req.body.username,
hashedPassword,
salt,
req.body.name,
req.body.isAdmin,
req.body.darkMode,
req.body.canUpload
req.body.canUpload,
defaultPreferences
], function (err) {
if (err) {
logger.error(err)

View File

@@ -14,7 +14,7 @@
<v-row justify="center">
<v-btn
:disabled="playDisabled || !isTimerValid"
:disabled="playDisabled || !isTimerValid || (loadedSamples.length != 0 && !isSporadicValid)"
class="mx-3 mb-5"
fab
large
@@ -50,7 +50,7 @@
label="Profiles"
class="mx-3 mb-5"
:disabled="playDisabled"
@change="loadProfile"
@change="loadProfile(true)"
/>
</v-row>
@@ -297,7 +297,7 @@
<v-card-text>
<v-container>
<v-row>
<p>Select profile to record audio for. This is only supported on Chrome and Firefox.</p>
<p>Select profile to record audio for. This is only supported on Chrome and Firefox. Current profile will be saved before recording.</p>
</v-row>
<v-row>
<v-select
@@ -652,18 +652,26 @@
<v-row
justify="center"
>
{{ sample.name }}
<v-col />
<v-col>
<h2 class="mb-5">
{{ sample.name }}
</h2>
</v-col>
<v-col>
<v-btn
icon
:disabled="playDisabled"
@click="removeSample(index)"
>
<v-icon>mdi-delete</v-icon>
</v-btn>
</v-col>
</v-row>
<v-row>
<v-btn
icon
:disabled="playDisabled"
@click="removeSample(index)"
>
<v-icon>mdi-delete</v-icon>
</v-btn>
<v-slider
v-model="sample.volume"
label="Volume"
@@ -679,6 +687,142 @@
<p>{{ loadedSamples[index].volume }}</p>
</div>
</v-row>
<v-row
justify="center"
>
<h3 class="font-weight-regular mb-9">
Effects
</h3>
</v-row>
<v-expansion-panels class="mb-9">
<v-expansion-panel>
<v-expansion-panel-header>
Reverb
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-row justify="center">
<v-checkbox
v-model="sample.reverbEnabled"
:disabled="playDisabled"
label="Enabled"
/>
</v-row>
<v-row justify="center">
<v-slider
v-model="sample.reverbPreDelay"
:disabled="playDisabled || !sample.reverbEnabled"
label="Pre Delay"
thumb-label
max="16"
min="0"
step="0.5"
class="mx-3"
/>
<div
class="mx-3"
>
<p>{{ sample.reverbPreDelay }}</p>
</div>
</v-row>
<v-row justify="center">
<v-slider
v-model="sample.reverbDecay"
:disabled="playDisabled || !sample.reverbEnabled"
label="Decay"
thumb-label
max="16"
min="0"
step="0.5"
class="mx-3"
@input="updateVolume"
/>
<div
class="mx-3"
>
<p> {{ sample.reverbDecay }}</p>
</div>
</v-row>
<v-row justify="center">
<v-slider
v-model="sample.reverbWet"
:disabled="playDisabled || !sample.reverbEnabled"
label="Wet"
thumb-label
max="1"
min="0"
step="0.01"
class="mx-3"
@input="updateVolume"
/>
<div
class="mx-3"
>
<p>{{ sample.reverbWet }}%</p>
</div>
</v-row>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<v-row justify="center">
<h3 class="font-weight-regular">
Playback Mode
</h3>
</v-row>
<v-row
class="mb-5"
>
<v-radio-group
v-model="sample.playbackMode"
:disabled="playDisabled"
mandatory
>
<v-radio
label="Continuous (Looped)"
value="continuous"
/>
<v-radio
label="Sporadic (Not Looped, Plays Randomly Within Interval)"
value="sporadic"
/>
</v-radio-group>
</v-row>
<v-form
v-model="isSporadicValid"
>
<v-row
justify="center"
>
<v-text-field
v-model="sample.sporadicMin"
type="number"
label="Sporadic Min"
class="mx-3"
:disabled="sample.playbackMode != 'sporadic' || playDisabled"
:rules="[rules.gt(-1)]"
/>
<v-text-field
v-model="sample.sporadicMax"
type="number"
label="Sporadic Max"
class="mx-3"
:disabled="sample.playbackMode != 'sporadic' || playDisabled"
:rules="[rules.gt(0)]"
/>
</v-row>
</v-form>
<v-divider
class="mt-7"
/>
</v-container>
</v-row>
@@ -851,7 +995,7 @@
<v-checkbox
v-model="previewSampleLoopPointsEnabled"
:disabled="previewSamplePlaying"
label="Use Loop Points"
label="Use Loop Points (Continuous Playback Mode Only)"
@change="updatePreviewSampleLoopPoints"
/>
</v-row>
@@ -882,7 +1026,7 @@
<v-text-field
v-model="previewSampleFadeIn"
type="number"
label="Fade In Time"
label="Fade In Time (In continuous mode, this only effects first playback)"
:disabled="previewSamplePlaying"
:rules="[rules.gt(-1)]"
@change="updatePreviewSamplePlayerFadeIn"

View File

@@ -1,4 +1,5 @@
import * as Tone from 'tone'
import { setMediaSessionMetadata } from '@/registerServiceWorker'
export default {
name: 'Noise',
@@ -75,6 +76,7 @@ export default {
unwatch: null,
confirmSwitchProfileDialog: false,
activeProfile: {},
isSporadicValid: false,
errorSnackbar: false,
errorSnackbarText: '',
rules: {
@@ -123,6 +125,13 @@ export default {
this.loadedSamples.forEach(s => {
settings.push(s.volume)
settings.push(s.reverbEnabled)
settings.push(s.reverbPreDelay)
settings.push(s.reverbDecay)
settings.push(s.reverbWet)
settings.push(s.playbackMode)
settings.push(s.sporadicMin)
settings.push(s.sporadicMax)
})
return settings
@@ -147,11 +156,13 @@ export default {
this.stop()
},
methods: {
play () {
async play () {
if (!this.players.loaded) {
return
}
await Tone.start()
this.playDisabled = true
Tone.Transport.cancel()
@@ -178,35 +189,84 @@ export default {
this.lfo.connect(this.filter.frequency).start()
}
if (this.isTimerEnabled) {
this.duration = parseInt((this.hours * 3600)) + parseInt((this.minutes * 60)) + parseInt(this.seconds)
this.timeRemaining = this.duration
this.transportInterval = setInterval(() => this.stop(), this.duration * 1000 + 100)
this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
Tone.Transport.loopEnd = this.duration
this.noise.sync().start(0).stop(this.duration)
} else {
this.noise.sync().start(0)
}
this.loadedSamples.forEach(s => {
this.players.player(s.id).loop = true
this.players.player(s.id).fadeIn = s.fadeIn
if (s.loopPointsEnabled) {
this.players.player(s.id).setLoopPoints(s.loopStart, s.loopEnd)
} else {
this.players.player(s.id).setLoopPoints(0, this.players.player(s.id).buffer.duration)
}
this.players.player(s.id).volume.value = s.volume
this.players.player(s.id).disconnect()
if (s.reverbEnabled) {
const reverb = new Tone.Reverb(s.reverbDecay).toDestination()
reverb.set({ preDelay: s.reverbPreDelay, wet: s.reverbWet })
this.players.player(s.id).connect(reverb)
} else {
this.players.player(s.id).toDestination()
}
if (s.playbackMode === 'sporadic') {
this.players.player(s.id).loop = false
const maxInt = parseInt(s.sporadicMax, 10)
const minInt = parseInt(s.sporadicMin, 10)
if (minInt <= maxInt) {
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
}
} else {
this.players.player(s.id).loop = true
if (this.isTimerEnabled) {
this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
} else {
this.players.player(s.id).unsync().sync().start(0)
}
}
})
if (this.isTimerEnabled) {
this.duration = parseInt((this.hours * 3600)) + parseInt((this.minutes * 60)) + parseInt(this.seconds)
this.noise.sync().start(0).stop(this.duration)
Tone.Transport.loopEnd = this.duration
this.timeRemaining = this.duration
this.transportInterval = setInterval(() => this.stop(), this.duration * 1000 + 100)
this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
Tone.Transport.start('+0.1')
this.loadedSamples.forEach(s => {
this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
})
} else {
this.noise.sync().start(0)
// Update Media Session so playback can continue in background with proper metadata
try {
setMediaSessionMetadata({ title: (this.selectedProfile && this.selectedProfile.text) ? this.selectedProfile.text : 'Noisedash' })
if ('mediaSession' in navigator) {
navigator.mediaSession.playbackState = 'playing'
navigator.mediaSession.setActionHandler('play', () => this.play())
navigator.mediaSession.setActionHandler('pause', () => this.stop())
navigator.mediaSession.setActionHandler('stop', () => this.stop())
}
} catch (e) { /* no-op */ }
},
playSporadicSample (id) {
const sample = this.loadedSamples.find(s => s.id === id)
this.loadedSamples.forEach(s => {
this.players.player(s.id).unsync().sync().start(0)
})
}
clearInterval(sample.initialSporadicPlayInterval)
clearInterval(sample.sporadicInterval)
Tone.Transport.start()
this.players.player(id).unsync().sync().start()
const maxInt = parseInt(sample.sporadicMax, 10)
const minInt = parseInt(sample.sporadicMin, 10)
sample.playNextTime = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
sample.sporadicInterval = setInterval(() => this.playSporadicSample(id), sample.playNextTime * 1000)
},
stop () {
clearInterval(this.transportInterval)
@@ -216,6 +276,18 @@ export default {
clearInterval(this.timeRemainingInterval)
this.timeRemaining = 0
this.duration = 0
this.loadedSamples.forEach(s => {
if (s.playbackMode === 'sporadic') {
clearInterval(s.initialSporadicPlayInterval)
clearInterval(s.sporadicInterval)
}
})
// Reflect playback state for OS controls
if ('mediaSession' in navigator) {
try { navigator.mediaSession.playbackState = 'paused' } catch (e) { /* no-op */ }
}
},
startTimer () {
this.timeRemaining -= 1
@@ -289,7 +361,7 @@ export default {
}
this.exportedProfile = this.profileItems[0]
this.recordedProfile = this.profileItems[0]
this.loadProfile()
this.loadProfile(true)
}
}
})
@@ -365,8 +437,8 @@ export default {
this.errorSnackbar = true
})
},
loadProfile () {
if (this.unsavedWork) {
loadProfile (checkForUnsavedWork) {
if (checkForUnsavedWork && this.unsavedWork) {
this.confirmSwitchProfileDialog = true
} else {
this.$http.get('/profiles/'.concat(this.selectedProfile.id))
@@ -470,6 +542,8 @@ export default {
this.checkedSamples.forEach(i => {
const load = this.allSamples.find(e => e.id === i)
load.volume = -10
load.sporadicMin = 30
load.sporadicMax = 300
this.loadedSamples.push(load)
})
@@ -679,7 +753,16 @@ export default {
}).then(response => {
if (response.status === 200) {
this.getSamples()
this.loadProfile()
// Update sample if it's already loaded in current profile
const sample = this.loadedSamples.find(s => s.id === this.selectedPreviewSample.id)
if (sample) {
sample.fadeIn = this.previewSampleFadeIn
sample.loopPointsEnabled = this.previewSampleLoopPointsEnabled
sample.loopStart = this.previewSampleLoopStart
sample.loopEnd = this.previewSampleLoopEnd
}
this.closeEditSampleForm()
this.infoSnackbarText = 'Sample Saved'
this.infoSnackbar = true
@@ -703,6 +786,9 @@ export default {
this.profileMoreDialog = false
},
startRecording () {
// Save current profile before recording
this.updateProfile()
this.$http.get('/profiles/'.concat(this.recordedProfile.id))
.then(async response => {
if (response.status === 200) {
@@ -771,22 +857,45 @@ export default {
this.players.player(s.id).fadeIn = s.fadeIn
if (s.loopPointsEnabled) {
this.players.player(s.id).setLoopPoints(s.loopStart, s.loopEnd)
} else {
this.players.player(s.id).setLoopPoints(0, this.players.player(s.id).buffer.duration)
}
this.players.player(s.id).volume.value = s.volume
this.players.player(s.id).connect(this.recorder)
this.players.player(s.id).unsync().sync().start(0)
this.players.player(s.id).disconnect()
if (s.reverbEnabled) {
const reverb = new Tone.Reverb(s.reverbDecay).connect(this.recorder).toDestination()
reverb.set({ preDelay: s.reverbPreDelay, wet: s.reverbWet })
this.players.player(s.id).connect(reverb)
} else {
this.players.player(s.id).connect(this.recorder).toDestination()
}
})
this.noise.sync().start(0)
Tone.Transport.start()
this.loadedSamples.forEach(s => {
if (s.playbackMode === 'sporadic') {
this.players.player(s.id).loop = false
const maxInt = parseInt(s.sporadicMax, 10)
const minInt = parseInt(s.sporadicMin, 10)
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
} else {
this.players.player(s.id).loop = true
this.players.player(s.id).unsync().sync().start(0)
}
})
Tone.Transport.start('+0.1')
},
async stopRecording () {
const recording = await this.recorder.stop()
// Set active profile back to the selected one
this.loadProfile()
this.loadProfile(false)
const url = URL.createObjectURL(recording)
const anchor = document.createElement('a')
@@ -795,6 +904,14 @@ export default {
anchor.click()
clearInterval(this.recordingInterval)
this.loadedSamples.forEach(s => {
if (s.playbackMode === 'sporadic') {
clearInterval(s.initialSporadicPlayInterval)
clearInterval(s.sporadicInterval)
}
})
this.recordingDialog = false
this.stop()
},
@@ -802,7 +919,7 @@ export default {
await this.recorder.stop()
// Set active profile back to the selected one
this.loadProfile()
this.loadProfile(false)
clearInterval(this.recordingInterval)
this.recordingDialog = false
@@ -810,7 +927,7 @@ export default {
},
discardChanges () {
this.unsavedWork = false
this.loadProfile()
this.loadProfile(true)
this.confirmSwitchProfileDialog = false
},
saveChanges () {

View File

@@ -3,6 +3,7 @@ import App from './App.vue'
import router from './router'
import vuetify from './plugins/vuetify'
import instance from './axios'
import './registerServiceWorker'
Vue.prototype.$http = instance

View File

@@ -0,0 +1,46 @@
/* global workbox */
// Registers the service worker generated by @vue/cli-plugin-pwa
// This enables installability and offline caching for static assets.
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
const register = async () => {
try {
const reg = await navigator.serviceWorker.register(`${process.env.BASE_URL}service-worker.js`)
// Listen for updates and activate immediately
reg.addEventListener('updatefound', () => {
const newWorker = reg.installing
if (!newWorker) return
newWorker.addEventListener('statechange', () => {
if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
// New content is available; refresh clients
reg.waiting && reg.waiting.postMessage({ type: 'SKIP_WAITING' })
}
})
})
// Claim clients after activation
navigator.serviceWorker.addEventListener('controllerchange', () => {
// optional: location.reload()
})
} catch (e) {
// eslint-disable-next-line no-console
console.warn('SW registration failed', e)
}
}
register()
}
// Minimal Media Session API wiring so playback can continue in background on supported browsers
export function setMediaSessionMetadata (opts = {}) {
if ('mediaSession' in navigator) {
const md = new window.MediaMetadata({
title: opts.title || 'Noisedash',
artist: opts.artist || 'Ambient Generator',
album: opts.album || 'Noisedash',
artwork: opts.artwork || [
{ src: '/favicon.ico', sizes: '64x64', type: 'image/x-icon' }
]
})
navigator.mediaSession.metadata = md
}
}

View File

@@ -3,6 +3,48 @@ module.exports = {
'vuetify'
],
devServer: {
proxy: 'http://localhost:1432'
host: '0.0.0.0',
port: 8080,
allowedHosts: 'all',
proxy: 'http://localhost:1432'
},
pwa: {
name: 'Noisedash',
themeColor: '#121212',
backgroundColor: '#121212',
display: 'standalone',
startUrl: '/',
manifestOptions: {
short_name: 'Noisedash',
description: 'Ambient noise generator',
categories: ['music', 'audio', 'productivity'],
display_override: ['standalone', 'browser'],
orientation: 'any'
},
iconPaths: {
favicon32: 'favicon.ico',
favicon16: 'favicon.ico',
appleTouchIcon: 'favicon.ico',
maskIcon: 'favicon.ico',
msTileImage: 'favicon.ico'
},
workboxPluginMode: 'GenerateSW',
workboxOptions: {
cleanupOutdatedCaches: true,
skipWaiting: true,
clientsClaim: true,
offlineGoogleAnalytics: false,
runtimeCaching: [
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|webp|mp3|wav|ogg)$/,
handler: 'CacheFirst',
options: {
cacheName: 'assets-cache',
expiration: { maxEntries: 60, maxAgeSeconds: 7 * 24 * 60 * 60 },
cacheableResponse: { statuses: [0, 200] }
}
}
]
}
}
}