Lyria 3.5, Google के संगीत जनरेट करने वाले मॉडल का परिवार है. यह Gemini API के ज़रिए उपलब्ध है. Lyria 3.5 की मदद से, टेक्स्ट प्रॉम्प्ट या इमेज से 44.1 किलोहर्ट्ज़ का स्टीरियो ऑडियो जनरेट किया जा सकता है. ये मॉडल, स्ट्रक्चरल कोहेरेंस देते हैं. इनमें वोकल, समय के हिसाब से लिरिक्स, और पूरा इंस्ट्रुमेंटल अरेंजमेंट शामिल है.
Lyria फ़ैमिली में ये मॉडल शामिल हैं:
| मॉडल | मॉडल आईडी | इन स्थितियों में बेहतर है | कुल समय | आउटपुट |
|---|---|---|---|---|
| Lyria 3 Clip | lyria-3-clip-preview |
छोटी क्लिप, लूप, झलक | 30 सेकंड | MP3 |
| Lyria 3.5 | lyria-3.5 |
पूरे गाने, जिनमें वर्स, कोरस, और ब्रिज शामिल हों | कुछ मिनट (प्रॉम्प्ट का इस्तेमाल करके कंट्रोल किया जा सकता है) | MP3 |
दोनों मॉडल का इस्तेमाल, नए Interactions API की मदद से किया जा सकता है. यह मल्टीमॉडल इनपुट (टेक्स्ट और इमेज) के साथ काम करता है. साथ ही, 44.1 kHz हाई-फ़िडेलिटी स्टीरियो ऑडियो जनरेट करता है.
म्यूज़िक क्लिप जनरेट करना
Lyria 3 Clip मॉडल हमेशा 30 सेकंड की क्लिप जनरेट करता है. क्लिप जनरेट करने के लिए, टेक्स्ट प्रॉम्प्ट के साथ interactions.create तरीके को कॉल करें. जवाब में, steps स्कीमा में ऑडियो के साथ-साथ, जनरेट किए गए बोल और गाने का स्ट्रक्चर हमेशा शामिल होता है.
Python
import base64
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="lyria-3-clip-preview",
input="A short instrumental acoustic guitar piece.",
)
generated_audio = interaction.output_audio
if generated_audio:
with open("music.mp3", "wb") as f:
f.write(base64.b64decode(generated_audio.data))
lyrics = interaction.output_text
if lyrics:
print(f"Lyrics:\n{lyrics}")
JavaScript
import { GoogleGenAI } from '@google/genai';
import * as fs from 'fs';
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: 'lyria-3-clip-preview',
input: 'A short instrumental acoustic guitar piece.',
});
const generatedAudio = interaction.output_audio;
if (generatedAudio) {
fs.writeFileSync('music.mp3', Buffer.from(generatedAudio.data, 'base64'));
}
const lyrics = interaction.output_text;
if (lyrics) {
console.log(`Lyrics:\n${lyrics}`);
}
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"model": "lyria-3-clip-preview",
"input": "A short instrumental acoustic guitar piece."
}'
जनरेट किए गए संगीत के डेटा को वापस पाने के लिए, interaction.output_audio प्रॉपर्टी का इस्तेमाल किया जा सकता है. यह प्रॉपर्टी, जनरेट किए गए आखिरी ऑडियो ब्लॉक को वापस लाती है. interaction.output_text प्रॉपर्टी का इस्तेमाल करके, गाने के बोल और स्ट्रक्चर भी वापस पाए जा सकते हैं. सुविधा प्रॉपर्टी के बारे में ज़्यादा जानने के लिए, इंटरैक्शन की खास जानकारी देखें.
पूरा गाना जनरेट करना
lyria-3.5 मॉडल का इस्तेमाल करके, पूरे गाने जनरेट करें. इनकी अवधि कुछ मिनट होती है. Pro मॉडल, संगीत के स्ट्रक्चर को समझता है. साथ ही, अलग-अलग वर्स, कोरस, और ब्रिज के साथ कंपोज़िशन बना सकता है. अपने प्रॉम्प्ट में अवधि तय करके (जैसे, "दो मिनट का गाना बनाओ") या स्ट्रक्चर तय करने के लिए टाइमस्टैंप का इस्तेमाल करके, अवधि पर असर डाला जा सकता है.
Python
interaction = client.interactions.create(
model="lyria-3.5",
input="An epic cinematic orchestral piece about a journey home. Starts with a solo piano intro, builds through sweeping strings, and climaxes with a massive wall of sound.",
)
JavaScript
const interaction = await client.interactions.create({
model: 'lyria-3.5',
input: 'A beautiful piano melody.',
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"model": "lyria-3.5",
"input": "A beautiful piano melody."
}'
आउटपुट फ़ॉर्मैट चुनें
डिफ़ॉल्ट रूप से, Lyria 3.5 मॉडल MP3 फ़ॉर्मैट में ऑडियो जनरेट करते हैं. Lyria 3.5 के लिए, response_format को सेट करके, WAV फ़ॉर्मैट में आउटपुट का अनुरोध भी किया जा सकता है.
Python
interaction = client.interactions.create(
model="lyria-3.5",
input="A beautiful piano melody.",
response_format={"type": "audio"},
)
JavaScript
const interaction = await client.interactions.create({
model: 'lyria-3.5',
input: 'A beautiful piano melody.',
response_format: {
type: 'audio',
},
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lyria-3.5",
"input": "A beautiful piano melody.",
"response_format": {
"type": "audio"
}
}'
जवाब को पार्स करना
Lyria 3.5 के जवाब में, steps स्कीमा के अंदर कई कॉन्टेंट ब्लॉक शामिल हैं.
इंटरैक्शन से चरणों का क्रम मिलता है. इनमें से model_output चरणों में जनरेट किया गया कॉन्टेंट होता है.
टेक्स्ट कॉन्टेंट ब्लॉक में, जनरेट किए गए गाने के बोल या गाने के स्ट्रक्चर का JSON ब्यौरा होता है.
audio टाइप वाले कॉन्टेंट ब्लॉक में, base64 के कोड में बदला गया ऑडियो डेटा होता है.
Python
lyrics = []
audio_data = None
generated_audio = interaction.output_audio
if generated_audio:
with open("output.mp3", "wb") as f:
f.write(base64.b64decode(generated_audio.data))
lyrics = interaction.output_text
if lyrics:
print(f"Lyrics:\n{lyrics}")
JavaScript
const lyrics = [];
let audioData = null;
const generatedAudio = interaction.output_audio;
if (generatedAudio) {
fs.writeFileSync("output.mp3", Buffer.from(generatedAudio.data, 'base64'));
}
const lyrics = interaction.output_text;
if (lyrics) {
console.log("Lyrics:\n" + lyrics);
}
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
# The output from the REST API is a JSON object containing base64 encoded data.
# You can extract the text or the audio data using a tool like jq.
# To extract the audio and save it to a file:
curl ... | jq -r '.steps[] | select(.type=="model_output") | .content[] | select(.type=="audio") | .data' | base64 -d > output.mp3
गाने के बोल और संगीत एक साथ
Lyria 3.5 से मिलने वाला आउटपुट काफ़ी जटिल होता है. इसमें जनरेट किए गए बोल (टेक्स्ट) और गाने (ऑडियो) के लिए अलग-अलग चरण और ब्लॉक होते हैं. इसलिए, सुविधाएँ देने वाली प्रॉपर्टी, तेज़ी से काम करने वाला और सुझाया गया शॉर्टकट उपलब्ध कराती हैं.
हालांकि, अगर आपको सर्वर से मिले चरणों की रॉ टाइमलाइन पर पूरा प्रोग्रामैटिक कंट्रोल चाहिए (जैसे कि कॉन्टेंट के अलग-अलग ब्लॉक को लॉग करना, जैसा कि वे मिले हैं), तो इसके बजाय, steps पर मैन्युअल तरीके से दोहराएं:
Python
lyrics = []
audio_data = None
for step in interaction.steps:
if step.type == "model_output":
for content_block in step.content:
if content_block.type == "audio":
audio_data = base64.b64decode(content_block.data)
elif content_block.type == "text":
lyrics.append(content_block.text)
if lyrics:
print("Lyrics:\n" + "\n".join(lyrics))
if audio_data:
with open("output.mp3", "wb") as f:
f.write(audio_data)
JavaScript
const lyrics = [];
let audioData = null;
for (const step of interaction.steps) {
if (step.type === 'model_output') {
for (const contentBlock of step.content) {
if (contentBlock.type === 'audio') {
audioData = Buffer.from(contentBlock.data, 'base64');
} else if (contentBlock.type === 'text') {
lyrics.push(contentBlock.text);
}
}
}
}
if (lyrics.length) {
console.log("Lyrics:\n" + lyrics.join("\n"));
}
if (audioData) {
fs.writeFileSync("output.mp3", audioData);
}
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
इमेज से संगीत जनरेट करना
Lyria 3.5 में मल्टीमॉडल इनपुट का इस्तेमाल किया जा सकता है. input सूची में टेक्स्ट प्रॉम्प्ट के साथ-साथ, ज़्यादा से ज़्यादा 10 इमेज दी जा सकती हैं. इसके बाद, मॉडल विज़ुअल कॉन्टेंट के हिसाब से संगीत तैयार करेगा.
Python
import base64
with open("desert_sunset.jpg", "rb") as f:
image_bytes = f.read()
image_b64 = base64.b64encode(image_bytes).decode("utf-8")
response = client.interactions.create(
model="lyria-3.5",
input=[
{
"type": "text",
"text": "An atmospheric ambient track inspired by the mood and colors in this image.",
},
{
"type": "image",
"mime_type": "image/jpeg",
"data": image_b64,
},
],
)
JavaScript
import * as fs from "fs";
const imageBytes = fs.readFileSync("desert_sunset.jpg").toString("base64");
const interaction = await client.interactions.create({
model: "lyria-3.5",
input: [
{
type: "text",
text: "An atmospheric ambient track inspired by the mood and colors in this image.",
},
{
type: "image",
mime_type: "image/jpeg",
data: imageBytes,
},
],
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
# Pass base64 encoded image data directly:
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "lyria-3.5",
"input": [
{"type": "text", "text": "An atmospheric ambient track inspired by the mood and colors in this image."},
{"type": "image", "mime_type": "image/jpeg", "data": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wgALCAABAAEBAREA/8QAFBABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQABPxA="}
]
}'
अपनी पसंद के मुताबिक गाने के बोल उपलब्ध कराना
आपके पास अपने बोल लिखने और उन्हें प्रॉम्प्ट में शामिल करने का विकल्प होता है. सेक्शन टैग, जैसे कि [Verse], [Chorus], और [Bridge] का इस्तेमाल करें, ताकि मॉडल को गाने के स्ट्रक्चर को समझने में मदद मिल सके:
Python
prompt = """
Create a dreamy indie pop song with the following lyrics:
[Verse 1]
Walking through the neon glow,
city lights reflect below,
every shadow tells a story,
every corner, fading glory.
[Chorus]
We are the echoes in the night,
burning brighter than the light,
hold on tight, don't let me go,
we are the echoes down below.
[Verse 2]
Footsteps lost on empty streets,
rhythms sync to heartbeats,
whispers carried by the breeze,
dancing through the autumn leaves.
"""
interaction = client.interactions.create(
model="lyria-3.5",
input=prompt,
)
JavaScript
const prompt = `
Create a dreamy indie pop song with the following lyrics:
[Verse 1]
Walking through the neon glow,
city lights reflect below,
every shadow tells a story,
every corner, fading glory.
[Chorus]
We are the echoes in the night,
burning brighter than the light,
hold on tight, don't let me go,
we are the echoes down below.
[Verse 2]
Footsteps lost on empty streets,
rhythms sync to heartbeats,
whispers carried by the breeze,
dancing through the autumn leaves.
`;
const interaction = await client.interactions.create({
model: 'lyria-3.5',
input: prompt,
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lyria-3.5",
"input": "Create a dreamy indie pop song with the following lyrics: ..."
}'
समय और स्ट्रक्चर को कंट्रोल करना
टाइमस्टैंप का इस्तेमाल करके, यह बताया जा सकता है कि गाने के किस हिस्से में क्या होगा. इससे यह कंट्रोल किया जा सकता है कि इंस्ट्रुमेंट कब शुरू हों, बोल कब डिलीवर किए जाएं, और गाना कैसे आगे बढ़े:
Python
prompt = """
[0:00 - 0:10] Intro: Begin with a soft lo-fi beat and muffled
vinyl crackle.
[0:10 - 0:30] Verse 1: Add a warm Fender Rhodes piano melody
and gentle vocals singing about a rainy morning.
[0:30 - 0:50] Chorus: Full band with upbeat drums and soaring
synth leads. The lyrics are hopeful and uplifting.
[0:50 - 1:00] Outro: Fade out with the piano melody alone.
"""
interaction = client.interactions.create(
model="lyria-3.5",
input=prompt,
)
JavaScript
const prompt = `
[0:00 - 0:10] Intro: Begin with a soft lo-fi beat and muffled
vinyl crackle.
[0:10 - 0:30] Verse 1: Add a warm Fender Rhodes piano melody
and gentle vocals singing about a rainy morning.
[0:30 - 0:50] Chorus: Full band with upbeat drums and soaring
synth leads. The lyrics are hopeful and uplifting.
[0:50 - 1:00] Outro: Fade out with the piano melody alone.
`;
const interaction = await client.interactions.create({
model: 'lyria-3.5',
input: prompt,
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lyria-3.5",
"input": "[0:00 - 0:10] Intro: ..."
}'
इंस्ट्रुमेंटल ट्रैक जनरेट करना
बैकग्राउंड म्यूज़िक, गेम के साउंडट्रैक या ऐसे किसी भी इस्तेमाल के लिए, जहां वोकल की ज़रूरत नहीं होती, मॉडल को सिर्फ़ इंस्ट्रुमेंटल ट्रैक बनाने के लिए कहा जा सकता है:
Python
interaction = client.interactions.create(
model="lyria-3-clip-preview",
input="A bright chiptune melody in C Major, retro 8-bit video game style. Instrumental only, no vocals.",
)
JavaScript
const interaction = await client.interactions.create({
model: 'lyria-3-clip-preview',
input: 'A bright chiptune melody in C Major, retro 8-bit video game style. Instrumental only, no vocals.',
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lyria-3-clip-preview",
"input": "A bright chiptune melody in C Major, retro 8-bit video game style. Instrumental only, no vocals."
}'
अलग-अलग भाषाओं में संगीत जनरेट करना
Lyria 3.5, आपके प्रॉम्प्ट की भाषा में गाने के बोल जनरेट करता है. फ़्रेंच भाषा में बोल वाला गाना जनरेट करने के लिए, अपना प्रॉम्प्ट फ़्रेंच में लिखें. यह मॉडल, भाषा के हिसाब से अपनी आवाज़ और उच्चारण को बदलता है.
Python
interaction = client.interactions.create(
model="lyria-3.5",
input="Crée une chanson pop romantique en français sur un coucher de soleil à Paris. Utilise du piano et de la guitare acoustique.",
)
JavaScript
const interaction = await client.interactions.create({
model: 'lyria-3.5',
input: 'Crée une chanson pop romantique en français sur un coucher de soleil à Paris. Utilise du piano et de la guitare acoustique.',
});
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ResponseModality;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Arrays;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("lyria-3-generate-001"))
.responseModalities(Arrays.asList(ResponseModality.AUDIO))
.input(InteractionsInput.of("Upbeat electronic synthwave track"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println("Audio generated: " + interaction.outputAudio().isPresent());
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lyria-3.5",
"input": "Crée une chanson pop romantique en français sur un coucher de soleil à Paris. Utilise du piano et de la guitare acoustique."
}'
मॉडल इंटेलिजेंस
Lyria 3.5, आपके प्रॉम्प्ट का विश्लेषण करता है. इसमें मॉडल, आपके प्रॉम्प्ट के आधार पर संगीत की संरचना (इंट्रो, वर्स, कोरस, ब्रिज वगैरह) के बारे में बताता है. यह प्रोसेस, ऑडियो जनरेट होने से पहले होती है. इससे यह पक्का होता है कि ऑडियो में स्ट्रक्चरल कोहेरेंस और म्यूज़िकैलिटी हो.
प्रॉम्प्ट से जुड़ी गाइड
आपका प्रॉम्प्ट इतना आसान हो सकता है, जैसे कि "प्यारी बिल्लियों के बारे में एक लोक गीत, जिसमें वे गड्ढों से बच रही हों, महिला की आवाज़ में गाया गया हो और बारिश की आवाज़ सुनाई दे रही हो". इसके अलावा, यह ज़्यादा जानकारी वाला और स्ट्रक्चर्ड भी हो सकता है. जैसे:
यह 1980 के दशक के सिंथ-पॉप स्टाइल का ट्रैक है. इसमें दमदार बीट, झिलमिलाते सिंथेसाइज़र, और एक आकर्षक, ऐंथम जैसा कोरस है. गाने में रेट्रो-फ़्यूचरिस्टिक फ़ील होना चाहिए. साथ ही, इसमें 80 के दशक के क्लासिक पॉप हिट गानों की झलक होनी चाहिए. हालांकि, इसे मॉडर्न तरीके से बनाया गया हो. गाने का टेंपो तेज़ और डांस करने लायक होना चाहिए. यह 120 बीपीएम के आस-पास होना चाहिए. इसमें वर्स-कोरस का स्ट्रक्चर साफ़ तौर पर दिखना चाहिए. साथ ही, इसमें याद रखने लायक इंस्ट्रुमेंटल हुक होना चाहिए. गाने के बोल में, पार्टी के लिए तैयार होने के एहसास के बारे में बताया गया है.
आसान और मुश्किल, दोनों तरह के प्रॉम्प्ट से आपको अच्छे नतीजे मिल सकते हैं. इन सुझावों को आज़माकर देखें कि आपके लिए सबसे सही क्या है.
शैली
अपने प्रॉम्प्ट की शुरुआत, संगीत की उस शैली से करें जो आपको चाहिए. जैसे, हिप हॉप, रॉक, और रैप. अलग-अलग शैलियों को चुना जा सकता है:
- मेटल और रैप का फ़्यूज़न
- डेथ मेटल और ओपेरा का कॉम्बिनेशन
- इलेक्ट्रॉनिक ड्रोन वाले एलिमेंट के साथ क्लासिकल पीस
- यूरोपॉप के साथ मॉडर्न इलेक्ट्रॉनिक डांस म्यूज़िक (ईडीएम)
इसमें किसी युग को भी शामिल किया जा सकता है:
- 90 के दशक की शुरुआत का हिप-हॉप
- 60 के दशक का फ़्रेंच ये-ये पॉप
- 80 के दशक के इलेक्ट्रॉनिक एक्सपेरिमेंट
- 2000 के दशक का मेनस्ट्रीम पॉप
अगर आपने किसी खास शैली या क्षेत्र के हिसाब से संगीत बनाने के लिए प्रॉम्प्ट दिया है, जैसे कि "बर्लिन टेक्नो" या "बे एरिया हाइफ़ी", तो मॉडल उस शैली या क्षेत्र के हिसाब से संगीत बनाने की कोशिश करेगा. हालांकि, ऐसा हो सकता है कि वह हमेशा सही संगीत न बना पाए.
इंस्ट्रुमेंट
डिफ़ॉल्ट रूप से Lyria 3.5, गाने बनाने के लिए ऐसे इंस्ट्रूमेंट और टूल का इस्तेमाल करेगा जो उस शैली के लिए ज़रूरी हैं. आपको किसी तरह का सुझाव देने की ज़रूरत नहीं है.
हालांकि, अगर आपने सैक्सोफ़ोन के लिए नहीं कहा है, तो डांस ट्रैक में सैक्सोफ़ोन शामिल नहीं किया जाएगा. इसलिए, अगर आपको सैक्सोफ़ोन सोलो चाहिए, तो आपको यह प्रॉम्प्ट देना होगा:
यह एक डांस ट्रैक है, जिसमें तेज़ बीट, चमकते सिंथेसाइज़र, और एक आकर्षक, ऐंथम वाला कोरस है. ब्रिज के दौरान, सैक्सोफ़ोन का सोलो होना चाहिए.
आपके प्रॉम्प्ट में, खास इंस्ट्रुमेंट, उनकी आवाज़, और उनके एक-दूसरे के साथ इंटरैक्ट करने का तरीका शामिल हो सकता है. इस कॉम्बिनेशन का इस्तेमाल करके, कुछ मूड या टेक्सचर बनाए जा सकते हैं:
- डरावनी, डिस्टॉर्टेड बेसलाइन और साफ़-सुथरी, क्रिस्प हाई-हैट
- सूखे और सुकून भरे अकूस्टिक गिटार के नीचे, ऐनलॉग सिंथेसाइज़र पैड की वार्म टोन
- गिटार की कई लेयर से बना एक साउंड वॉल, जिसमें दबी हुई, दूर की आवाज़ें सुनाई दे रही हैं
गाने का स्ट्रक्चर
अपने प्रॉम्प्ट में, गाने के प्रोग्रेशन के बारे में बताया जा सकता है. फ़्लो तय करने के लिए, ऐरो या सूची का इस्तेमाल करें:
[Intro]->[Verse 1]->[Chorus]->[Verse 2]->[Chorus]->[Bridge]->[Outro]- शुरुआत में पियानो का धीमा इंट्रो हो, फिर ज़ोरदार वर्स हो, फिर कुछ देर के लिए संगीत बंद हो जाए, और फिर कोरस शुरू हो जाए.
यह भी तय किया जा सकता है कि इन सेक्शन के बीच ऊर्जा के लेवल में कैसे बदलाव होता है:
- प्री-कोरस में तनाव पैदा करें. इसके बाद, ज़ोरदार और धमाकेदार कोरस से पहले, संगीत को शांत कर दें
- पूरे गाने में धीरे-धीरे आवाज़ बढ़ती है. इसमें एक-एक करके इंस्ट्रुमेंट जोड़े जाते हैं जब तक कि आवाज़ का एक शोरगुल न बन जाए
- पुल के बाद अचानक रुक जाना और फिर एकैपेला कोरस
आपके पास यह बताने का विकल्प भी होता है कि आपको कोई काम कब करना है:
- 12 सेकंड पर ड्रॉप होने के लिए बिल्ड करें
- कोई व्यक्ति हर दो सेकंड में "क्या" कहता है
- कोरस 22 सेकंड पर शुरू होता है
गाने के बोल
आवाज़ और बोल डिफ़ॉल्ट रूप से जनरेट होते हैं. आपके पास अपने बोल देने, बोल न डालने (या इंस्ट्रुमेंटल ट्रैक डालने) का अनुरोध करने या बोल जनरेट करने की सुविधा को अपनी पसंद के हिसाब से इस्तेमाल करने का विकल्प होता है.
आपके बोल उसी भाषा में होंगे जिसमें आपने प्रॉम्प्ट लिखा है. "फ़्रेंच में गाने के बोल लिखो" जैसे प्रॉम्प्ट देकर, किसी दूसरी भाषा में भी गाने के बोल लिखने के लिए कहा जा सकता है.
खुद के लिखे गए बोल इस्तेमाल करना
मॉडल को अपने गाने के बोल देने के लिए, उन्हें प्रॉम्प्ट में "Lyrics:" प्रीफ़िक्स के साथ शामिल करें:
Lyrics:
[Intro]
Oooh, oooh
[Verse 1]
Let's go
Let's go
Go with the flow
[Chorus]
...
गाने के अलग-अलग हिस्सों को [Intro], [Verse 1], [Pre-chorus], [Chorus], और [Outro] जैसे सेक्शन के टाइटल के साथ प्रीफ़िक्स किया जा सकता है.
अगर आपको किसी शब्द या लाइन को दोहराना है, जैसे कि गूंज या बैकग्राउंड में गाने वाले लोगों की आवाज़, तो उसे ब्रैकेट में शामिल करें: "Let's go (go)".
मॉडल को गाने के बोल लिखने के लिए प्रॉम्प्ट करना
अगर आपको Lyria 3.5 से गाने के बोल लिखवाने हैं, तो अपने प्रॉम्प्ट में इस बारे में जानकारी शामिल करें कि गाने के बोल किस बारे में होंगे. ऐसा न करने पर, मॉडल को आपके संगीत के प्रॉम्प्ट से किसी विषय का अनुमान लगाना होगा. ऐसा हो सकता है कि वह विषय आपकी पसंद का न हो.
गाने के बोल में, प्यार में मिली हार और टूटे दिल के दर्द के बारे में बताया गया है. गायक, अपने पुराने रिश्ते और उससे जुड़ी यादों के बारे में बता रहा है.
अगर आपको गाने में एक ही कोरस को बार-बार दोहराना है, तो अपने प्रॉम्प्ट में इसके बारे में बताएं:
गाने के बोल में, प्यार में मिली हार और टूटे दिल के दर्द के बारे में बताया गया है. गायक, अपने पुराने रिश्ते और उससे जुड़ी यादों के बारे में बता रहा है. इस गाने में एक मज़बूत कोरस है, जिसमें दर्द से उबरने और आगे बढ़ने पर फ़ोकस किया गया है.
Lyria 3.5, आपके अनुरोध के हिसाब से, बोल के स्ट्रक्चर को अपने-आप सेट कर देगा. हालांकि, अपने प्रॉम्प्ट में भी इस बात पर ज़ोर दिया जा सकता है. उदाहरण के लिए:
एक ऐसा ईडीएम ट्रैक जिसमें एक ही जोशीले वाक्यांश को बार-बार दोहराया जाता है.
ऐसे वोकल इफ़ेक्ट के लिए भी प्रॉम्प्ट दिया जा सकता है जो पूरी तरह से बोल नहीं हैं. उदाहरण के लिए:
- गाने में किसी फ़िल्म का एक ही सैंपल बार-बार इस्तेमाल किया गया है, जिसमें "मुझे यकीन नहीं हो रहा!" शब्द को बार-बार दोहराया गया है
- यह एक हाई एनर्जी वाला टेक्नो ट्रैक है. ड्रॉप से ठीक पहले, आवाज़ पूरी तरह से बंद हो जाती है और एक छोटी सी आवाज़ कहती है "मुझे नहीं पता कि मैं यहां क्या कर रहा हूं". इसके बाद, संगीत शुरू हो जाता है.
- इस ट्रैक की शुरुआत में, 90 के दशक की फ़िल्मों को आज की फ़िल्मों से बेहतर बताया गया है. इसके बाद, ट्रैक एक पॉप गाने में बदल जाता है.
बोल
आपके पास यह बताने का विकल्प होता है कि आपको गाने के बोल किस तरह से चाहिए. बेहतर नतीजे पाने के लिए, गायक की प्रोफ़ाइल के बारे में पूरी जानकारी दें. जैसे, जेंडर, आवाज़ का टेक्स्चर, और वोकल रेंज.
- महिला सोप्रानो: साफ़, क्रिस्टलाइन टिंबर के साथ तेज़ और ऊंची क्वालिटी. हवादार और सांस लेने में आसान बनावट के साथ, सीटी जैसी ऊंची आवाज़ में गाने की क्षमता.
- फ़्रीक्वेंसी रेंज में महिला की आवाज़: यह आवाज़, गहरी, गर्म, और भारी होती है. धुएं जैसी आवाज़, जिसमें वोकल फ़्राय का हल्का सा टच है. यह आवाज़ दिल को छू लेने वाली और गूंजने वाली है.
- पुरुष टेनर: तेज़, तीखी, और ऊर्जा से भरपूर आवाज़. युवाओं जैसी आवाज़, जिसमें थोड़ी सी नाक से निकलने वाली आवाज़ है. यह आवाज़, मिक्स में तेज़ बेल्टिंग पावर के साथ सुनाई देती है.
- पुरुष की गहरी आवाज़: गहरी, चॉकलेट जैसी, और मखमली. आरामदायक और मधुर आवाज़ में गाता है.
- वेदर रॉकर (पुरुष): यह आवाज़ थोड़ी कर्कश और खुरदरी है. इसमें बजरी जैसी आवाज़ आती है. यह 90 के दशक के ग्रंज संगीत की याद दिलाती है. इमोशनल इंटेंसिटी के लिए, ऊपरी रेंज में तनाव.
प्रॉम्प्ट के अन्य पैरामीटर
अपने प्रॉम्प्ट को और बेहतर बनाने के लिए, इन पैरामीटर को भी शामिल किया जा सकता है:
- बीपीएम: टेंपो सेट करें (जैसे, "120 बीपीएम", "70 बीपीएम के आस-पास का धीमा टेंपो").
- की/स्केल: म्यूज़िकल की के बारे में बताएं. जैसे, "जी मेजर में", "डी माइनर".
- मूड और माहौल: जानकारी देने वाले विशेषणों का इस्तेमाल करें. जैसे, "यादें ताज़ा करने वाला", "आक्रामक", "अलौकिक", "सपनों जैसा".
- अवधि: क्लिप मॉडल हमेशा 30 सेकंड की क्लिप जनरेट करता है. Pro मॉडल के लिए, अपने प्रॉम्प्ट में मनचाही अवधि बताएं.उदाहरण के लिए, "दो मिनट का गाना बनाओ". इसके अलावा, अवधि को कंट्रोल करने के लिए टाइमस्टैंप का इस्तेमाल करें.
प्रॉम्प्ट के उदाहरण
यहाँ कुछ असरदार प्रॉम्प्ट के उदाहरण दिए गए हैं:
"A 30-second lofi hip hop beat with dusty vinyl crackle, mellow Rhodes piano chords, a slow boom-bap drum pattern at 85 BPM, and a jazzy upright bass line. Instrumental only.""An upbeat, feel-good pop song in G major at 120 BPM with bright acoustic guitar strumming, claps, and warm vocal harmonies about a summer road trip.""A dark, atmospheric trap beat at 140 BPM with heavy 808 bass, eerie synth pads, sharp hi-hats, and a haunting vocal sample. In D minor."
सबसे सही तरीके
- सबसे पहले Clip की मदद से दोहराएं.
lyria-3.5की मदद से पूरा जवाब जनरेट करने से पहले, प्रॉम्प्ट के साथ एक्सपेरिमेंट करने के लिए, ज़्यादा तेज़lyria-3-clip-previewमॉडल का इस्तेमाल करें. - सटीक जानकारी दें. प्रॉम्प्ट क्लियर न हो, तो रिज़ल्ट सटीक नहीं मिलता. बेहतरीन आउटपुट पाने के लिए, इंस्ट्रुमेंट, बीपीएम, की, मूड, और स्ट्रक्चर के बारे में जानकारी दें.
- अपनी भाषा से मिलती-जुलती भाषा चुनें. आपको जिस भाषा में गाने के बोल चाहिए उस भाषा में प्रॉम्प्ट लिखें.
- सेक्शन टैग इस्तेमाल करें.
[Verse],[Chorus],[Bridge]टैग की मदद से, मॉडल को जवाब देने के लिए एक साफ़ स्ट्रक्चर मिलता है. - गीत के बोल और निर्देशों को अलग-अलग रखें. अपनी पसंद के मुताबिक़ बोल देते समय, उन्हें संगीत से जुड़े निर्देशों से अलग रखें.
सीमाएं
- सुरक्षा: सभी प्रॉम्प्ट की जांच, सुरक्षा फ़िल्टर करते हैं. ऐसे प्रॉम्प्ट ब्लॉक कर दिए जाएंगे जिनसे फ़िल्टर ट्रिगर होते हैं. इसमें ऐसे प्रॉम्प्ट शामिल हैं जिनमें किसी खास कलाकार की आवाज़ में गाने बनाने या कॉपीराइट वाले बोल जनरेट करने का अनुरोध किया गया हो.
- वॉटरमार्किंग: जनरेट किए गए सभी ऑडियो में, पहचान के लिए SynthID ऑडियो वॉटरमार्क शामिल होता है. यह वॉटरमार्क, इंसानों को सुनाई नहीं देता. साथ ही, इससे सुनने के अनुभव पर कोई असर नहीं पड़ता.
- एक से ज़्यादा बार बदलाव करने की सुविधा: संगीत जनरेट करने की सुविधा एक बार में पूरी हो जाती है. Lyria 3.5 के मौजूदा वर्शन में, जनरेट की गई क्लिप में कई बार बदलाव करने या उसे बेहतर बनाने की सुविधा उपलब्ध नहीं है.
- अवधि: क्लिप मॉडल हमेशा 30 सेकंड की क्लिप जनरेट करता है. Pro मॉडल, कुछ मिनट की अवधि वाले गाने जनरेट करता है. हालांकि, प्रॉम्प्ट में अवधि के बारे में जानकारी देकर, गाने की अवधि को बदला जा सकता है.
- डिटरमिनिज़्म: एक ही प्रॉम्प्ट के लिए, कॉल के हिसाब से नतीजे अलग-अलग हो सकते हैं.
आगे क्या करना है
- Lyria 3.5 मॉडल की कीमत देखें.
- Lyria RealTime की मदद से, रीयल-टाइम में संगीत जनरेट करने की सुविधा आज़माएँ.
- टीटीएस मॉडल की मदद से, एक से ज़्यादा स्पीकर वाली बातचीत जनरेट करें.
- इमेज या वीडियो जनरेट करने का तरीका जानें.
- जानें कि Gemini ऑडियो फ़ाइलों को कैसे समझ सकता है.
- Live API का इस्तेमाल करके, Gemini के साथ रीयल-टाइम में बातचीत करें.