# Песня в подарок — на день рождения, юбилей, свадьбу

Напишите, для кого песня и по какому поводу, — нейросеть сочинит слова и музыку и споёт. Можно со своими стихами.

Конструктор песни-подарка за минуту: Заполните детали — описание соберётся само

0/500

Жанр:

**Пробный фрагмент бесплатно** · полный трек 47 ₽ (25 кредитов) · Максимум 65 ₽ (35 кредитов)

В рублях Без VPN Оплата СБП Кредиты не сгорают Работает из России

Напишите, для кого песня и по какому поводу, — нейросеть сочинит слова и музыку и споёт. Можно со своими стихами.

Это одна из возможностей инструмента «Создать песню или музыку». \[Все возможности →\](https://usetoolz.ru/ai/music-generator)

## Примеры — нажмите, чтобы попробовать

\[ Галерея \](https://usetoolz.ru/gallery)

Песня маме Напиши тёплую поп-песню маме на день рождения

Лоу-фай для учёбы Напиши спокойный лоу-фай трек для учёбы, без слов

Дрифт-фонк Напиши агрессивный дрифт-фонк без слов: тяжёлый бас 808, коубелл, 140 ударов в минуту, мрачная ночная атмосфера

Джингл для кофейни Напиши короткий весёлый джингл для кофейни «Зерно», боссанова

Музыка для трейлера Напиши эпичную оркестровую музыку для трейлера: струнные, хор, барабаны

Песня о дружбе Напиши тёплую песню другу, с которым мы поссорились: о дружбе и надежде на встречу, гитара и фортепиано

Выберите повод, имена и настроение во вкладке «По описанию» - чем больше личных деталей, тем душевнее получится песня.

Во вкладке «Свой текст» можно вставить собственные стихи или нажать «Придумать текст с ИИ», а также выбрать мужской или женский голос.

Во вкладке «Из аудио» доступны кавер в новом жанре, продолжение мелодии и сведение двух песен в один мэшап.

Режим «Базовый» даёт послушать пробный фрагмент до оплаты, а «Максимум» создаёт студийную аранжировку с лучшим вокалом.

За каждый запуск ИИ создаёт сразу 2 разных варианта песни в MP3 - выберите и скачайте понравившийся.

`; } if (!trimmed) { return '

'; } return `

${escape(line)}

`; }).join(''); }, async loadPersonas() { try { const res = await fetch('/ai/music-generator/personas', { headers: { 'Accept': 'application/json' } }); if (res.ok) { this.personas = await res.json(); this.hasMyVoice = this.personas.length > 0; } } catch {} }, setVoice(choice) { this.voiceChoice = choice; if (choice === 'my') { this.vocalGender = ''; this.selectedPersonaId = this.hasMyVoice ? this.personas\[0\].persona_id : ''; } else { this.vocalGender = choice === 'auto' ? '' : choice; this.selectedPersonaId = ''; } }, // What «Сгенерировать» is charged in the selected mode (MusicGeneratorController): a sound and // a mashup have flat prices of their own; a song, a cover and an uploaded track's extension // (from-audio) cost the tier's price get costAction() { if (this.mode === 'sounds') return 'music-generator.sounds'; if (this.mode === 'audio' && this.audioSubMode === 'mashup') return 'music-generator.mashup'; return this.tier === 'pro' ? 'music-generator.pro' : 'music-generator.standard'; }, get currentCost() { return this.$store.prices.cost(this.costAction); }, get customMode() { return this.mode === 'custom'; }, get canGenerate() { if (this.processing) return false; if (this.mode === 'audio') { if (this.audioSubMode === 'mashup') { if (!this.mashupFile1 || !this.mashupFile2) return false; if (this.coverLyricsMode === 'change' && !this.isInstrumental) { return this.coverLyrics.trim().length >= 3; } return true; } if (!this.audioFile) return false; if (this.audioSubMode === 'cover' && this.coverLyricsMode === 'change' && !this.isInstrumental) { return this.coverLyrics.trim().length >= 3; } return true; } if (this.mode === 'sounds') return this.soundsPrompt.trim().length >= 3; if (this.mode === 'custom') { if (this.isInstrumental) { return this.style.trim().length >= 2 || this.title.trim().length >= 2 || this.lyrics.trim().length >= 3; } return this.lyrics.trim().length >= 3; } return this.description.trim().length >= 3; }, get style() { const chips = this.styleChips.filter(c => this._selectedGenres.includes(c.id)).map(c => c.id); return \[...chips, this.customGenre, this.styleText\].filter(Boolean).join(', ').slice(0, 1000); }, _selectedGenres: \[\], get genreCount() { return this._selectedGenres.length + (this.showCustomGenre ? 1 : 0); }, toggleCustomGenre() { if (this.showCustomGenre) { this.showCustomGenre = false; this.customGenre = ''; } else { if (this.genreCount >= 3) return; this.showCustomGenre = true; } }, toggleStyle(chipId) { const idx = this._selectedGenres.indexOf(chipId); if (idx >= 0) { this._selectedGenres.splice(idx, 1); } else { if (this.genreCount >= 3) return; this._selectedGenres.push(chipId); } }, _extractError(data, fallback) { if (!data) return fallback; if (data.error) return data.error; if (data.errors && typeof data.errors === 'object') { const first = Object.values(data.errors).flat()\[0\]; if (first) return first; } if (data.message) return data.message; return fallback; }, // Phase 1: Clip actions _clipActions: {}, clipActionLoading(clip, type) { if (!clip?.clipId) return false; return this._clipActions\[clip.clipId\]?.\[type\] === 'loading'; }, getClipActionResult(clip, type) { if (!clip?.clipId) return null; const state = this._clipActions\[clip.clipId\]?.\[type\]; // A result is a link (WAV) or a list (stems). Only lists counted before: a paid // WAV never showed its link and the button invited a second purchase if (state && state !== 'loading' && state !== 'idle') return state; return null; }, _showUpsell(data, fallbackCost, retryFn) { const storeBal = Number(this.$store?.credits?.balance ?? 0); if (storeBal > Number(this.creditsRemaining || 0)) this.creditsRemaining = storeBal; const cost = Number(data?.creditCost || fallbackCost || this.currentCost || 0); const have = Number(data?.creditsRemaining ?? this.creditsRemaining ?? 0); const reason = data?.reason || 'insufficient_credits'; this.$store.upsell.show('music-generator', { scenario: reason === 'daily_limit_reached' ? 'daily_limit' : reason, tierWanted: this.tier || 'standard', creditCost: cost, creditsHave: have, dailyCount: data?.dailyCount || 0, dailyLimit: data?.dailyLimit || 0, onPurchaseComplete: (fresh) => { if (typeof fresh === 'number') this.creditsRemaining = fresh; if (retryFn) retryFn(); }, }); }, syncGiftBuilder() { const parts = \[\]; if (this.giftOccasion) parts.push("\u041f\u0435\u0441\u043d\u044f \u0432 \u043f\u043e\u0434\u0430\u0440\u043e\u043a:" + ' ' + this.giftOccasion); if (this.giftDetails.trim()) parts.push("\u041f\u0440\u043e \u043a\u043e\u0433\u043e \u0438 \u0434\u0435\u0442\u0430\u043b\u0438:" + ' ' + this.giftDetails.trim()); if (this.giftVibe) parts.push("\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435:" + ' ' + this.giftVibe); if (parts.length > 0) { this.description = parts.join('. ').slice(0, 500); this.$nextTick(() => this.autoGrow(this.$refs.descArea)); } }, async _refreshMusicAfterUnlock(autoDownload = true) { if (!this.currentTaskId) { this.previewLocked = false; return; } try { const res = await fetch('/ai/music-generator/status/' + this.currentTaskId, { headers: { 'Accept': 'application/json' } }); if (res.ok) { const data = await res.json(); if (data && data.status === 'completed' && Array.isArray(data.results)) { this.results = data.results; this.previewLocked = !!data.previewLocked; this.clipDurations = {}; this.originalUserLyrics = data.originalLyrics || this.originalUserLyrics || ''; this._upsertHistoryFromPoll(data, this.currentTaskId); if (autoDownload && !this.previewLocked) { const dlClip = this.activeClip || this.results\[0\]; if (dlClip && dlClip.downloadUrl) { const a = document.createElement('a'); a.href = dlClip.downloadUrl; a.download = ''; a.rel = 'noopener'; document.body.appendChild(a); a.click(); a.remove(); } } } } } catch (e) {} }, unlockMusicPreview() { const stdCost = 25; const matchedHist = (this.history || \[\]).find(h => String(h.taskId) === String(this.currentTaskId)); const genId = this.currentGenerationId || (Number(matchedHist?.id) > 0 ? Number(matchedHist.id) : null); this.$store.upsell.show('music-generator', { scenario: 'unlock_hd', generationId: genId, creditCost: stdCost, creditsHave: this.creditsRemaining || 0, onPurchaseComplete: async (fresh) => { this.isLoggedIn = true; if (typeof fresh === 'number') this.creditsRemaining = fresh; await this._refreshMusicAfterUnlock(true); }, }); }, _preflightCredits(actionCost = null, retryFn = null) { if (this.creditsRemaining === undefined) return true; if (actionCost === null && !this.isPaid && this.creditCost === 0 && (this.mode === 'simple' || this.mode === 'custom') && this.tier === 'standard') { return true; } const storeBal = Number(this.$store?.credits?.balance ?? 0); if (storeBal > Number(this.creditsRemaining || 0)) this.creditsRemaining = storeBal; const cost = actionCost !== null ? Number(actionCost) : Number(this.currentCost || 0); if (cost <= 0 || this.creditsRemaining >= cost) return true; this._showUpsell({ reason: 'insufficient_credits', creditCost: cost, creditsRemaining: this.creditsRemaining }, cost, retryFn); return false; }, async doClipAction(clip, type) { if (!clip?.clipId || this.clipActionLoading(clip, type)) return; const clipCostActions = { wav: 'music-generator.wav', lyrics_timed: 'music-generator.lyrics_timed', cover_image: 'music-generator.cover_image', video: 'music-generator.video', vocal_separate: 'music-generator.vocal_separate', vocal_split: 'music-generator.vocal_split', }; const actionCost = this.$store.prices.cost(clipCostActions\[type\] || 'music-generator.standard'); if (!this._preflightCredits(actionCost, () => this.doClipAction(clip, type))) return; if (!this._clipActions\[clip.clipId\]) this._clipActions\[clip.clipId\] = {}; this._clipActions\[clip.clipId\]\[type\] = 'loading'; const endpoints = { wav: '/ai/music-generator/wav', lyrics_timed: '/ai/music-generator/timestamped-lyrics', cover_image: '/ai/music-generator/cover-image', video: '/ai/music-generator/video', vocal_separate: '/ai/music-generator/separate-vocals', vocal_split: '/ai/music-generator/separate-vocals' }; try { const res = await fetch(endpoints\[type\], { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': crypto.randomUUID() }, body: JSON.stringify({ clipId: clip.clipId, ...(type === 'vocal_split' ? { type: 'split_stem' } : {}) }), }); const data = await res.json(); if (!res.ok) { if ((res.status === 429 && data.reason) || res.status === 401) { this._showUpsell(data, actionCost, () => this.doClipAction(clip, type)); } else { this.error = this._extractError(data, "\u041e\u0448\u0438\u0431\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438"); } this._clipActions\[clip.clipId\]\[type\] = 'idle'; return; } if (data.creditsRemaining !== undefined) { this.creditsRemaining = data.creditsRemaining; this.$store?.credits?.update(data.creditsRemaining); } await this._pollActionStatus(clip, type, data.taskId); } catch (e) { this.error = e.message; this._clipActions\[clip.clipId\]\[type\] = 'idle'; } }, async _pollActionStatus(clip, type, taskId) { // Столько же, сколько ждёт сервер (бюджет CompleteMusicGeneration — тот же цикл // 60 × 10 с у Kie): 5 минут сдавались на полпути и звали заплатить второй раз. // Результат действия показывается только здесь, поэтому после бюджета не сдаёмся, // а реже опрашиваем ещё час — кнопка остаётся занятой, повторного списания нет const budgetPolls = Math.ceil(930 / 5); const latePolls = 240; const slowNotice = "\u042d\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u043e\u043b\u044c\u0448\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c \u2014 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u043a\u0440\u0435\u0434\u0438\u0442\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e."; for (let i = 0; i < budgetPolls + latePolls; i++) { if (i === budgetPolls) this.notice = slowNotice; await new Promise(r => setTimeout(r, i < budgetPolls ? 5000 : 15000)); try { const res = await window.fetchWithTimeout(`/ai/music-generator/action-status/${taskId}`, { headers: { 'Accept': 'application/json' } }); const data = await res.json(); if (data.status === 'completed' || data.status === 'failed') { if (this.notice === slowNotice) this.notice = ''; } if (data.status === 'completed') { const result = data.downloadUrl || data.videoUrl || data.images || data.lyrics || data.stems || true; this._clipActions\[clip.clipId\]\[type\] = result; return; } if (data.status === 'failed') { if (typeof data.creditsRemaining === 'number') { this.creditsRemaining = data.creditsRemaining; this.$store?.credits?.update?.(data.creditsRemaining); } this.errorSuggestPro = !!data.suggestPro; this.error = data.error || "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435"; this._clipActions\[clip.clipId\]\[type\] = 'idle'; return; } } catch {} } this._clipActions\[clip.clipId\]\[type\] = 'idle'; this.notice = "\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f, \u043a\u0440\u0435\u0434\u0438\u0442\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438."; }, async doBoostStyle() { if (!this.styleText || this.styleText.length < 3 || this.boostingStyle) return; const boostCost = this.$store.prices.cost('music-generator.boost_style'); if (!this._preflightCredits(boostCost, () => this.doBoostStyle())) return; this.boostingStyle = true; try { const res = await fetch('/ai/music-generator/boost-style', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content }, body: JSON.stringify({ prompt: this.styleText }), }); const data = await res.json(); if (res.ok && data.result) { this.styleText = data.result; if (data.creditsRemaining !== undefined) { this.creditsRemaining = data.creditsRemaining; this.$store?.credits?.update(data.creditsRemaining); } } else if ((res.status === 429 && data.reason) || res.status === 401) { this._showUpsell(data, boostCost, () => this.doBoostStyle()); } else { this.error = this._extractError(data, "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0442\u0438\u043b\u044c"); } } catch (e) { this.error = e.message; } finally { this.boostingStyle = false; } }, get coverGenreCount() { return this._coverGenres.length + (this.showCoverCustom ? 1 : 0); }, get coverStyle() { return \[...this._coverGenres, this.coverCustomGenre\].filter(Boolean).join(', ').slice(0, 1000); }, toggleCoverGenre(id) { const idx = this._coverGenres.indexOf(id); if (idx >= 0) { this._coverGenres.splice(idx, 1); } else { if (this.coverGenreCount >= 3) return; this._coverGenres.push(id); } }, toggleCoverCustom() { if (this.showCoverCustom) { this.showCoverCustom = false; this.coverCustomGenre = ''; } else { if (this.coverGenreCount >= 3) return; this.showCoverCustom = true; } }, insertCoverSection(name) { const num = (name === 'Verse' || name === 'Куплет') ? ` ${(this.coverLyrics.match(/\\[(Verse|Куплет)/gi) || \[\]).length + 1}` : ''; const insert = `\[${name}${num}\]\n`; this.coverLyrics = this.coverLyrics ? this.coverLyrics.trimEnd() + '\n\n' + insert : insert; this.$nextTick(() => { this.autoGrow(this.$refs.coverLyricsArea); this.$refs.coverLyricsArea?.focus(); }); }, insertSection(name) { const num = (name === 'Verse' || name === 'Куплет') ? ` ${(this.lyrics.match(/\\[(Verse|Куплет)/gi) || \[\]).length + 1}` : ''; const insert = `\[${name}${num}\]\n`; const area = this.$refs.lyricsArea; if (area && typeof area.selectionStart === 'number' && this.lyrics.length > 0) { const start = area.selectionStart; const end = area.selectionEnd; const before = this.lyrics.slice(0, start); const after = this.lyrics.slice(end); const prefix = before.length > 0 && !before.endsWith('\n\n') ? (before.endsWith('\n') ? '\n' : '\n\n') : ''; this.lyrics = before + prefix + insert + after; const newPos = (before + prefix + insert).length; this.$nextTick(() => { this.autoGrow(area); area.focus(); area.setSelectionRange(newPos, newPos); }); } else { this.lyrics = this.lyrics ? this.lyrics.trimEnd() + '\n\n' + insert : insert; this.$nextTick(() => { this.autoGrow(area); area?.focus(); }); } }, handleAudioFile(e) { const file = e.target.files?.\[0\]; if (!file) return; if (file.size > 20 * 1024 * 1024) { this.error = "\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u2014 20 \u041c\u0411"; return; } this.error = ''; this.audioFile = file; this.audioFileName = file.name; }, handleAudioDrop(e) { const file = e.dataTransfer?.files?.\[0\]; if (!file) return; if (file.size > 20 * 1024 * 1024) { this.error = "\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u2014 20 \u041c\u0411"; return; } this.error = ''; this.audioFile = file; this.audioFileName = file.name; }, async doGenerate() { if (this.processing || !this.canGenerate) return; if (!this._preflightCredits(null, () => this.doGenerate())) return; const hasProTier = !(this.mode === 'sounds' || (this.mode === 'audio' && this.audioSubMode === 'mashup')); const usedTier = hasProTier ? this.tier : null; this.processing = true; this.error = ''; this.errorSuggestPro = false; this.notice = ''; this.results = \[\]; this.selectedResultIdx = 0; this.clipDurations = {}; this.resultTier = null; this.lyricsAdapted = false; this.lyricsAdaptedKind = null; this.originalUserLyrics = ''; this._startProgress(); try { let res; const idempKey = this._idempotencyKey; this._idempotencyKey = crypto.randomUUID(); if (this.mode === 'sounds') { const body = { prompt: this.soundsPrompt, soundLoop: this.soundLoop }; if (this.soundTempo) body.soundTempo = this.soundTempo; if (this.soundKey) body.soundKey = this.soundKey; body.tier = this.tier; res = await fetch('/ai/music-generator/sounds', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': idempKey }, body: JSON.stringify(body), }); } else if (this.mode === 'audio' && this.audioSubMode === 'mashup' && this.mashupFile1 && this.mashupFile2) { const formData = new FormData(); formData.append('audio1', this.mashupFile1); formData.append('audio2', this.mashupFile2); formData.append('tier', 'pro'); formData.append('instrumental', this.isInstrumental ? '1' : '0'); formData.append('lyricsMode', this.coverLyricsMode); if (this.coverStyle) formData.append('style', this.coverStyle); if (this.title) formData.append('title', this.title); if (!this.isInstrumental && this.coverLyricsMode === 'change' && this.coverLyrics) { formData.append('lyrics', this.coverLyrics); formData.append('autoAdaptCopyright', this.autoAdaptCopyright ? '1' : '0'); } if (!this.isInstrumental && this.vocalGender) { formData.append('vocalGender', this.vocalGender); } if (!this.isInstrumental && this.audioWeight !== null) { formData.append('audioWeight', this.audioWeight); } if (this.styleWeight !== null) { formData.append('styleWeight', this.styleWeight); } if (this.weirdnessConstraint !== null) { formData.append('weirdnessConstraint', this.weirdnessConstraint); } res = await fetch('/ai/music-generator/mashup', { method: 'POST', headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': idempKey, }, body: formData, }); } else if (this.mode === 'audio' && this.audioSubMode === 'extend' && this.audioFile) { // Upload & Extend: upload file first via from-audio, then extend const formData = new FormData(); formData.append('audio', this.audioFile); formData.append('tier', usedTier || this.tier); formData.append('action', 'extend'); formData.append('instrumental', this.isInstrumental ? '1' : '0'); if (!this.isInstrumental && this.extendUploadPrompt) { formData.append('prompt', this.extendUploadPrompt); formData.append('autoAdaptCopyright', this.autoAdaptCopyright ? '1' : '0'); } if (this.coverStyle) formData.append('style', this.coverStyle); if (!this.isInstrumental && this.vocalGender) formData.append('vocalGender', this.vocalGender); res = await fetch('/ai/music-generator/from-audio', { method: 'POST', headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': idempKey, }, body: formData, }); } else if (this.mode === 'audio' && this.audioFile) { // Cover mode const formData = new FormData(); formData.append('audio', this.audioFile); formData.append('tier', usedTier || this.tier); formData.append('action', 'cover'); formData.append('instrumental', this.isInstrumental ? '1' : '0'); if (this.coverStyle) formData.append('style', this.coverStyle); formData.append('lyricsMode', this.coverLyricsMode); if (!this.isInstrumental && this.coverLyricsMode === 'change' && this.coverLyrics) { formData.append('lyrics', this.coverLyrics); formData.append('autoAdaptCopyright', this.autoAdaptCopyright ? '1' : '0'); } if (!this.isInstrumental && this.vocalGender) { formData.append('vocalGender', this.vocalGender); } if (!this.isInstrumental && this.audioWeight !== null) { formData.append('audioWeight', this.audioWeight); } if (this.styleWeight !== null) { formData.append('styleWeight', this.styleWeight); } if (this.weirdnessConstraint !== null) { formData.append('weirdnessConstraint', this.weirdnessConstraint); } if (this.negativeTags) { formData.append('negativeTags', this.negativeTags); } res = await fetch('/ai/music-generator/from-audio', { method: 'POST', headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': idempKey, }, body: formData, }); } else { let finalPrompt = this.mode === 'custom' ? this.lyrics : this.description; if (!this.customMode) { const simpleGenres = \[ ...this.styleChips.filter(c => this._selectedGenres.includes(c.id)).map(c => c.label), this.customGenre, \].filter(Boolean).join(', '); const vocalHint = !this.isInstrumental && this.vocalGender ? (this.vocalGender === 'm' ? "\u043c\u0443\u0436\u0441\u043a\u043e\u0439 \u0432\u043e\u043a\u0430\u043b" : "\u0436\u0435\u043d\u0441\u043a\u0438\u0439 \u0432\u043e\u043a\u0430\u043b") : ''; const suffixParts = \[\]; if (simpleGenres) suffixParts.push("\u0416\u0430\u043d\u0440:" + ' ' + simpleGenres); if (vocalHint) suffixParts.push("\u0412\u043e\u043a\u0430\u043b:" + ' ' + vocalHint); if (suffixParts.length > 0) { finalPrompt = (finalPrompt.trim() + '. ' + suffixParts.join('. ')).slice(0, 500); } } const body = { prompt: finalPrompt, tier: usedTier || this.tier, instrumental: this.isInstrumental, customMode: this.customMode, }; // Voice — always send regardless of mode if (this.vocalGender) body.vocalGender = this.vocalGender; if (this.selectedPersonaId) body.personaId = this.selectedPersonaId; if (this.customMode) { body.style = this.style; body.title = this.title; if (!this.isInstrumental) { body.autoAdaptCopyright = this.autoAdaptCopyright; } if (this.negativeTags) body.negativeTags = this.negativeTags; if (this.styleWeight !== null) body.styleWeight = this.styleWeight; if (this.weirdnessConstraint !== null) body.weirdnessConstraint = this.weirdnessConstraint; if (this.audioWeight !== null) body.audioWeight = this.audioWeight; } res = await fetch('/ai/music-generator/generate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': idempKey, }, body: JSON.stringify(body), }); } let data; try { data = await res.json(); } catch { data = {}; } if (!res.ok) { if ((res.status === 429 && data.reason) || res.status === 401) { this._showUpsell(data, this.currentCost, () => this.doGenerate()); this.processing = false; this._stopProgress(); return; } this.errorSuggestPro = !!data.suggestPro; throw new Error(this._extractError(data, "\u0421\u0435\u0440\u0432\u0438\u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u043c\u0438\u043d\u0443\u0442\u0443.")); } _vkGoal('generation'); if (data.demoPreview && !this.isPaid && this.creditCost === 0) { this.creditCost = 25; } if (data.creditsRemaining !== undefined) { this.creditsRemaining = data.creditsRemaining; this.$store?.credits?.update(data.creditsRemaining); } this.resultTier = usedTier; this.currentTaskId = data.taskId || data.generationId || null; if (this.currentTaskId) this._saveSessionTask(this.currentTaskId); await this._pollStatus(data.taskId); } catch (e) { this.error = e.message; this.processing = false; this._stopProgress(); } }, async doGenerateLyrics() { if (this.lyricsLoading) return; if (!this.lyricsTopicInput || this.lyricsTopicInput.length < 3) return; if (!this.isLoggedIn && !window.__utSignedIn) { if (this.$store?.authModal) { this.$store.authModal.show(); return; } } this.isLoggedIn = true; const lyricsPrompt = this.lyricsTopicInput; const selectedGenres = \[ ...this.styleChips.filter(c => this._selectedGenres.includes(c.id)).map(c => c.label), this.customGenre, \].filter(Boolean).join(', '); const payload = { prompt: lyricsPrompt }; if (selectedGenres) payload.genres = selectedGenres; if (!this.isInstrumental && this.vocalGender) payload.vocalGender = this.vocalGender; this.lyricsLoading = true; try { const res = await fetch('/ai/music-generator/lyrics', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, }, body: JSON.stringify(payload), }); const data = await res.json(); if (!res.ok) throw new Error(this._extractError(data, "\u041e\u0448\u0438\u0431\u043a\u0430")); this.lyrics = data.lyrics || ''; if (data.title && !this.title) this.title = data.title; if (data.style && !this.styleText.trim()) this.styleText = data.style; this.$nextTick(() => this.autoGrow(this.$refs.lyricsArea)); } catch (e) { this.error = e.message; } finally { this.lyricsLoading = false; } }, startExtend(clip) { if (!clip) return; this.extendMode = true; this.extendClip = clip; this.extendPrompt = ''; }, regenerate() { this._clearSessionTask(); this.results = \[\]; this.selectedResultIdx = 0; this.clipDurations = {}; this.previewLocked = false; this.currentTaskId = null; this.lyricsAdapted = false; this.lyricsAdaptedKind = null; this.extendMode = false; this._idempotencyKey = crypto.randomUUID(); }, openLyricsInEditor(useOriginal = false) { const cur = this.activeClip || this.results\[0\] || {}; const sungText = cur.lyrics || ''; const textToEdit = (useOriginal && this.originalUserLyrics) ? this.originalUserLyrics : (sungText || this.originalUserLyrics || ''); const trackTitle = cur.title || ''; const trackTags = cur.tags || ''; const hasLiveAudio = this.mode === 'audio' && ( (this.audioSubMode === 'mashup' && this.mashupFile1 && this.mashupFile2) || (this.audioSubMode !== 'mashup' && this.audioFile) ); this.isInstrumental = false; if (hasLiveAudio) { if (this.audioSubMode === 'extend') { this.extendUploadPrompt = textToEdit.slice(0, 500); } else { this.coverLyricsMode = 'change'; this.coverLyrics = textToEdit; } } else { this.mode = 'custom'; this.lyrics = textToEdit; if (!this.title && trackTitle) this.title = trackTitle.slice(0, 100); if (!this.styleText && trackTags) this.styleText = trackTags.slice(0, 1000); } if (this.resultTier === 'pro' && this.tier !== 'pro') { this.tier = 'pro'; this.$dispatch('tier-changed', 'pro'); } this._clearSessionTask(); this.results = \[\]; this.selectedResultIdx = 0; this.clipDurations = {}; this.previewLocked = false; this.currentTaskId = null; this.lyricsAdapted = false; this.lyricsAdaptedKind = null; this.extendMode = false; this.extendClip = null; this.error = ''; this.notice = ''; this._idempotencyKey = crypto.randomUUID(); this.$nextTick(() => { const area = hasLiveAudio ? this.$refs.coverLyricsArea : this.$refs.lyricsArea; if (area) this.autoGrow(area); (area || document.querySelector('#music-form'))?.scrollIntoView({ behavior: 'smooth', block: 'center' }); area?.focus({ preventScroll: true }); }); }, async doExtend() { if (!this.extendClip || this.extendLoading) return; const extendCost = this.$store.prices.cost('music-generator.extend'); if (!this._preflightCredits(extendCost, () => this.doExtend())) return; this.extendLoading = true; this.error = ''; this.notice = ''; try { const idempKey = this._idempotencyKey; const res = await fetch('/ai/music-generator/extend', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta\[name="csrf-token"\]').content, 'X-Idempotency-Key': idempKey, }, body: JSON.stringify({ clipId: this.extendClip.clipId, prompt: this.extendPrompt, model: this.tier === 'pro' ? 'V6' : 'V6_MINI', autoAdaptCopyright: this.autoAdaptCopyright, }), }); this._idempotencyKey = crypto.randomUUID(); const data = await res.json(); if (!res.ok) { if ((res.status === 429 && data.reason) || res.status === 401) { this._showUpsell(data, extendCost, () => this.doExtend()); return; } throw new Error(this._extractError(data, "\u041e\u0448\u0438\u0431\u043a\u0430")); } if (data.creditsRemaining !== undefined) { this.creditsRemaining = data.creditsRemaining; this.$store?.credits?.update(data.creditsRemaining); } this.extendMode = false; this.results = \[\]; this.selectedResultIdx = 0; this.clipDurations = {}; this.previewLocked = false; this.currentTaskId = data.taskId || null; if (this.currentTaskId) this._saveSessionTask(this.currentTaskId); this.lyricsAdapted = false; this.lyricsAdaptedKind = null; this.processing = true; this._startProgress(); await this._pollStatus(data.taskId); } catch (e) { const msg = String(e?.message || ''); this.error = /^(Load failed|Failed to fetch|NetworkError)/i.test(msg) ? "\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0435\u0442\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437." : (msg || "\u041e\u0448\u0438\u0431\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438"); } finally { this.extendLoading = false; } }, async _pollStatus(taskId) { this.currentTaskId = taskId; if (taskId) this._saveSessionTask(taskId); // Столько же, сколько ждёт сервер (бюджет CompleteMusicGeneration): 6 минут // страницы сдавались раньше 10-минутного опроса Kie, а песня потом приходила const maxPolls = Math.ceil(930 / 3); const interval = 3000; for (let i = 0; i < maxPolls; i++) { await new Promise(r => setTimeout(r, interval)); let data; try { const res = await window.fetchWithTimeout(`/ai/music-generator/status/${taskId}`, { headers: { 'Accept': 'application/json' }, }); data = await res.json(); } catch (e) { // Любой сбой сети или ответа — моргнула связь, таймаут свёрнутого таба, // «Load failed» Safari, HTML-страница 502 — просто следующий полл. // Останавливает только настоящий вердикт сервера «failed» continue; } if (data.status === 'completed' && data.results) { this.results = \[...this.results, ...data.results\]; this.selectedResultIdx = 0; this.previewLocked = !!data.previewLocked; this.currentTaskId = data.taskId || taskId; this.currentGenerationId = Number(data.generationId) > 0 ? Number(data.generationId) : this.currentGenerationId; this._saveSessionTask(this.currentTaskId); this.lyricsAdapted = !!data.lyricsAdapted; this.lyricsAdaptedKind = data.lyricsAdaptedKind || null; this.originalUserLyrics = data.originalLyrics || ''; if (data.tier) this.resultTier = data.tier; this._upsertHistoryFromPoll(data, this.currentTaskId); this.processing = false; this._stopProgress(); this._scrollToResult(); window.dispatchEvent(new CustomEvent('generation-updated')); return; } if (data.status === 'failed') { this._clearSessionTask(); if (typeof data.creditsRemaining === 'number') { this.creditsRemaining = data.creditsRemaining; this.$store?.credits?.update?.(data.creditsRemaining); } this.errorSuggestPro = !!data.suggestPro; this.error = data.error || "\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0443"; this.processing = false; this._stopProgress(); return; } } // Сервер ещё не дал вердикта: песня придёт в «Мои работы» (или кредиты вернутся) — // «попробуйте ещё раз» здесь означало заплатить второй раз this.notice = "\u041f\u0435\u0441\u043d\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0434\u043e\u043b\u044c\u0448\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u2014 \u043e\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u00ab\u041c\u043e\u0438 \u0440\u0430\u0431\u043e\u0442\u044b\u00bb, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u043a\u0440\u0435\u0434\u0438\u0442\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e."; this.processing = false; this._stopProgress(); }, _startProgress() { this.progressPercent = 0; this.progressStatus = "\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c..."; const steps = \[ { at: 5, pct: 10, text: "\u0418\u0418 \u0441\u043e\u0447\u0438\u043d\u044f\u0435\u0442 \u043c\u0435\u043b\u043e\u0434\u0438\u044e..." }, { at: 15, pct: 25, text: "\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0430\u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u043a\u0443..." }, { at: 35, pct: 45, text: "\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u043e\u043a\u0430\u043b..." }, { at: 60, pct: 65, text: "\u0421\u0432\u043e\u0434\u0438\u043c \u0442\u0440\u0435\u043a..." }, { at: 90, pct: 80, text: "\u0424\u0438\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0438\u043a\u0441..." }, { at: 120, pct: 92, text: "\u041f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u043e..." }, \]; let elapsed = 0; this._progressTimer = setInterval(() => { elapsed++; for (const step of steps) { if (elapsed === step.at) { this.progressPercent = step.pct; this.progressStatus = step.text; } } }, 1000); }, _scrollToResult() { this.$nextTick(() => { const el = this.$refs.resultBlock; if (el) el.scrollIntoView({ behavior: 'smooth', block: 'center' }); }); }, _stopProgress() { if (this._progressTimer) { clearInterval(this._progressTimer); this._progressTimer = null; } this.progressPercent = 100; }, async loadFromHistory(detail) { if (!detail.genId) return; this.error = ''; this.notice = ''; this.processing = false; this.resultTier = detail.tier || null; this.selectedResultIdx = 0; this.clipDurations = {}; this.previewLocked = false; this.currentTaskId = detail.externalId || detail.genId; this.lyricsAdapted = false; this.lyricsAdaptedKind = null; this.originalUserLyrics = ''; try { const res = await window.fetchWithTimeout(`/ai/music-generator/status/${detail.externalId || detail.genId}`, { headers: { 'Accept': 'application/json' }, }); const data = await res.json(); if (data.status === 'completed' && data.results) { this.results = data.results; this.previewLocked = !!data.previewLocked; this.currentTaskId = data.taskId || detail.externalId || detail.genId; this._saveSessionTask(this.currentTaskId); this.lyricsAdapted = !!data.lyricsAdapted; this.lyricsAdaptedKind = data.lyricsAdaptedKind || null; this.originalUserLyrics = data.originalLyrics || ''; if (data.tier) this.resultTier = data.tier; if (data.prompt) this.description = data.prompt; } else if (detail.url) { this.results = \[{ clipId: 'history', title: detail.title || "\u0422\u0440\u0435\u043a", tags: '', lyrics: '', duration: 0, audioUrl: detail.url, downloadUrl: detail.url, imageUrl: detail.thumbnail || null, }\]; } } catch (e) { if (detail.url) { this.results = \[{ clipId: 'history', title: detail.title || "\u0422\u0440\u0435\u043a", tags: '', lyrics: '', duration: 0, audioUrl: detail.url, downloadUrl: detail.url, imageUrl: detail.thumbnail || null, }\]; } } }, resetForm() { this._clearSessionTask(); this.$nextTick(() => { document.querySelector('#music-form')?.scrollIntoView({ behavior: 'smooth', block: 'start' }); }); this.results = \[\]; this.selectedResultIdx = 0; this.clipDurations = {}; this.previewLocked = false; this.currentTaskId = null; this.lyricsAdapted = false; this.lyricsAdaptedKind = null; this.originalUserLyrics = ''; this.error = ''; this.notice = ''; this.extendMode = false; this.extendClip = null; this.extendPrompt = ''; this._idempotencyKey = crypto.randomUUID(); }, formatDuration(s) { if (!s) return '0:00'; const m = Math.floor(s / 60); const sec = Math.floor(s % 60); return m + ':' + (sec < 10 ? '0' : '') + sec; }, }; }

### Не хотите собирать всё вручную? Поручите задачу ИИ-чату

Сам придумает сценарий или слова песни, сгенерирует обложку, видео или превратит запись созвона в готовый документ.

\[ Песня + обложка релиза + пост \](https://usetoolz.ru?q=%D0%9D%D0%B0%D0%BF%D0%B8%D1%88%D0%B8%20%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%20%D0%BF%D0%B5%D1%81%D0%BD%D0%B8%2C%20%D1%81%D0%B3%D0%B5%D0%BD%D0%B5%D1%80%D0%B8%D1%80%D1%83%D0%B9%20%D1%82%D1%80%D0%B5%D0%BA%2C%20%D0%BD%D0%B0%D1%80%D0%B8%D1%81%D1%83%D0%B9%20%D1%81%D1%82%D0%B8%D0%BB%D1%8C%D0%BD%D1%83%D1%8E%20%D0%BE%D0%B1%D0%BB%D0%BE%D0%B6%D0%BA%D1%83%20%D0%B8%20%D0%BF%D0%BE%D0%B4%D0%B3%D0%BE%D1%82%D0%BE%D0%B2%D1%8C%20%D0%BF%D0%BE%D1%81%D1%82-%D0%B0%D0%BD%D0%BE%D0%BD%D1%81) \[ Ролик для Reels: сценарий + видео \](https://usetoolz.ru?q=%D0%9F%D1%80%D0%B8%D0%B4%D1%83%D0%BC%D0%B0%D0%B9%20%D0%B8%D0%B4%D0%B5%D1%8E%20%D0%B4%D0%BB%D1%8F%20%D0%BA%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%BE%D0%B3%D0%BE%20%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%2C%20%D1%81%D0%B3%D0%B5%D0%BD%D0%B5%D1%80%D0%B8%D1%80%D1%83%D0%B9%20%D1%80%D0%BE%D0%BB%D0%B8%D0%BA%20%D0%B8%20%D0%BD%D0%B0%D0%BF%D0%B8%D1%88%D0%B8%20%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5%20%D0%B4%D0%BB%D1%8F%20%D0%BF%D1%83%D0%B1%D0%BB%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%B8) \[ Из записи созвона → протокол и задачи \](https://usetoolz.ru?q=%D0%A0%D0%B0%D1%81%D1%88%D0%B8%D1%84%D1%80%D1%83%D0%B9%20%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D1%8C%20%D0%B2%D1%81%D1%82%D1%80%D0%B5%D1%87%D0%B8%2C%20%D0%B2%D1%8B%D0%B4%D0%B5%D0%BB%D0%B8%20%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D1%8B%D0%B5%20%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D1%8F%20%D0%B8%20%D0%BE%D1%84%D0%BE%D1%80%D0%BC%D0%B8%20%D1%82%D0%B0%D0%B1%D0%BB%D0%B8%D1%86%D1%83%20%D0%B7%D0%B0%D0%B4%D0%B0%D1%87)

## Как сделать песню в подарок

1. Напишите, для кого песня и по какому поводу: «на юбилей маме, 60 лет, любит дачу и внуков, весёлая».
2. Свои стихи — во вкладке «Со своим текстом»: нейросеть споёт их.
3. Нажмите «Создать песню» — через пару минут будут готовы два варианта, выберите лучший.

Цена — 25 кредитов за песню (два варианта). Если не получится, кредиты вернутся.

Это одна из возможностей \[генератора музыки\](https://usetoolz.ru/ai/music-generator): там же кавер, продление трека и звуки.

### Полезные статьи

#### [Создать песню нейросетью онлайн на русском: полное руководство по Suno V6](https://usetoolz.ru/blog/suno-v6-generaciya-muzyki-nejrosetyu)

Как сгенерировать песню со своим текстом или по описанию в Suno V6 на русском языке без VPN. Разметка куплетов и припевов, рабочие промпты по жанрам, разделение вокала и цены.

#### [Транскрибация аудио и видео в текст онлайн: как перевести голосовое, лекцию или встречу в конспект](https://usetoolz.ru/blog/transkribaciya-audio-i-video-v-tekst)

Как быстро расшифровать аудиозапись диктофона, голосовое сообщение или видео созвона в чистый текст с таймкодами, разделением по спикерам и готовым протоколом встречи с помощью ИИ.

#### [Генерация картинок нейросетью: полное руководство](https://usetoolz.ru/blog/generaciya-kartinok-nejrosetyu-rukovodstvo)

Как генерировать картинки нейросетью по описанию: выбор стиля, написание промптов, сравнение Midjourney, DALL-E, Stable Diffusion и UseToolz.

### Похожие инструменты

[Говорящий аватар из фото](https://usetoolz.ru/video/talking-avatar)

Загрузите фото человека и напишите текст или приложите запись голоса — лицо на фото произнесёт его, губы двигаются в такт.

[Сменить стиль видео](https://usetoolz.ru/video/restyle)

Загрузите короткое видео и опишите новый стиль — нейросеть перерисует каждый кадр: аниме, мультфильм, чёрно-белое кино. Видео до 15 секунд.

[Сделать видео нейросетью](https://usetoolz.ru/ai/video-generator)

Всё о видео в одном месте: по описанию, из фото, говорящий аватар, перенос движения, смена стиля, озвучка и продление.

[Продлить видео](https://usetoolz.ru/video/extend)

Нейросеть доснимет продолжение видео, сделанного здесь: ещё 5–30 секунд с последнего кадра, в том же стиле.
