PHP code example of tivins / llm-music-sdk

1. Go to this page and download the library: Download tivins/llm-music-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tivins / llm-music-sdk example snippets


use Tivins\LlmMusicSdk\MusicGenerator;

$generator = new MusicGenerator('http://127.0.0.1:8000');

$response = $generator->generateMusic(
    prompt: 'neoclassical piano, instrumental',
    negative_prompt: 'vocals, singing, speech, lyrics',
    duration: 120,
    title: 'My title',
    album: 'My album',
    artist: 'My artist',
    seed: 42,
);

file_put_contents('output.mp3', $response->mp3);