Compare commits

...

11 Commits

Author SHA1 Message Date
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
8 changed files with 83 additions and 88 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

2
package-lock.json generated
View File

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

View File

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

View File

@@ -59,6 +59,7 @@ module.exports = function () {
} else {
const userVersion = row.user_version
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')
@@ -85,6 +86,19 @@ module.exports = function () {
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

@@ -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 || !isSporadicValid"
:disabled="playDisabled || !isTimerValid || (loadedSamples.length != 0 && !isSporadicValid)"
class="mx-3 mb-5"
fab
large
@@ -640,7 +640,7 @@
v-if="canUpload"
cols="12"
>
<h2 class="display-1 font-weight-bold mb-7">
<h2 class="display-1 font-weight-bold mb-5">
Samples
</h2>
@@ -776,7 +776,6 @@
</v-row>
<v-row
justify="center"
class="mb-5"
>
<v-radio-group
@@ -785,11 +784,11 @@
mandatory
>
<v-radio
label="Continuous"
label="Continuous (Looped)"
value="continuous"
/>
<v-radio
label="Sporadic"
label="Sporadic (Not Looped, Plays Randomly Within Interval"
value="sporadic"
/>
</v-radio-group>
@@ -807,7 +806,7 @@
label="Sporadic Min"
class="mx-3"
:disabled="sample.playbackMode != 'sporadic' || playDisabled"
:rules="[validateSporadicRange(sample)]"
:rules="[rules.gt(-1)]"
/>
<v-text-field
@@ -816,30 +815,13 @@
label="Sporadic Max"
class="mx-3"
:disabled="sample.playbackMode != 'sporadic' || playDisabled"
:rules="[validateSporadicRange(sample)]"
:rules="[rules.gt(0)]"
/>
</v-row>
</v-form>
<v-row
justify="center"
class="my-7"
>
<p
v-if="sample.playbackMode != 'sporadic'"
class="text--disabled"
>
(Sample will play randomly, every {{ sample.sporadicMin }} to {{ sample.sporadicMax }} seconds)
</p>
<p
v-else
>
(Sample will play randomly, every {{ sample.sporadicMin }} to {{ sample.sporadicMax }} seconds)
</p>
</v-row>
<v-divider
class="mb-7"
class="mt-7"
/>
</v-container>
</v-row>

View File

@@ -155,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()
@@ -186,6 +188,18 @@ 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
@@ -204,37 +218,27 @@ export default {
} else {
this.players.player(s.id).toDestination()
}
})
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)
this.loadedSamples.forEach(s => {
this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
})
} else {
this.noise.sync().start(0)
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)
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)
}
})
}
})
Tone.Transport.start('+0.1')
},
@@ -902,15 +906,6 @@ export default {
this.selectedProfile = this.profileItems.find(p => p.text === this.activeProfile.name)
this.updateProfile()
this.confirmSwitchProfileDialog = false
},
validateSporadicRange (sample) {
const min = parseInt(sample.sporadicMin, 10)
const max = parseInt(sample.sporadicMax, 10)
if (isNaN(min) || isNaN(max) || max <= min || min <= 0 || max <= 0) {
return 'Invalid'
} else {
return true
}
}
}
}