imran056 commited on
Commit
efe75f7
Β·
verified Β·
1 Parent(s): ed11f41

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +36 -25
server.js CHANGED
@@ -29,51 +29,60 @@ const upload = multer({
29
  limits: { fileSize: 50 * 1024 * 1024 }
30
  });
31
 
32
- // πŸš€ OPTIMIZED EFFECTS - Fast Processing
33
  const EFFECTS = {
34
  lofi: {
35
  name: "LoFi Hip Hop",
36
- command: `-filter_complex "[0:a]asetrate=44100*0.92,atempo=1.087,lowpass=f=4200,highpass=f=85,bass=g=6:f=95,treble=g=-4:f=8000,equalizer=f=250:width=180:g=-2.5,equalizer=f=1000:width=500:g=1.5,acompressor=threshold=-22dB:ratio=3.5:attack=8:release=140,vibrato=f=0.22:d=0.45,aecho=0.55:0.68:48:0.28,extrastereo=m=1.5,volume=1.15[out]" -map "[out]" -ar 44100 -b:a 192k`
 
37
  },
38
 
39
  slowed_reverb: {
40
  name: "Slowed + Reverb",
41
- command: `-filter_complex "[0:a]atempo=0.82,asetrate=44100*0.93,lowpass=f=6000,highpass=f=70,bass=g=5:f=85,aecho=0.75:0.82:75:0.38,aecho=0.65:0.75:145:0.28,reverb=roomsize=0.92:wetlevel=0.48,chorus=0.6:0.85:52:0.38:0.22:2,acompressor=threshold=-18dB:ratio=2.8:attack=12:release=180,extrastereo=m=1.8,volume=1.25[out]" -map "[out]" -ar 44100 -b:a 192k`
 
42
  },
43
 
44
  nightcore: {
45
  name: "Nightcore",
46
- command: `-filter_complex "[0:a]atempo=1.28,asetrate=44100*1.12,highpass=f=120,treble=g=5:f=6000,equalizer=f=4000:width=2000:g=3.5,equalizer=f=8000:width=3000:g=4,acompressor=threshold=-16dB:ratio=3.2:attack=4:release=35,crystalizer=i=1.5,extrastereo=m=1.7,volume=1.28[out]" -map "[out]" -ar 44100 -b:a 192k`
 
47
  },
48
 
49
  vaporwave: {
50
  name: "Vaporwave",
51
- command: `-filter_complex "[0:a]asetrate=44100*0.87,atempo=1.15,lowpass=f=5500,highpass=f=90,equalizer=f=400:width=250:g=3.5,equalizer=f=2500:width=1500:g=-1.5,aphaser=in_gain=0.65:out_gain=0.82:delay=4.5:decay=0.55:speed=0.32,chorus=0.68:0.88:58:0.42:0.28:2,vibrato=f=0.18:d=0.5,reverb=roomsize=0.72:wetlevel=0.38,aecho=0.5:0.65:85:0.25,acompressor=threshold=-20dB:ratio=3:attack=10:release=100,extrastereo=m=1.6,volume=1.18[out]" -map "[out]" -ar 44100 -b:a 192k`
 
52
  },
53
 
54
  "8d_audio": {
55
  name: "8D Audio",
56
- command: `-filter_complex "[0:a]apulsator=hz=0.085:mode=sine:width=0.92,extrastereo=m=2.8,aecho=0.72:0.85:65:0.38,haas,bass=g=3:f=90,reverb=roomsize=0.65:wetlevel=0.32,acompressor=threshold=-18dB:ratio=2.5:attack=8:release=90,volume=1.12[out]" -map "[out]" -ar 44100 -b:a 192k`
 
57
  },
58
 
59
  bass_boosted: {
60
  name: "Bass Boosted",
61
- command: `-filter_complex "[0:a]bass=g=18:f=95,bass=g=12:f=65,equalizer=f=45:width=35:g=10,equalizer=f=100:width=80:g=9,equalizer=f=250:width=150:g=6,acompressor=threshold=-24dB:ratio=6:attack=4:release=45,extrastereo=m=1.4,volume=1.15[out]" -map "[out]" -ar 44100 -b:a 192k`
 
62
  },
63
 
64
  ambient: {
65
  name: "Ambient Chill",
66
- command: `-filter_complex "[0:a]asetrate=44100*0.96,atempo=1.042,lowpass=f=7000,highpass=f=60,equalizer=f=2000:width=1500:g=-2.5,reverb=roomsize=0.95:wetlevel=0.55,chorus=0.65:0.88:48:0.42:0.25:3,aecho=0.6:0.75:150:0.32,aphaser=in_gain=0.45:out_gain=0.72:delay=3.8:decay=0.48:speed=0.38,acompressor=threshold=-20dB:ratio=2.2:attack=15:release=200,extrastereo=m=1.8,volume=1.08[out]" -map "[out]" -ar 44100 -b:a 192k`
 
67
  },
68
 
69
  tiktok_lofi: {
70
  name: "TikTok LoFi",
71
- command: `-filter_complex "[0:a]asetrate=44100*0.90,atempo=1.111,lowpass=f=4500,highpass=f=80,bass=g=7:f=90,equalizer=f=900:width=450:g=2,equalizer=f=7500:width=2500:g=-5,acompressor=threshold=-20dB:ratio=4:attack=6:release=120,vibrato=f=0.25:d=0.5,aphaser=in_gain=0.6:out_gain=0.88:delay=2.5:decay=0.5:speed=0.45,aecho=0.6:0.72:45:0.3,extrastereo=m=1.65,volume=1.22[out]" -map "[out]" -ar 44100 -b:a 192k`
 
72
  },
73
 
74
  chill_lofi: {
75
  name: "Chill LoFi",
76
- command: `-filter_complex "[0:a]asetrate=44100*0.94,atempo=1.064,lowpass=f=4800,highpass=f=75,bass=g=5:f=88,treble=g=-3.5:f=7500,equalizer=f=1200:width=600:g=1.2,acompressor=threshold=-21dB:ratio=3:attack=10:release=150,vibrato=f=0.2:d=0.42,aecho=0.5:0.65:55:0.25,reverb=roomsize=0.55:wetlevel=0.28,extrastereo=m=1.5,volume=1.12[out]" -map "[out]" -ar 44100 -b:a 192k`
 
77
  }
78
  };
