Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -40,9 +40,8 @@ const EFFECTS = {
|
|
| 40 |
|
| 41 |
slowed_reverb: {
|
| 42 |
name: "Slowed + Reverb",
|
| 43 |
-
description: "
|
| 44 |
-
|
| 45 |
-
command: `-af "atempo=0.85,asetrate=44100*0.92,aresample=44100,bass=g=5:f=80:width_type=h:width=120,aecho=0.8:0.88:250:0.5,aecho=0.7:0.78:400:0.4,aecho=0.6:0.68:600:0.3,equalizer=f=100:t=q:width=2:g=4,equalizer=f=4000:t=q:width=4:g=-4,acompressor=threshold=-20dB:ratio=2:attack=15:release=200:makeup=2,highpass=f=50,lowpass=f=7000,volume=1.4" -ar 44100 -b:a 192k`
|
| 46 |
},
|
| 47 |
|
| 48 |
nightcore: {
|
|
@@ -65,10 +64,8 @@ const EFFECTS = {
|
|
| 65 |
|
| 66 |
bass_boosted: {
|
| 67 |
name: "Bass Boosted",
|
| 68 |
-
description: "
|
| 69 |
-
|
| 70 |
-
// Pattern: 15s slow β 3s mute β 8s building β 5s HIGH β repeat
|
| 71 |
-
command: `-af "bass=g=18:f=55:width_type=o:width=1.5,bass=g=14:f=95:width_type=h:width=90,equalizer=f=35:t=q:width=1.2:g=12,equalizer=f=75:t=q:width=1.5:g=10,equalizer=f=140:t=q:width=2:g=8,equalizer=f=500:t=q:width=2:g=-3,equalizer=f=4000:t=q:width=4:g=-6,volume='mod(t,31):if(lt(MOD,15),0.4,if(lt(MOD,18),0.05,if(lt(MOD,26),0.5+0.0625*(MOD-18),1.5)))':eval=frame,acompressor=threshold=-22dB:ratio=8:attack=3:release=40:makeup=8,tremolo=f=0.15:d=0.3,highpass=f=28,alimiter=limit=0.95:attack=5:release=50" -ar 44100 -b:a 192k`
|
| 72 |
},
|
| 73 |
|
| 74 |
ambient: {
|
|
@@ -209,45 +206,24 @@ app.get('/download/:filename', (req, res) => {
|
|
| 209 |
const filePath = path.join(outputsDir, filename);
|
| 210 |
|
| 211 |
if (!fs.existsSync(filePath)) {
|
| 212 |
-
console.log(`β File not found: ${filename}`);
|
| 213 |
return res.status(404).json({
|
| 214 |
success: false,
|
| 215 |
error: 'File not found'
|
| 216 |
});
|
| 217 |
}
|
| 218 |
|
| 219 |
-
|
| 220 |
-
console.log(`π₯ Downloading: ${filename} (${(fileStats.size / 1024).toFixed(2)} KB)`);
|
| 221 |
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
const fileStream = fs.createReadStream(filePath);
|
| 231 |
-
|
| 232 |
-
fileStream.on('error', (err) => {
|
| 233 |
-
console.error(`β Stream error: ${err.message}`);
|
| 234 |
-
if (!res.headersSent) {
|
| 235 |
-
res.status(500).json({ success: false, error: 'Download failed' });
|
| 236 |
}
|
| 237 |
});
|
| 238 |
-
|
| 239 |
-
fileStream.on('end', () => {
|
| 240 |
-
console.log(`β
Download complete: ${filename}`);
|
| 241 |
-
// Clean up after successful download
|
| 242 |
-
setTimeout(() => {
|
| 243 |
-
if (fs.existsSync(filePath)) {
|
| 244 |
-
fs.unlinkSync(filePath);
|
| 245 |
-
console.log(`ποΈ Cleaned: ${filename}`);
|
| 246 |
-
}
|
| 247 |
-
}, 10000);
|
| 248 |
-
});
|
| 249 |
-
|
| 250 |
-
fileStream.pipe(res);
|
| 251 |
});
|
| 252 |
|
| 253 |
// π Start Server
|
|
|
|
| 40 |
|
| 41 |
slowed_reverb: {
|
| 42 |
name: "Slowed + Reverb",
|
| 43 |
+
description: "Deep slow tempo, cathedral reverb, dreamy space",
|
| 44 |
+
command: `-af "atempo=0.75,asetrate=44100*0.88,aresample=44100,bass=g=5:f=80:width_type=h:width=120,aecho=0.8:0.88:250:0.5,aecho=0.7:0.78:400:0.4,aecho=0.6:0.68:600:0.3,equalizer=f=100:t=q:width=2:g=4,equalizer=f=4000:t=q:width=4:g=-4,acompressor=threshold=-20dB:ratio=2:attack=15:release=200:makeup=2,highpass=f=50,lowpass=f=7000,volume=1.4" -ar 44100 -b:a 192k`
|
|
|
|
| 45 |
},
|
| 46 |
|
| 47 |
nightcore: {
|
|
|
|
| 64 |
|
| 65 |
bass_boosted: {
|
| 66 |
name: "Bass Boosted",
|
| 67 |
+
description: "Maximum sub-bass, club-style punch",
|
| 68 |
+
command: `-af "bass=g=15:f=60:width_type=o:width=1.5,bass=g=12:f=100:width_type=h:width=80,equalizer=f=40:t=q:width=1.2:g=10,equalizer=f=80:t=q:width=1.5:g=8,equalizer=f=150:t=q:width=2:g=6,equalizer=f=500:t=q:width=2:g=-2,equalizer=f=4000:t=q:width=4:g=-5,acompressor=threshold=-24dB:ratio=6:attack=5:release=50:makeup=6,highpass=f=30,volume=1.2" -ar 44100 -b:a 192k`
|
|
|
|
|
|
|
| 69 |
},
|
| 70 |
|
| 71 |
ambient: {
|
|
|
|
| 206 |
const filePath = path.join(outputsDir, filename);
|
| 207 |
|
| 208 |
if (!fs.existsSync(filePath)) {
|
|
|
|
| 209 |
return res.status(404).json({
|
| 210 |
success: false,
|
| 211 |
error: 'File not found'
|
| 212 |
});
|
| 213 |
}
|
| 214 |
|
| 215 |
+
console.log(`π₯ Downloading: ${filename}`);
|
|
|
|
| 216 |
|
| 217 |
+
res.download(filePath, filename, (err) => {
|
| 218 |
+
if (!err) {
|
| 219 |
+
setTimeout(() => {
|
| 220 |
+
if (fs.existsSync(filePath)) {
|
| 221 |
+
fs.unlinkSync(filePath);
|
| 222 |
+
console.log(`ποΈ Cleaned: ${filename}`);
|
| 223 |
+
}
|
| 224 |
+
}, 10000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
}
|
| 226 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
});
|
| 228 |
|
| 229 |
// π Start Server
|