লাইরিয়া ৩ হলো গুগলের মিউজিক জেনারেশন মডেলের একটি সিরিজ, যা জেমিনি এপিআই (Gemini API)-এর মাধ্যমে পাওয়া যায়। লাইরিয়া ৩ ব্যবহার করে আপনি টেক্সট প্রম্পট বা ছবি থেকে উচ্চ-মানের, ৪৮ কিলোহার্টজ স্টেরিও অডিও তৈরি করতে পারেন। এই মডেলগুলো কাঠামোগত সামঞ্জস্য প্রদান করে, যার মধ্যে রয়েছে কণ্ঠস্বর, সময়ানুবর্তী গানের কথা এবং সম্পূর্ণ যন্ত্রসংগীতের আয়োজন।
লাইরিয়া ৩ পরিবারে দুটি মডেল অন্তর্ভুক্ত রয়েছে:
| মডেল | মডেল আইডি | সেরা | সময়কাল | আউটপুট |
|---|---|---|---|---|
| লিরিয়া ৩ ক্লিপ | lyria-3-clip-preview | ছোট ক্লিপ, লুপ, প্রিভিউ | ৩০ সেকেন্ড | এমপি৩ |
| লাইরিয়া ৩ প্রো | lyria-3-pro-preview | পদ, অন্তরা ও অন্তর্বর্তী অংশসহ পূর্ণাঙ্গ গান | কয়েক মিনিট (নির্দেশনার মাধ্যমে নিয়ন্ত্রণযোগ্য) | MP3, WAV |
উভয় মডেলই স্ট্যান্ডার্ড generateContent মেথড এবং নতুন Interactions API ব্যবহার করে চালানো যায়, যা মাল্টিমোডাল ইনপুট (টেক্সট ও ছবি) সমর্থন করে এবং ৪৮ কিলোহার্টজ হাই-ফিডেলিটি স্টেরিও অডিও তৈরি করে।
একটি মিউজিক ক্লিপ তৈরি করুন
Lyria 3 Clip মডেলটি সর্বদা একটি ৩০-সেকেন্ডের ক্লিপ তৈরি করে। একটি ক্লিপ তৈরি করতে, generateContent মেথডটি কল করুন এবং response_modalities ["AUDIO", "TEXT"] -এ সেট করুন। TEXT অন্তর্ভুক্ত করলে আপনি অডিওর পাশাপাশি তৈরি হওয়া গানের কথা বা গানের কাঠামোও পাবেন।
পাইথন
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="lyria-3-clip-preview",
contents="Create a 30-second cheerful acoustic folk song with "
"guitar and harmonica.",
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
# Parse the response
for part in response.parts:
if part.text is not None:
print(part.text)
elif part.inline_data is not None:
with open("clip.mp3", "wb") as f:
f.write(part.inline_data.data)
print("Audio saved to clip.mp3")
জাভাস্ক্রিপ্ট
import { GoogleGenAI } from "@google/genai";
import * as fs from "node:fs";
const ai = new GoogleGenAI({});
async function main() {
const response = await ai.models.generateContent({
model: "lyria-3-clip-preview",
contents: "Create a 30-second cheerful acoustic folk song with " +
"guitar and harmonica.",
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
for (const part of response.candidates[0].content.parts) {
if (part.text) {
console.log(part.text);
} else if (part.inlineData) {
const buffer = Buffer.from(part.inlineData.data, "base64");
fs.writeFileSync("clip.mp3", buffer);
console.log("Audio saved to clip.mp3");
}
}
}
main();
যান
package main
import (
"context"
"fmt"
"log"
"os"
"google.golang.org/genai"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
config := &genai.GenerateContentConfig{
ResponseModalities: []string{"AUDIO", "TEXT"},
}
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-clip-preview",
genai.Text("Create a 30-second cheerful acoustic folk song " +
"with guitar and harmonica."),
config,
)
if err != nil {
log.Fatal(err)
}
for _, part := range result.Candidates[0].Content.Parts {
if part.Text != "" {
fmt.Println(part.Text)
} else if part.InlineData != nil {
err := os.WriteFile("clip.mp3", part.InlineData.Data, 0644)
if err != nil {
log.Fatal(err)
}
fmt.Println("Audio saved to clip.mp3")
}
}
}
জাভা
import com.google.genai.Client;
import com.google.genai.types.GenerateContentConfig;
import com.google.genai.types.GenerateContentResponse;
import com.google.genai.types.Part;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class GenerateMusicClip {
public static void main(String[] args) throws IOException {
try (Client client = new Client()) {
GenerateContentConfig config = GenerateContentConfig.builder()
.responseModalities("AUDIO", "TEXT")
.build();
GenerateContentResponse response = client.models.generateContent(
"lyria-3-clip-preview",
"Create a 30-second cheerful acoustic folk song with "
+ "guitar and harmonica.",
config);
for (Part part : response.parts()) {
if (part.text().isPresent()) {
System.out.println(part.text().get());
} else if (part.inlineData().isPresent()) {
var blob = part.inlineData().get();
if (blob.data().isPresent()) {
Files.write(Paths.get("clip.mp3"), blob.data().get());
System.out.println("Audio saved to clip.mp3");
}
}
}
}
}
}
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-clip-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "Create a 30-second cheerful acoustic folk song with guitar and harmonica."}
]
}],
"generationConfig": {
"responseModalities": ["AUDIO", "TEXT"]
}
}'
সি#
using System.Threading.Tasks;
using Google.GenAI;
using Google.GenAI.Types;
using System.IO;
public class GenerateMusicClip {
public static async Task main() {
var client = new Client();
var config = new GenerateContentConfig {
ResponseModalities = { "AUDIO", "TEXT" }
};
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-clip-preview",
contents: "Create a 30-second cheerful acoustic folk song with guitar and harmonica.",
config: config
);
foreach (var part in response.Candidates[0].Content.Parts) {
if (part.Text != null) {
Console.WriteLine(part.Text);
} else if (part.InlineData != null) {
await File.WriteAllBytesAsync("clip.mp3", part.InlineData.Data);
Console.WriteLine("Audio saved to clip.mp3");
}
}
}
}
একটি পূর্ণ দৈর্ঘ্যের গান তৈরি করুন
কয়েক মিনিটের পূর্ণ দৈর্ঘ্যের গান তৈরি করতে lyria-3-pro-preview মডেলটি ব্যবহার করুন। প্রো মডেলটি সঙ্গীতের কাঠামো বোঝে এবং স্বতন্ত্র ভার্স, কোরাস ও ব্রিজ সহ কম্পোজিশন তৈরি করতে পারে। আপনি আপনার প্রম্পটে সময়কাল নির্দিষ্ট করে (যেমন, "একটি ২-মিনিটের গান তৈরি করুন") অথবা টাইমস্ট্যাম্প ব্যবহার করে এর কাঠামো নির্ধারণ করে সময়কালকে প্রভাবিত করতে পারেন।
পাইথন
response = client.models.generate_content(
model="lyria-3-pro-preview",
contents="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.",
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
জাভাস্ক্রিপ্ট
const response = await ai.models.generateContent({
model: "lyria-3-pro-preview",
contents: "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.",
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
যান
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-pro-preview",
genai.Text("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."),
config,
)
জাভা
GenerateContentResponse response = client.models.generateContent(
"lyria-3-pro-preview",
"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.",
config);
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "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."}
]
}],
"generationConfig": {
"responseModalities": ["AUDIO", "TEXT"]
}
}'
সি#
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-pro-preview",
contents: "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.",
config: config
);
প্রতিক্রিয়াটি বিশ্লেষণ করুন
Lyria 3 থেকে প্রাপ্ত প্রতিক্রিয়াটিতে একাধিক অংশ থাকে। টেক্সট অংশগুলিতে তৈরি করা গানের কথা অথবা গানের কাঠামোর একটি JSON বিবরণ থাকে। inline_data যুক্ত অংশগুলিতে অডিও বাইটগুলো থাকে।
পাইথন
lyrics = []
audio_data = None
for part in response.parts:
if part.text is not None:
lyrics.append(part.text)
elif part.inline_data is not None:
audio_data = part.inline_data.data
if lyrics:
print("Lyrics:\n" + "\n".join(lyrics))
if audio_data:
with open("output.mp3", "wb") as f:
f.write(audio_data)
জাভাস্ক্রিপ্ট
const lyrics = [];
let audioData = null;
for (const part of response.candidates[0].content.parts) {
if (part.text) {
lyrics.push(part.text);
} else if (part.inlineData) {
audioData = Buffer.from(part.inlineData.data, "base64");
}
}
if (lyrics.length) {
console.log("Lyrics:\n" + lyrics.join("\n"));
}
if (audioData) {
fs.writeFileSync("output.mp3", audioData);
}
যান
var lyrics []string
var audioData []byte
for _, part := range result.Candidates[0].Content.Parts {
if part.Text != "" {
lyrics = append(lyrics, part.Text)
} else if part.InlineData != nil {
audioData = part.InlineData.Data
}
}
if len(lyrics) > 0 {
fmt.Println("Lyrics:\n" + strings.Join(lyrics, "\n"))
}
if audioData != nil {
err := os.WriteFile("output.mp3", audioData, 0644)
if err != nil {
log.Fatal(err)
}
}
জাভা
List<String> lyrics = new ArrayList<>();
byte[] audioData = null;
for (Part part : response.parts()) {
if (part.text().isPresent()) {
lyrics.add(part.text().get());
} else if (part.inlineData().isPresent()) {
audioData = part.inlineData().get().data().get();
}
}
if (!lyrics.isEmpty()) {
System.out.println("Lyrics:\n" + String.join("\n", lyrics));
}
if (audioData != null) {
Files.write(Paths.get("output.mp3"), audioData);
}
সি#
var lyrics = new List<string>();
byte[] audioData = null;
foreach (var part in response.Candidates[0].Content.Parts) {
if (part.Text != null) {
lyrics.Add(part.Text);
} else if (part.InlineData != null) {
audioData = part.InlineData.Data;
}
}
if (lyrics.Count > 0) {
Console.WriteLine("Lyrics:\n" + string.Join("\n", lyrics));
}
if (audioData != null) {
await File.WriteAllBytesAsync("output.mp3", audioData);
}
বিশ্রাম
# 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 '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | base64 -d > output.mp3
ছবি থেকে সঙ্গীত তৈরি করুন
লাইরিয়া ৩ মাল্টিমোডাল ইনপুট সমর্থন করে — আপনি আপনার টেক্সট প্রম্পটের পাশাপাশি ১০টি পর্যন্ত ছবি দিতে পারেন এবং মডেলটি সেই ভিজ্যুয়াল কন্টেন্ট থেকে অনুপ্রাণিত হয়ে সঙ্গীত রচনা করবে।
পাইথন
from PIL import Image
image = Image.open("desert_sunset.jpg")
response = client.models.generate_content(
model="lyria-3-pro-preview",
contents=[
"An atmospheric ambient track inspired by the mood and "
"colors in this image.",
image,
],
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
জাভাস্ক্রিপ্ট
const imageData = fs.readFileSync("desert_sunset.jpg");
const base64Image = imageData.toString("base64");
const response = await ai.models.generateContent({
model: "lyria-3-pro-preview",
contents: [
{ text: "An atmospheric ambient track inspired by the mood " +
"and colors in this image." },
{
inlineData: {
mimeType: "image/jpeg",
data: base64Image,
},
},
],
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
যান
imgData, err := os.ReadFile("desert_sunset.jpg")
if err != nil {
log.Fatal(err)
}
parts := []*genai.Part{
genai.NewPartFromText("An atmospheric ambient track inspired " +
"by the mood and colors in this image."),
&genai.Part{
InlineData: &genai.Blob{
MIMEType: "image/jpeg",
Data: imgData,
},
},
}
contents := []*genai.Content{
genai.NewContentFromParts(parts, genai.RoleUser),
}
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-pro-preview",
contents,
config,
)
জাভা
GenerateContentResponse response = client.models.generateContent(
"lyria-3-pro-preview",
Content.fromParts(
Part.fromText("An atmospheric ambient track inspired by "
+ "the mood and colors in this image."),
Part.fromBytes(
Files.readAllBytes(Path.of("desert_sunset.jpg")),
"image/jpeg")),
config);
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-d "{
\"contents\": [{
\"parts\":[
{\"text\": \"An atmospheric ambient track inspired by the mood and colors in this image.\"},
{
\"inline_data\": {
\"mime_type\":\"image/jpeg\",
\"data\": \"<BASE64_IMAGE_DATA>\"
}
}
]
}],
\"generationConfig\": {
\"responseModalities\": [\"AUDIO\", \"TEXT\"]
}
}"
সি#
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-pro-preview",
contents: new List<Part> {
Part.FromText("An atmospheric ambient track inspired by the mood and colors in this image."),
Part.FromBytes(await File.ReadAllBytesAsync("desert_sunset.jpg"), "image/jpeg")
},
config: config
);
নিজস্ব গানের কথা দিন
আপনি নিজের লিরিক লিখে প্রম্পটে অন্তর্ভুক্ত করতে পারেন। মডেলকে গানের কাঠামো বুঝতে সাহায্য করার জন্য [Verse] , [Chorus] , এবং [Bridge] এর মতো সেকশন ট্যাগ ব্যবহার করুন:
পাইথন
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.
"""
response = client.models.generate_content(
model="lyria-3-pro-preview",
contents=prompt,
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
জাভাস্ক্রিপ্ট
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 response = await ai.models.generateContent({
model: "lyria-3-pro-preview",
contents: prompt,
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
যান
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.
`
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-pro-preview",
genai.Text(prompt),
config,
)
জাভা
String 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.
""";
GenerateContentResponse response = client.models.generateContent(
"lyria-3-pro-preview",
prompt,
config);
সি#
var 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.
";
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-pro-preview",
contents: prompt,
config: config
);
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "Create a dreamy indie pop song with the following lyrics: ..."}
]
}],
"generationConfig": {
"responseModalities": ["AUDIO", "TEXT"]
}
}'
সময় এবং কাঠামো নিয়ন্ত্রণ করুন
টাইমস্ট্যাম্প ব্যবহার করে আপনি গানের নির্দিষ্ট মুহূর্তে ঠিক কী ঘটবে তা সুনির্দিষ্টভাবে নির্ধারণ করতে পারেন। বাদ্যযন্ত্র কখন প্রবেশ করবে, গানের কথা কখন পরিবেশিত হবে এবং গানটি কীভাবে এগোবে, তা নিয়ন্ত্রণ করার জন্য এটি কার্যকর।
পাইথন
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.
"""
response = client.models.generate_content(
model="lyria-3-pro-preview",
contents=prompt,
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
জাভাস্ক্রিপ্ট
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 response = await ai.models.generateContent({
model: "lyria-3-pro-preview",
contents: prompt,
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
যান
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.
`
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-pro-preview",
genai.Text(prompt),
config,
)
জাভা
String 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.
""";
GenerateContentResponse response = client.models.generateContent(
"lyria-3-pro-preview",
prompt,
config);
সি#
var 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.
";
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-pro-preview",
contents: prompt,
config: config
);
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "[0:00 - 0:10] Intro: ..."}
]
}],
"generationConfig": {
"responseModalities": ["AUDIO", "TEXT"]
}
}'
যন্ত্রসংগীতের ট্র্যাক তৈরি করুন
ব্যাকগ্রাউন্ড মিউজিক, গেম সাউন্ডট্র্যাক, বা এমন যেকোনো ক্ষেত্রে যেখানে ভোকালের প্রয়োজন নেই, আপনি মডেলটিকে শুধুমাত্র যন্ত্রসংগীতের ট্র্যাক তৈরি করতে নির্দেশ দিতে পারেন:
পাইথন
response = client.models.generate_content(
model="lyria-3-clip-preview",
contents="A bright chiptune melody in C Major, retro 8-bit "
"video game style. Instrumental only, no vocals.",
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
জাভাস্ক্রিপ্ট
const response = await ai.models.generateContent({
model: "lyria-3-clip-preview",
contents: "A bright chiptune melody in C Major, retro 8-bit " +
"video game style. Instrumental only, no vocals.",
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
যান
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-clip-preview",
genai.Text("A bright chiptune melody in C Major, retro 8-bit " +
"video game style. Instrumental only, no vocals."),
config,
)
জাভা
GenerateContentResponse response = client.models.generateContent(
"lyria-3-clip-preview",
"A bright chiptune melody in C Major, retro 8-bit "
+ "video game style. Instrumental only, no vocals.",
config);
সি#
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-clip-preview",
contents: "A bright chiptune melody in C Major, retro 8-bit " +
"video game style. Instrumental only, no vocals.",
config: config
);
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-clip-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "A bright chiptune melody in C Major, retro 8-bit video game style. Instrumental only, no vocals."}
]
}],
"generationConfig": {
"responseModalities": ["AUDIO", "TEXT"]
}
}'
বিভিন্ন ভাষায় সঙ্গীত তৈরি করুন
লিরিয়া ৩ আপনার দেওয়া নির্দেশনার ভাষাতেই গানের কথা তৈরি করে। ফরাসি ভাষায় গান তৈরি করতে, আপনার নির্দেশনাটি ফরাসি ভাষায় লিখুন। মডেলটি ভাষার সাথে মিলিয়ে এর কণ্ঠশৈলী এবং উচ্চারণকে মানিয়ে নেয়।
পাইথন
response = client.models.generate_content(
model="lyria-3-pro-preview",
contents="Crée une chanson pop romantique en français sur un "
"coucher de soleil à Paris. Utilise du piano et de "
"la guitare acoustique.",
config=types.GenerateContentConfig(
response_modalities=["AUDIO", "TEXT"],
),
)
জাভাস্ক্রিপ্ট
const response = await ai.models.generateContent({
model: "lyria-3-pro-preview",
contents: "Crée une chanson pop romantique en français sur un " +
"coucher de soleil à Paris. Utilise du piano et de " +
"la guitare acoustique.",
config: {
responseModalities: ["AUDIO", "TEXT"],
},
});
যান
result, err := client.Models.GenerateContent(
ctx,
"lyria-3-pro-preview",
genai.Text("Crée une chanson pop romantique en français sur un " +
"coucher de soleil à Paris. Utilise du piano et de " +
"la guitare acoustique."),
config,
)
জাভা
GenerateContentResponse response = client.models.generateContent(
"lyria-3-pro-preview",
"Crée une chanson pop romantique en français sur un "
+ "coucher de soleil à Paris. Utilise du piano et de "
+ "la guitare acoustique.",
config);
সি#
var response = await client.Models.GenerateContentAsync(
model: "lyria-3-pro-preview",
contents: "Crée une chanson pop romantique en français sur un " +
"coucher de soleil à Paris. Utilise du piano et de " +
"la guitare acoustique.",
config: config
);
বিশ্রাম
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/lyria-3-pro-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "Crée une chanson pop romantique en français sur un coucher de soleil à Paris. Utilise du piano et de la guitare acoustique."}
]
}],
"generationConfig": {
"responseModalities": ["AUDIO", "TEXT"]
}
}'
মডেল ইন্টেলিজেন্স
লাইরিয়া ৩ আপনার প্রম্পট প্রক্রিয়া বিশ্লেষণ করে, যেখানে মডেলটি আপনার প্রম্পটের উপর ভিত্তি করে সঙ্গীতের কাঠামো (ইন্ট্রো, ভার্স, কোরাস, ব্রিজ, ইত্যাদি) নিয়ে যুক্তি দিয়ে কাজ করে। এটি অডিও তৈরি হওয়ার আগেই ঘটে এবং কাঠামোগত সামঞ্জস্য ও সঙ্গীতময়তা নিশ্চিত করে।
ইন্টারঅ্যাকশন এপিআই
আপনি ইন্টারঅ্যাকশনস এপিআই (Interactions API)- এর সাথে লাইরিয়া ৩ (Lyria 3) মডেল ব্যবহার করতে পারেন; এটি জেমিনি (Gemini) মডেল এবং এজেন্টদের সাথে যোগাযোগের জন্য একটি সমন্বিত ইন্টারফেস। এটি জটিল মাল্টিমোডাল ব্যবহারের ক্ষেত্রে স্টেট ম্যানেজমেন্ট এবং দীর্ঘমেয়াদী কাজগুলোকে সহজ করে তোলে।
পাইথন
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="lyria-3-pro-preview",
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.",
response_modalities=["AUDIO", "TEXT"]
)
for output in interaction.outputs:
if output.text:
print(output.text)
elif output.inline_data:
with open("interaction_output.mp3", "wb") as f:
f.write(output.inline_data.data)
print("Audio saved to interaction_output.mp3")
জাভাস্ক্রিপ্ট
import { GoogleGenAI } from '@google/genai';
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: 'lyria-3-pro-preview',
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.',
responseModalities: ['AUDIO', 'TEXT'],
});
for (const output of interaction.outputs) {
if (output.text) {
console.log(output.text);
} else if (output.inlineData) {
const buffer = Buffer.from(output.inlineData.data, 'base64');
fs.writeFileSync('interaction_output.mp3', buffer);
console.log('Audio saved to interaction_output.mp3');
}
}
বিশ্রাম
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-pro-preview",
"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.",
"responseModalities": ["AUDIO", "TEXT"]
}'
প্রম্পটিং গাইড
আপনার নির্দেশ যত সুনির্দিষ্ট হবে, ফলাফল তত ভালো হবে। জেনারেশনকে নির্দেশিত করতে আপনি যা যা অন্তর্ভুক্ত করতে পারেন তা নিচে দেওয়া হলো:
- ধরণ : একটি ধরণ বা একাধিক ধরণের মিশ্রণ উল্লেখ করুন (যেমন, "লো-ফাই হিপ হপ", "জ্যাজ ফিউশন", "সিনেমাটিক অর্কেস্ট্রাল")।
- বাদ্যযন্ত্র : নির্দিষ্ট বাদ্যযন্ত্রগুলোর নাম উল্লেখ করুন (যেমন, "ফেন্ডার রোডস পিয়ানো", "স্লাইড গিটার", "টিআর-৮০৮ ড্রাম মেশিন")।
- BPM : টেম্পো সেট করুন (যেমন, "১২০ BPM", "প্রায় ৭০ BPM-এর ধীর টেম্পো")।
- কী/স্কেল : একটি সাংগীতিক কী উল্লেখ করুন (যেমন, "জি মেজর", "ডি মাইনর")।
- মেজাজ ও পরিবেশ : বর্ণনামূলক বিশেষণ ব্যবহার করুন (যেমন, 'স্মৃতিময়', 'আক্রমণাত্মক', 'স্বর্গীয়', 'স্বপ্নময়')।
- কাঠামো : গানের অগ্রগতি নিয়ন্ত্রণ করতে
[Verse],[Chorus],[Bridge],[Intro],[Outro]এর মতো ট্যাগ অথবা টাইমস্ট্যাম্প ব্যবহার করুন। - সময়কাল : ক্লিপ মডেলটি সর্বদা ৩০-সেকেন্ডের ক্লিপ তৈরি করে। প্রো মডেলের জন্য, আপনার প্রম্পটে কাঙ্ক্ষিত দৈর্ঘ্য উল্লেখ করুন (যেমন, "একটি ২-মিনিটের গান তৈরি করুন") অথবা সময়কাল নিয়ন্ত্রণ করতে টাইমস্ট্যাম্প ব্যবহার করুন।
উদাহরণ প্রম্পট
কার্যকরী নির্দেশনার কিছু উদাহরণ নিচে দেওয়া হলো:
-
"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-pro-previewদিয়ে পূর্ণাঙ্গ জেনারেশনে যাওয়ার আগে, প্রম্পট নিয়ে পরীক্ষা-নিরীক্ষা করার জন্য দ্রুততরlyria-3-clip-previewমডেলটি ব্যবহার করুন। - সুনির্দিষ্ট হোন। অস্পষ্ট নির্দেশনা সাধারণ ফলাফল দেয়। সর্বোত্তম ফলাফলের জন্য বাদ্যযন্ত্র, বিপিএম, কী, মেজাজ এবং কাঠামো উল্লেখ করুন।
- আপনার ভাষা মেলান। আপনি যে ভাষায় গানের কথা চান, সেই ভাষায় নির্দেশ দিন।
- সেকশন ট্যাগ ব্যবহার করুন।
[Verse],[Chorus],[Bridge]ট্যাগগুলো মডেলটিকে অনুসরণ করার জন্য একটি সুস্পষ্ট কাঠামো প্রদান করে। - নির্দেশনা থেকে গানের কথা আলাদা করুন। নিজের মতো করে গানের কথা লেখার সময়, সেগুলোকে আপনার সঙ্গীত পরিচালনার নির্দেশনা থেকে স্পষ্টভাবে আলাদা করুন।
সীমাবদ্ধতা
- নিরাপত্তা : সমস্ত প্রম্পট নিরাপত্তা ফিল্টার দ্বারা যাচাই করা হয়। যে প্রম্পটগুলো ফিল্টার সক্রিয় করে, সেগুলো ব্লক করা হবে। এর মধ্যে নির্দিষ্ট শিল্পীর কণ্ঠস্বর বা কপিরাইটযুক্ত গানের কথা তৈরির অনুরোধকারী প্রম্পটগুলো অন্তর্ভুক্ত।
- ওয়াটারমার্কিং : শনাক্তকরণের জন্য তৈরি করা সমস্ত অডিওতে একটি SynthID অডিও ওয়াটারমার্ক অন্তর্ভুক্ত থাকে। এই ওয়াটারমার্কটি মানুষের কানে শোনা যায় না এবং এটি শোনার অভিজ্ঞতায় কোনো প্রভাব ফেলে না।
- মাল্টি-টার্ন এডিটিং : মিউজিক তৈরি করা একটি সিঙ্গেল-টার্ন প্রক্রিয়া। Lyria 3-এর বর্তমান সংস্করণে, একাধিক প্রম্পটের মাধ্যমে তৈরি করা ক্লিপের পুনরাবৃত্তিমূলক সম্পাদনা বা পরিমার্জন সমর্থিত নয়।
- দৈর্ঘ্য : ক্লিপ মডেলটি সর্বদা ৩০-সেকেন্ডের ক্লিপ তৈরি করে। প্রো মডেলটি কয়েক মিনিটের গান তৈরি করে; আপনার নির্দেশনার মাধ্যমে এর সঠিক সময়কাল নির্ধারণ করা যায়।
- নিয়তিবাদ : একই নির্দেশ দেওয়া হলেও, একেকবার একেকজনের ফলাফল একেক রকম হতে পারে।
এরপর কী?
- Lyria 3 মডেলগুলোর দাম যাচাই করুন।
- Lyria RealTime-এর সাথে রিয়েল-টাইম স্ট্রিমিং মিউজিক তৈরি করে দেখুন।
- টিটিএস মডেলগুলির সাহায্যে একাধিক বক্তার কথোপকথন তৈরি করুন।
- কীভাবে ছবি বা ভিডিও তৈরি করতে হয় তা জানুন।
- জেনে নিন জেমিনি কীভাবে অডিও ফাইল বুঝতে পারে।
- লাইভ এপিআই ব্যবহার করে জেমিনির সাথে রিয়েল-টাইমে কথা বলুন।