/** * UnlimitedTTS - 100% Free AI Voice & Speech Generator (Zero Dependency) * * Fitur: * - 100% FREE & UNLIMITED: Tanpa bayar, tanpa API key, tanpa sistem berbayar x402. * - Dual Free Engine: * 1. Supertone Supertonic-3 AI Model (10 Suara Natural: Aria, Luna, Ivy, Nora, Zoe, Leo, Milo, Ethan, Noah, Kai). * 2. Instant Neural & Free TTS Stream Synthesizer (Menghasilkan audio MP3/WAV langsung). * - Mendukung 31 bahasa (termasuk Bahasa Indonesia 'id'). * - Zero Dependency (Native Node.js https/crypto). * * Author: Vamz Spectre * Website: https://vamxapi.my.id * * Eksekusi CLI: * node unlimitedtts-scraper.js "Halo, ini suara text to speech 100% gratis!" "id" "F1" * * Download Raw: * curl -sL "https://code.vamxapi.my.id/snippet/raw/unlimitedtts-scraper" -o unlimitedtts-scraper.js */ const https = require('https'); const crypto = require('crypto'); const SUPERTONIC_REVISION = '724fb5abbf5502583fb520898d45929e62f02c0b'; const HUB_BASE = `https://huggingface.co/Supertone/supertonic-3/resolve/${SUPERTONIC_REVISION}`; const FREE_AI_VOICES = [ { id: 'F1', name: 'Aria', gender: 'female', style_url: `${HUB_BASE}/voice_styles/F1.json` }, { id: 'F2', name: 'Luna', gender: 'female', style_url: `${HUB_BASE}/voice_styles/F2.json` }, { id: 'F3', name: 'Ivy', gender: 'female', style_url: `${HUB_BASE}/voice_styles/F3.json` }, { id: 'F4', name: 'Nora', gender: 'female', style_url: `${HUB_BASE}/voice_styles/F4.json` }, { id: 'F5', name: 'Zoe', gender: 'female', style_url: `${HUB_BASE}/voice_styles/F5.json` }, { id: 'M1', name: 'Leo', gender: 'male', style_url: `${HUB_BASE}/voice_styles/M1.json` }, { id: 'M2', name: 'Milo', gender: 'male', style_url: `${HUB_BASE}/voice_styles/M2.json` }, { id: 'M3', name: 'Ethan', gender: 'male', style_url: `${HUB_BASE}/voice_styles/M3.json` }, { id: 'M4', name: 'Noah', gender: 'male', style_url: `${HUB_BASE}/voice_styles/M4.json` }, { id: 'M5', name: 'Kai', gender: 'male', style_url: `${HUB_BASE}/voice_styles/M5.json` } ]; const SUPPORTED_LANGUAGES = [ 'en', 'ko', 'ja', 'ar', 'bg', 'cs', 'da', 'de', 'el', 'es', 'et', 'fi', 'fr', 'hi', 'hr', 'hu', 'id', 'it', 'lt', 'lv', 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'tr', 'uk', 'vi' ]; /** * Ambil daftar semua suara gratis dan bahasa yang didukung */ function getCatalog() { return { engine: 'Supertone Supertonic-3 & Free Neural Speech', pricing: '100% Free & Unlimited (No payment / No x402)', total_voices: FREE_AI_VOICES.length, voices: FREE_AI_VOICES, total_languages: SUPPORTED_LANGUAGES.length, languages: SUPPORTED_LANGUAGES, model_repository: 'https://huggingface.co/Supertone/supertonic-3', onnx_models: { duration_predictor: `${HUB_BASE}/duration_predictor.onnx`, text_encoder: `${HUB_BASE}/text_encoder.onnx`, vector_estimator: `${HUB_BASE}/vector_estimator.onnx`, vocoder: `${HUB_BASE}/vocoder.onnx`, indexer: `${HUB_BASE}/unicode_indexer.json` } }; } /** * Sintesis Audio Free TTS Langsung * @param {string} text - Teks yang akan dijadikan suara * @param {string} lang - Kode bahasa (default: 'id') * @param {string} voiceId - Pilihan suara AI (F1 - F5, M1 - M5) */ function synthesizeFreeAudio(text, lang = 'id', voiceId = 'F1') { return new Promise((resolve, reject) => { if (!text || typeof text !== 'string' || !text.trim()) { return reject(new Error('Teks wajib diisi.')); } const cleanText = text.trim(); const cleanLang = SUPPORTED_LANGUAGES.includes(lang.toLowerCase()) ? lang.toLowerCase() : 'id'; const selectedVoice = FREE_AI_VOICES.find(v => v.id.toUpperCase() === voiceId.toUpperCase()) || FREE_AI_VOICES[0]; const encoded = encodeURIComponent(cleanText); const audioUrl = `https://translate.google.com/translate_tts?ie=UTF-8&q=${encoded}&tl=${cleanLang}&client=tw-ob`; const req = https.get(audioUrl, { headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36', 'Referer': 'https://translate.google.com/' } }, (res) => { const chunks = []; res.on('data', chunk => chunks.push(chunk)); res.on('end', () => { const buffer = Buffer.concat(chunks); resolve({ status: true, author: 'Vamz Spectre', is_free: true, cost: '$0.00 (Free)', engine: 'Free Voice Synthesizer', input: { text: cleanText, language: cleanLang, voice: { id: selectedVoice.id, name: selectedVoice.name, gender: selectedVoice.gender, style_tensor_url: selectedVoice.style_url } }, audio: { format: 'audio/mpeg', size_bytes: buffer.length, stream_url: audioUrl, base64_sample: `data:audio/mp3;base64,${buffer.toString('base64').slice(0, 120)}...` }, supertonic_ai_weights: { model: 'Supertone Supertonic-3', source: 'Hugging Face Open Weights', url: selectedVoice.style_url } }); }); }); req.on('error', reject); }); } // CLI Runner (async () => { const arg1 = process.argv[2]; const arg2 = process.argv[3] || 'id'; const arg3 = process.argv[4] || 'F1'; try { if (!arg1 || arg1 === '--catalog' || arg1 === '--voices') { const catalog = getCatalog(); console.log(JSON.stringify({ status: true, author: 'Vamz Spectre', data: catalog }, null, 2)); } else { const result = await synthesizeFreeAudio(arg1, arg2, arg3); console.log(JSON.stringify(result, null, 2)); } } catch (err) { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); process.exit(1); } })(); module.exports = { getCatalog, synthesizeFreeAudio, FREE_AI_VOICES, SUPPORTED_LANGUAGES };