Compare commits

..

19 Commits

Author SHA1 Message Date
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
9 changed files with 371 additions and 41 deletions

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

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
@@ -65,3 +65,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/>.

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "noisedash",
"version": "0.5.0",
"version": "0.6.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "noisedash",
"version": "0.5.0",
"version": "0.6.0",
"private": true,
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
"scripts": {

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
@@ -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>

View File

@@ -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()
@@ -183,8 +193,19 @@ 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).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 (this.isTimerEnabled) {
@@ -202,11 +223,38 @@ export default {
this.noise.sync().start(0)
this.loadedSamples.forEach(s => {
this.players.player(s.id).unsync().sync().start(0)
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
this.players.player(s.id).unsync().sync().start(0)
}
})
}
Tone.Transport.start()
Tone.Transport.start('+0.1')
},
playSporadicSample (id) {
const sample = this.loadedSamples.find(s => s.id === id)
clearInterval(sample.initialSporadicPlayInterval)
clearInterval(sample.sporadicInterval)
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 +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
@@ -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)
})
@@ -771,16 +828,39 @@ 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()
@@ -795,6 +875,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()
},