Consistencia visual dos quadrinhos (estilo fofo 2 a 6 anos), correcao de narracao em video e 22 trilhas com preview
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const audioDir = path.join(__dirname, '..', 'public', 'assets', 'audio');
|
||||
if (!fs.existsSync(audioDir)) {
|
||||
fs.mkdirSync(audioDir, { recursive: true });
|
||||
}
|
||||
|
||||
// 22 Estilos Musicais Infantis Detalhados
|
||||
const tracks = [
|
||||
{ id: 'alegre', name: '🎸 Alegre e Brincalhona' },
|
||||
{ id: 'aventura', name: '🎮 Aventura na Floresta' },
|
||||
{ id: 'calma', name: '🌙 Calma e Relaxante' },
|
||||
{ id: 'magica', name: '✨ Terra da Fantasia & Magia', freq1: 523.25, freq2: 659.25, freq3: 783.99, type: 'magic' },
|
||||
{ id: 'circo', name: '🎪 Circo Encantado & Palhacinhos', freq1: 440, freq2: 554.37, freq3: 659.25, type: 'circus' },
|
||||
{ id: 'brinquedos', name: '🧸 Fábrica de Brinquedos', freq1: 392, freq2: 493.88, freq3: 587.33, type: 'toy' },
|
||||
{ id: 'jardim', name: '🌸 Jardim das Borboletas', freq1: 349.23, freq2: 440, freq3: 523.25, type: 'gentle' },
|
||||
{ id: 'animais', name: '🐾 Fazendinha dos Bichinhos', freq1: 293.66, freq2: 369.99, freq3: 440, type: 'playful' },
|
||||
{ id: 'ninar', name: '⭐ Estrelinha Brilhante (Ninar)', freq1: 261.63, freq2: 329.63, freq3: 392, type: 'lullaby' },
|
||||
{ id: 'passeio', name: '🚲 Passeio no Parque', freq1: 329.63, freq2: 415.30, freq3: 493.88, type: 'upbeat' },
|
||||
{ id: 'festa', name: '🎈 Dia de Festa & Balões', freq1: 392, freq2: 493.88, freq3: 587.33, type: 'party' },
|
||||
{ id: 'curiosa', name: '🔍 Pequenos Detetives', freq1: 220, freq2: 277.18, freq3: 329.63, type: 'curious' },
|
||||
{ id: 'amizade', name: '🤝 Abraço de Amigo & Carinho', freq1: 261.63, freq2: 329.63, freq3: 392, type: 'warm' },
|
||||
{ id: 'castelo', name: '🏰 Castelo dos Contos de Fadas', freq1: 440, freq2: 523.25, freq3: 659.25, type: 'royal' },
|
||||
{ id: 'mar', name: '🐬 Ondinhas do Mar & Golfinhos', freq1: 349.23, freq2: 440, freq3: 523.25, type: 'ocean' },
|
||||
{ id: 'espaco', name: '🚀 Viagem ao Espaço Sideral', freq1: 293.66, freq2: 349.23, freq3: 440, type: 'space' },
|
||||
{ id: 'chuva', name: '🌧️ Gotinhas de Chuva Dançantes', freq1: 523.25, freq2: 659.25, freq3: 783.99, type: 'rain' },
|
||||
{ id: 'pipoca', name: '🍿 Pula Pula Pipoquinha', freq1: 440, freq2: 554.37, freq3: 659.25, type: 'bouncy' },
|
||||
{ id: 'herois', name: '🦸 Mini Super-Heróis', freq1: 329.63, freq2: 392, freq3: 493.88, type: 'heroic' },
|
||||
{ id: 'carrossel', name: '🎠 Carrossel Encantado', freq1: 392, freq2: 493.88, freq3: 587.33, type: 'waltz' },
|
||||
{ id: 'natureza', name: '🍃 Sons Doces da Natureza', freq1: 349.23, freq2: 440, freq3: 523.25, type: 'nature' },
|
||||
{ id: 'bebes', name: '🍼 Melodia Suave do Berço', freq1: 261.63, freq2: 329.63, freq3: 392, type: 'baby' }
|
||||
];
|
||||
|
||||
console.log('Verificando trilhas sonoras...');
|
||||
|
||||
for (const t of tracks) {
|
||||
const filePath = path.join(audioDir, `${t.id}.mp3`);
|
||||
if (!fs.existsSync(filePath) || fs.statSync(filePath).size < 1000) {
|
||||
console.log(`Gerando trilha temática sintetizada: ${t.name} (${t.id}.mp3)...`);
|
||||
try {
|
||||
const f1 = t.freq1 || 440;
|
||||
const f2 = t.freq2 || 554.37;
|
||||
const f3 = t.freq3 || 659.25;
|
||||
// Sintetizar uma harmonia suave de 45 segundos usando ondas senoidais filtradas com vibrato e decay suave (estilo caixinha de música / synth pad infantil)
|
||||
const cmd = `ffmpeg -y -f lavfi -i "sine=frequency=${f1}:duration=45[a1];sine=frequency=${f2}:duration=45[a2];sine=frequency=${f3}:duration=45[a3];sine=frequency=${f1*2}:duration=45[a4];[a1][a2][a3][a4]amix=inputs=4:weights=0.35 0.25 0.25 0.15,lowpass=f=2200,tremolo=f=3:d=0.2,chorus=0.7:0.9:55:0.4:0.25:2,volume=0.4" -c:a libmp3lame -b:a 128k "${filePath}"`;
|
||||
execSync(cmd, { stdio: 'ignore' });
|
||||
console.log(`✅ Trilha criada: ${t.id}.mp3`);
|
||||
} catch (err) {
|
||||
console.warn(`Aviso ao sintetizar ${t.id}:`, err.message);
|
||||
// Se falhar a síntese, copia alegre.mp3 como fallback
|
||||
const alegrePath = path.join(audioDir, 'alegre.mp3');
|
||||
if (fs.existsSync(alegrePath)) {
|
||||
fs.copyFileSync(alegrePath, filePath);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(`Trilha existente: ${t.id}.mp3 (${(fs.statSync(filePath).size / (1024*1024)).toFixed(2)} MB)`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Trilhas sonoras prontas com sucesso!');
|
||||
Reference in New Issue
Block a user