79
 
@@ -81,13 +90,14 @@ const EFFECTS = {
81
  app.get('/', (req, res) => {
82
  res.json({
83
  status: 'online',
84
- message: '🎡 LoFi Remix API v2.0 - Optimized',
85
- version: '2.0',
86
- performance: 'Fast processing with filter_complex',
87
  total_effects: Object.keys(EFFECTS).length,
88
  available_effects: Object.keys(EFFECTS).map(key => ({
89
  id: key,
90
- name: EFFECTS[key].name
 
91
  })),
92
  endpoints: {
93
  health: 'GET /',
@@ -104,7 +114,8 @@ app.get('/effects', (req, res) => {
104
  total: Object.keys(EFFECTS).length,
105
  effects: Object.keys(EFFECTS).map(key => ({
106
  id: key,
107
- name: EFFECTS[key].name
 
108
  }))
109
  });
110
  });
@@ -135,17 +146,16 @@ app.post('/process', upload.single('audio'), async (req, res) => {
135
  const outputPath = path.join(outputsDir, outputFilename);
136
 
137
  console.log(`🎡 Processing: ${EFFECTS[effectType].name}`);
 
138
 
139
  const effectCommand = EFFECTS[effectType].command;
140
-
141
- // Optimized FFmpeg command with faster settings
142
  const ffmpegCommand = `ffmpeg -i "${inputPath}" -threads 0 ${effectCommand} -y "${outputPath}"`;
143
 
144
  console.log(`βš™οΈ Starting FFmpeg...`);
145
 
146
  const startTime = Date.now();
147
  await execPromise(ffmpegCommand, {
148
- maxBuffer: 50 * 1024 * 1024 // 50MB buffer
149
  });
150
  const processingTime = ((Date.now() - startTime) / 1000).toFixed(2);
151
 
@@ -163,7 +173,8 @@ app.post('/process', upload.single('audio'), async (req, res) => {
163
  filename: outputFilename,
164
  effect: {
165
  id: effectType,
166
- name: EFFECTS[effectType].name
 
167
  },
168
  output: {
169
  size_kb: fileSizeKB
@@ -214,11 +225,11 @@ app.get('/download/:filename', (req, res) => {
214
 
215
  // πŸš€ Start Server
216
  app.listen(PORT, '0.0.0.0', () => {
217
- console.log('═══════════════════════════════════════');
218
- console.log('πŸš€ LoFi Remix API v2.0 - OPTIMIZED');
219
- console.log('═══════════════════════════════════════');
220
  console.log(`πŸ“ Server: http://0.0.0.0:${PORT}`);
221
- console.log(`⚑ Performance: Fast processing enabled`);
222
- console.log(`🎡 Effects: ${Object.keys(EFFECTS).length}`);
223
- console.log('═══════════════════════════════════════');
224
  });
 
29
  limits: { fileSize: 50 * 1024 * 1024 }
30
  });
31
 
32
+ // 🎡 DISTINCT CHARACTER EFFECTS - Each with unique feel
33
  const EFFECTS = {
34
  lofi: {
35
  name: "LoFi Hip Hop",
36
+ description: "Vintage warmth, breathing bass, vinyl crackle feel",
37
+ command: `-af "asetrate=44100*0.88,aresample=44100,bass=g=8:f=85:width_type=h:width=100,treble=g=-6:f=8000,equalizer=f=200:t=q:width=1.5:g=-3,equalizer=f=800:t=q:width=2:g=2,equalizer=f=3000:t=q:width=3:g=-4,acompressor=threshold=-20dB:ratio=4:attack=5:release=100:makeup=4,vibrato=f=0.3:d=0.6,chorus=0.5:0.9:50:0.4:0.25:2,highpass=f=60,lowpass=f=3800,volume=1.3" -ar 44100 -b:a 192k`
38
  },
39
 
40
  slowed_reverb: {
41
  name: "Slowed + Reverb",
42
+ description: "Deep slow tempo, cathedral reverb, dreamy space",
43
+ command: `-af "atempo=0.75,asetrate=44100*0.90,aresample=44100,bass=g=6:f=80:width_type=h:width=120,reverb=roomsize=0.95:time=8:wetlevel=0.5:drylevel=0.5,aecho=0.8:0.88:120:0.4,aecho=0.7:0.78:200:0.3,equalizer=f=100:t=q:width=2:g=5,equalizer=f=4000:t=q:width=4:g=-5,chorus=0.6:0.9:55:0.4:0.25:2,acompressor=threshold=-16dB:ratio=2.5:attack=15:release=200:makeup=2,highpass=f=50,lowpass=f=6500,volume=1.4" -ar 44100 -b:a 192k`
44
  },
45
 
46
  nightcore: {
47
  name: "Nightcore",
48
+ description: "High energy, bright sparkle, anime vocals",
49
+ command: `-af "atempo=1.35,asetrate=44100*1.20,aresample=44100,treble=g=8:f=5000:width_type=h:width=3000,bass=g=-4:f=100,equalizer=f=2000:t=q:width=2:g=3,equalizer=f=6000:t=q:width=3:g=5,equalizer=f=10000:t=q:width=4:g=6,acompressor=threshold=-14dB:ratio=4:attack=2:release=25:makeup=5,crystalizer=i=2:c=1,highpass=f=150,volume=1.4" -ar 44100 -b:a 192k`
50
  },
51
 
52
  vaporwave: {
53
  name: "Vaporwave",
54
+ description: "Retro aesthetic, dreamy pitch, nostalgic vibe",
55
+ command: `-af "asetrate=44100*0.82,aresample=44100,equalizer=f=300:t=q:width=2:g=5,equalizer=f=1500:t=q:width=3:g=-2,equalizer=f=6000:t=q:width=4:g=-5,aphaser=in_gain=0.6:out_gain=0.8:delay=5:decay=0.6:speed=0.25,chorus=0.7:0.9:60:0.45:0.3:3,vibrato=f=0.15:d=0.6,reverb=roomsize=0.75:time=6:wetlevel=0.4:drylevel=0.6,acompressor=threshold=-18dB:ratio=3:attack=12:release=150:makeup=2,highpass=f=70,lowpass=f=5000,volume=1.2" -ar 44100 -b:a 192k`
56
  },
57
 
58
  "8d_audio": {
59
  name: "8D Audio",
60
+ description: "360Β° rotation, immersive headphone experience",
61
+ command: `-af "apulsator=hz=0.08:mode=sine:width=0.95,extrastereo=m=3.5:c=1,aecho=0.8:0.9:80:0.4,aecho=0.7:0.8:140:0.3,haas=level_in=1:level_out=1.2:side_gain=1:middle_source=mid,bass=g=4:f=85,reverb=roomsize=0.7:time=5:wetlevel=0.35:drylevel=0.65,acompressor=threshold=-16dB:ratio=2.5:attack=8:release=80:makeup=2,highpass=f=60,volume=1.15" -ar 44100 -b:a 192k`
62
  },
63
 
64
  bass_boosted: {
65
  name: "Bass Boosted",
66
+ description: "Maximum sub-bass, car audio punch",
67
+ command: `-af "bass=g=20:f=60:width_type=o:width=1.5,bass=g=15:f=100:width_type=h:width=80,equalizer=f=40:t=q:width=1.2:g=12,equalizer=f=80:t=q:width=1.5:g=10,equalizer=f=150:t=q:width=2:g=8,equalizer=f=500:t=q:width=2:g=-3,equalizer=f=4000:t=q:width=4:g=-6,acompressor=threshold=-22dB:ratio=8:attack=3:release=40:makeup=8,highpass=f=30,volume=1.2" -ar 44100 -b:a 192k`
68
  },
69
 
70
  ambient: {
71
  name: "Ambient Chill",
72
+ description: "Ethereal space, long reverb tails, meditation",
73
+ command: `-af "asetrate=44100*0.94,aresample=44100,reverb=roomsize=0.98:time=10:wetlevel=0.6:drylevel=0.4,aecho=0.6:0.75:180:0.35,aecho=0.5:0.65:320:0.25,aecho=0.4:0.55:500:0.15,chorus=0.65:0.9:48:0.45:0.28:4,aphaser=in_gain=0.4:out_gain=0.7:delay=4:decay=0.5:speed=0.3,equalizer=f=1500:t=q:width=3:g=-3,equalizer=f=6000:t=q:width=4:g=-6,acompressor=threshold=-18dB:ratio=2:attack=20:release=250:makeup=1.5,highpass=f=50,lowpass=f=8000,volume=1.0" -ar 44100 -b:a 192k`
74
  },
75
 
76
  tiktok_lofi: {
77
  name: "TikTok LoFi",
78
+ description: "Viral TikTok style, punchy bass, modern lofi",
79
+ command: `-af "asetrate=44100*0.86,aresample=44100,bass=g=9:f=90:width_type=h:width=100,treble=g=-7:f=7500,equalizer=f=180:t=q:width=1.8:g=-2.5,equalizer=f=750:t=q:width=2.5:g=3,equalizer=f=2800:t=q:width=3:g=-3,acompressor=threshold=-18dB:ratio=5:attack=4:release=90:makeup=5,vibrato=f=0.28:d=0.65,aphaser=in_gain=0.65:out_gain=0.85:delay=2.2:decay=0.55:speed=0.5,chorus=0.55:0.85:45:0.35:0.22:2,highpass=f=65,lowpass=f=4200,volume=1.35" -ar 44100 -b:a 192k`
80
  },
81
 
82
  chill_lofi: {
83
  name: "Chill LoFi",
84
+ description: "Study beats, relaxing, smooth jazzy feel",
85
+ command: `-af "asetrate=44100*0.92,aresample=44100,bass=g=6:f=88:width_type=h:width=90,treble=g=-5:f=7000,equalizer=f=250:t=q:width=2:g=-2,equalizer=f=1000:t=q:width=2.5:g=1.5,equalizer=f=3500:t=q:width=3:g=-3,acompressor=threshold=-19dB:ratio=3.5:attack=8:release=130:makeup=3,vibrato=f=0.18:d=0.5,chorus=0.45:0.85:48:0.3:0.2:2,reverb=roomsize=0.6:time=4:wetlevel=0.3:drylevel=0.7,highpass=f=70,lowpass=f=4500,volume=1.2" -ar 44100 -b:a 192k`
86
  }
87
  };
88
 
 
90
  app.get('/', (req, res) => {
91
  res.json({
92
  status: 'online',
93
+ message: '🎡 LoFi Remix API v2.1 - Distinct Character',
94
+ version: '2.1',
95
+ performance: 'Optimized with unique character per effect',
96
  total_effects: Object.keys(EFFECTS).length,
97
  available_effects: Object.keys(EFFECTS).map(key => ({
98
  id: key,
99
+ name: EFFECTS[key].name,
100
+ description: EFFECTS[key].description
101
  })),
102
  endpoints: {
103
  health: 'GET /',
 
114
  total: Object.keys(EFFECTS).length,
115
  effects: Object.keys(EFFECTS).map(key => ({
116
  id: key,
117
+ name: EFFECTS[key].name,
118
+ description: EFFECTS[key].description
119
  }))
120
  });
121
  });
 
146
  const outputPath = path.join(outputsDir, outputFilename);
147
 
148
  console.log(`🎡 Processing: ${EFFECTS[effectType].name}`);
149
+ console.log(`πŸ“ ${EFFECTS[effectType].description}`);
150
 
151
  const effectCommand = EFFECTS[effectType].command;
 
 
152
  const ffmpegCommand = `ffmpeg -i "${inputPath}" -threads 0 ${effectCommand} -y "${outputPath}"`;
153
 
154
  console.log(`βš™οΈ Starting FFmpeg...`);
155
 
156
  const startTime = Date.now();
157
  await execPromise(ffmpegCommand, {
158
+ maxBuffer: 50 * 1024 * 1024
159
  });
160
  const processingTime = ((Date.now() - startTime) / 1000).toFixed(2);
161
 
 
173
  filename: outputFilename,
174
  effect: {
175
  id: effectType,
176
+ name: EFFECTS[effectType].name,
177
+ description: EFFECTS[effectType].description
178
  },
179
  output: {
180
  size_kb: fileSizeKB
 
225
 
226
  // πŸš€ Start Server
227
  app.listen(PORT, '0.0.0.0', () => {
228
+ console.log('═══════════════════════════════════════════════');
229
+ console.log('πŸš€ LoFi Remix API v2.1 - DISTINCT CHARACTER');
230
+ console.log('═══════════════════════════════════════════════');
231
  console.log(`πŸ“ Server: http://0.0.0.0:${PORT}`);
232
+ console.log(`⚑ Performance: Fast + Unique per effect`);
233
+ console.log(`🎡 Effects: ${Object.keys(EFFECTS).length} distinct styles`);
234
+ console.log('═══════════════════════════════════════════════');
235
  });