mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-11 19:06:20 +00:00
Compare commits
85 Commits
v0.4.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7606f68204 | ||
|
|
8595a3f155 | ||
|
|
9f376ae56f | ||
|
|
cba9cd6e85 | ||
|
|
7b080e0163 | ||
|
|
0618f9e8d6 | ||
|
|
1c3f09fcb8 | ||
|
|
98419b6248 | ||
|
|
2d2f1810d1 | ||
|
|
c9fcf06503 | ||
|
|
53c05dfe56 | ||
|
|
2dc54c7347 | ||
|
|
bd73809ad9 | ||
|
|
3d7c3545ea | ||
|
|
02c5fd9660 | ||
|
|
d98b23ed40 | ||
|
|
d57ea01750 | ||
|
|
3cc060fdae | ||
|
|
2f21025d20 | ||
|
|
bdbbdee48d | ||
|
|
f442d486a3 | ||
|
|
ef3eb1a70a | ||
|
|
2bb67a9a22 | ||
|
|
af2384b790 | ||
|
|
d83639b5c6 | ||
|
|
5d3a6fb912 | ||
|
|
722e0600f1 | ||
|
|
cd65c0b714 | ||
|
|
d73afdb68c | ||
|
|
e72503e91e | ||
|
|
294a4e4dec | ||
|
|
21fda5ce04 | ||
|
|
17301b5b31 | ||
|
|
923f5bb52e | ||
|
|
0cac4f2d5a | ||
|
|
5b99b8cfc2 | ||
|
|
1ae403171e | ||
|
|
c329f4f70a | ||
|
|
f1654d39ca | ||
|
|
a698934823 | ||
|
|
0ec92bad85 | ||
|
|
0bb814e763 | ||
|
|
621576db14 | ||
|
|
80969ca029 | ||
|
|
26fc54054f | ||
|
|
8a1fc99fb5 | ||
|
|
e6cc5b36c5 | ||
|
|
6c4c24c166 | ||
|
|
9466ed692b | ||
|
|
5ace3d9996 | ||
|
|
c4642df353 | ||
|
|
aca7fbd1e0 | ||
|
|
90f4d50b7f | ||
|
|
66b23f39a6 | ||
|
|
4d22dab887 | ||
|
|
bc93b05c4e | ||
|
|
60a01908c2 | ||
|
|
5879e6d327 | ||
|
|
88cbfe0bf1 | ||
|
|
74c7d543c0 | ||
|
|
dc81a65c7a | ||
|
|
3358efce1d | ||
|
|
2d71af03d0 | ||
|
|
aae33a6121 | ||
|
|
cc3fe4608d | ||
|
|
38de3595c4 | ||
|
|
4330b04c1f | ||
|
|
70aa906110 | ||
|
|
55851a4cd0 | ||
|
|
3c738925bc | ||
|
|
3dbbf4c85d | ||
|
|
a3f7709adf | ||
|
|
496b71ee7b | ||
|
|
c2aad26e3f | ||
|
|
b84522847a | ||
|
|
231dea143a | ||
|
|
659d48548d | ||
|
|
7dc4524fa0 | ||
|
|
9b2bdaf159 | ||
|
|
d3cc1db2f9 | ||
|
|
34215b4126 | ||
|
|
5fc23030d4 | ||
|
|
4fc23521c1 | ||
|
|
cb3e39729a | ||
|
|
5219f53655 |
8
.github/dependabot.yml
vendored
Normal file
8
.github/dependabot.yml
vendored
Normal 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-1.jpg
vendored
BIN
.github/noisedash-screenshot-1.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 78 KiB |
BIN
.github/noisedash-screenshot-4.png
vendored
Normal file
BIN
.github/noisedash-screenshot-4.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
10
.github/workflows/docker-image.yml
vendored
10
.github/workflows/docker-image.yml
vendored
@@ -1,11 +1,15 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
if: ${{ github.event.label.name == 'run-workflow' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
@@ -31,4 +35,4 @@ jobs:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
push: true
|
||||
tags: noisedash/noisedash:latest,noisedash/noisedash:${{ github.ref_name }}
|
||||
tags: noisedash/noisedash:latest,noisedash/noisedash:${{ github.head_ref }}
|
||||
|
||||
@@ -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
|
||||
|
||||
44
README.md
44
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
Self-hostable web tool for generating ambient noises
|
||||
|
||||

|
||||

|
||||
|
||||
(More screenshots on the [wiki](https://github.com/kaythomas0/noisedash/wiki/Screenshots))
|
||||
|
||||
@@ -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/>.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
240
kubernetes/manifest.yaml
Normal 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
|
||||
20418
package-lock.json
generated
20418
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "noisedash",
|
||||
"version": "0.4.0",
|
||||
"version": "0.7.0",
|
||||
"private": true,
|
||||
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
|
||||
"scripts": {
|
||||
@@ -12,31 +12,31 @@
|
||||
},
|
||||
"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.3",
|
||||
"passport": "^0.4.1",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"passport": "^0.6.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"path": "^0.12.7",
|
||||
"session-file-store": "^1.5.0",
|
||||
"tone": "^14.7.77",
|
||||
"vue": "^2.6.11",
|
||||
"vue": "^3.5.22",
|
||||
"vue-router": "^3.5.4",
|
||||
"vuetify": "^2.6.6",
|
||||
"vuetify": "^3.10.3",
|
||||
"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-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,12 +44,12 @@
|
||||
"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",
|
||||
"vuetify-loader": "^1.7.3"
|
||||
"vue-cli-plugin-vuetify": "^2.5.8",
|
||||
"vue-template-compiler": "^2.7.16",
|
||||
"vuetify-loader": "^1.9.2"
|
||||
},
|
||||
"bugs": "https://github.com/kaythomas0/noisedash/issues",
|
||||
"descriptions": "Self-hostable web tool for generating ambient noises",
|
||||
|
||||
@@ -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 || []
|
||||
|
||||
@@ -59,14 +59,46 @@ module.exports = function () {
|
||||
} else {
|
||||
const userVersion = row.user_version
|
||||
|
||||
if (userVersion === 0) {
|
||||
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 "{}"')
|
||||
|
||||
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')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -36,8 +36,14 @@ router.get('/admin', (req, res) => {
|
||||
})
|
||||
|
||||
router.get('/logout', (req, res) => {
|
||||
req.logout()
|
||||
res.sendStatus(200)
|
||||
req.logout((err) => {
|
||||
if (err) {
|
||||
logger.error(err)
|
||||
res.sendStatus(500)
|
||||
} else {
|
||||
res.sendStatus(200)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/setup', (req, res) => {
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
@@ -9,7 +9,11 @@ router.get('/users/current', (req, res) => {
|
||||
return res.sendStatus(401)
|
||||
}
|
||||
|
||||
db.get('SELECT is_admin as isAdmin, dark_mode as darkMode, can_upload as canUpload, * FROM users WHERE id = ?', [req.user.id], (err, row) => {
|
||||
db.get(`SELECT
|
||||
is_admin as isAdmin,
|
||||
dark_mode as darkMode,
|
||||
can_upload as canUpload,
|
||||
* FROM users WHERE id = ?`, [req.user.id], (err, row) => {
|
||||
if (err) {
|
||||
logger.error(err)
|
||||
return res.sendStatus(500)
|
||||
@@ -24,6 +28,7 @@ router.get('/users/current', (req, res) => {
|
||||
user.isAdmin = row.isAdmin === 1
|
||||
user.darkMode = row.darkMode === 1
|
||||
user.canUpload = row.canUpload === 1
|
||||
user.preferences = JSON.parse(row.preferences)
|
||||
}
|
||||
|
||||
res.json({ user: user })
|
||||
@@ -67,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)
|
||||
@@ -89,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)
|
||||
@@ -120,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)
|
||||
@@ -287,4 +296,23 @@ router.delete('/users/:userId', (req, res) => {
|
||||
})
|
||||
})
|
||||
|
||||
router.patch('/users/preferences', (req, res) => {
|
||||
if (!req.user) {
|
||||
return res.sendStatus(401)
|
||||
}
|
||||
|
||||
const preferences = JSON.stringify(req.body.preferences)
|
||||
|
||||
db.serialize(() => {
|
||||
db.run('UPDATE users SET preferences = ? WHERE id = ?', [preferences, req.user.id], (err) => {
|
||||
if (err) {
|
||||
logger.error(err)
|
||||
return res.sendStatus(500)
|
||||
} else {
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<h2 class="headline font-weight-bold mb-3">
|
||||
User Management
|
||||
</h2>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-row>
|
||||
ID: {{ currentUser.id }}
|
||||
@@ -26,7 +30,7 @@
|
||||
>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
class="my-3"
|
||||
class="mt-5 mb-10"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
@click="resetChangePasswordForm"
|
||||
@@ -77,12 +81,35 @@
|
||||
</v-form>
|
||||
</v-dialog>
|
||||
|
||||
<h2 class="headline font-weight-bold mb-3">
|
||||
Preferences
|
||||
</h2>
|
||||
|
||||
<h3 class="font-weight-bold">
|
||||
Dark Mode
|
||||
</h3>
|
||||
|
||||
<v-switch
|
||||
v-model="$vuetify.theme.dark"
|
||||
label="Dark Mode"
|
||||
:label="`${$vuetify.theme.dark ? 'On' : 'Off'}`"
|
||||
@change="toggleDarkMode"
|
||||
/>
|
||||
|
||||
<h3 class="mb-5 font-weight-bold">
|
||||
Accent Color
|
||||
</h3>
|
||||
|
||||
<v-color-picker
|
||||
v-model="accentColor"
|
||||
/>
|
||||
|
||||
<v-btn
|
||||
class="mt-5"
|
||||
@click="updateAccentColor"
|
||||
>
|
||||
Apply
|
||||
</v-btn>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
timeout="3000"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
dense
|
||||
>
|
||||
<v-app-bar-nav-icon
|
||||
@click="getCurrentUser"
|
||||
@click="checkForAdmin"
|
||||
/>
|
||||
</v-app-bar>
|
||||
<v-navigation-drawer
|
||||
|
||||
@@ -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,8 @@
|
||||
<v-checkbox
|
||||
v-model="previewSampleLoopPointsEnabled"
|
||||
:disabled="previewSamplePlaying"
|
||||
label="Use Loop Points"
|
||||
label="Use Loop Points (Continuous Playback Mode Only)"
|
||||
@change="updatePreviewSampleLoopPoints"
|
||||
/>
|
||||
</v-row>
|
||||
|
||||
@@ -881,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"
|
||||
|
||||
@@ -6,6 +6,7 @@ export default {
|
||||
changePasswordDialog: false,
|
||||
isPasswordValid: false,
|
||||
password: '',
|
||||
accentColor: {},
|
||||
snackbar: false,
|
||||
snackbarText: '',
|
||||
rules: {
|
||||
@@ -21,6 +22,7 @@ export default {
|
||||
.then(response => {
|
||||
if (response.status === 200) {
|
||||
this.currentUser = response.data.user
|
||||
this.accentColor = this.currentUser.preferences.accentColor
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -45,6 +47,14 @@ export default {
|
||||
this.$http.patch('/users/dark-mode', {
|
||||
darkMode: this.$vuetify.theme.dark
|
||||
})
|
||||
},
|
||||
updateAccentColor () {
|
||||
const preferences = { accentColor: this.accentColor }
|
||||
this.$http.patch('/users/preferences', {
|
||||
preferences: preferences
|
||||
})
|
||||
this.$vuetify.theme.themes.dark.primary = this.accentColor.hex
|
||||
this.$vuetify.theme.themes.light.primary = this.accentColor.hex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ export default {
|
||||
isAdmin: false,
|
||||
loggedIn: false
|
||||
}),
|
||||
created () {
|
||||
this.getUserPreferences()
|
||||
},
|
||||
methods: {
|
||||
home () {
|
||||
this.$router.push('/')
|
||||
@@ -24,7 +27,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
getCurrentUser () {
|
||||
checkForAdmin () {
|
||||
this.loggedIn = false
|
||||
this.drawyer = true
|
||||
this.$http.get('/users/current')
|
||||
@@ -32,12 +35,21 @@ export default {
|
||||
if (response.status === 200) {
|
||||
this.loggedIn = true
|
||||
this.isAdmin = response.data.user.isAdmin
|
||||
this.$vuetify.theme.dark = response.data.user.darkMode
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.isAdmin = false
|
||||
})
|
||||
},
|
||||
getUserPreferences () {
|
||||
this.$http.get('/users/current')
|
||||
.then(response => {
|
||||
if (response.status === 200) {
|
||||
const preferences = response.data.user.preferences
|
||||
this.$vuetify.theme.themes.dark.primary = preferences.accentColor.hex
|
||||
this.$vuetify.theme.themes.light.primary = preferences.accentColor.hex
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ export default {
|
||||
unwatch: null,
|
||||
confirmSwitchProfileDialog: false,
|
||||
activeProfile: {},
|
||||
isSporadicValid: false,
|
||||
errorSnackbar: false,
|
||||
errorSnackbarText: '',
|
||||
rules: {
|
||||
@@ -123,6 +124,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 +155,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 +188,73 @@ 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')
|
||||
},
|
||||
playSporadicSample (id) {
|
||||
const sample = this.loadedSamples.find(s => s.id === id)
|
||||
|
||||
this.loadedSamples.forEach(s => {
|
||||
this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
|
||||
})
|
||||
} else {
|
||||
this.noise.sync().start(0)
|
||||
clearInterval(sample.initialSporadicPlayInterval)
|
||||
clearInterval(sample.sporadicInterval)
|
||||
|
||||
this.loadedSamples.forEach(s => {
|
||||
this.players.player(s.id).unsync().sync().start(0)
|
||||
})
|
||||
}
|
||||
this.players.player(id).unsync().sync().start()
|
||||
|
||||
Tone.Transport.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 +264,13 @@ 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)
|
||||
}
|
||||
})
|
||||
},
|
||||
startTimer () {
|
||||
this.timeRemaining -= 1
|
||||
@@ -289,7 +344,7 @@ export default {
|
||||
}
|
||||
this.exportedProfile = this.profileItems[0]
|
||||
this.recordedProfile = this.profileItems[0]
|
||||
this.loadProfile()
|
||||
this.loadProfile(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -365,8 +420,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 +525,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)
|
||||
})
|
||||
|
||||
@@ -489,6 +546,9 @@ export default {
|
||||
if (response.status === 200) {
|
||||
this.canUpload = response.data.user.canUpload
|
||||
this.$vuetify.theme.dark = response.data.user.darkMode
|
||||
const preferences = response.data.user.preferences
|
||||
this.$vuetify.theme.themes.dark.primary = preferences.accentColor.hex
|
||||
this.$vuetify.theme.themes.light.primary = preferences.accentColor.hex
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -649,6 +709,13 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
updatePreviewSampleLoopPoints () {
|
||||
if (this.previewSampleLoopPointsEnabled) {
|
||||
this.samplePreviewPlayer.setLoopPoints(this.previewSampleLoopStart, this.previewSampleLoopEnd)
|
||||
} else {
|
||||
this.samplePreviewPlayer.setLoopPoints(0, this.samplePreviewPlayer.buffer.duration)
|
||||
}
|
||||
},
|
||||
previewSample () {
|
||||
if (this.previewSamplePlaying) {
|
||||
this.previewSamplePlaying = false
|
||||
@@ -669,7 +736,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
|
||||
@@ -693,6 +769,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) {
|
||||
@@ -761,22 +840,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')
|
||||
@@ -785,6 +887,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()
|
||||
},
|
||||
@@ -792,7 +902,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
|
||||
@@ -800,7 +910,7 @@ export default {
|
||||
},
|
||||
discardChanges () {
|
||||
this.unsavedWork = false
|
||||
this.loadProfile()
|
||||
this.loadProfile(true)
|
||||
this.confirmSwitchProfileDialog = false
|
||||
},
|
||||
saveChanges () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import Vuetify from 'vuetify/lib/framework'
|
||||
import Vuetify from 'vuetify/lib'
|
||||
|
||||
import colors from 'vuetify/lib/util/colors'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user