npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

suno-deno

v0.7.0

Published

A project to interact with SunoAI API

Downloads

3

Readme

Suno-Deno

Suno-Deno is a library designed for interacting with the Suno AI music generation service. This library provides a comprehensive set of methods to generate songs, retrieve metadata, return song links as buffer data, and more. The initial code for this library is based on the repository hissincn/suno-ai.

Features

  • Generate songs with AI-generated lyrics or custom lyrics
  • Retrieve metadata for generated songs
  • Return song links as buffer data
  • Retrieve remaining song generation credits
  • Generate song lyrics with AI

Installation

To install the library, you need to have Node.js installed. Run the following command to install the necessary dependencies:

npm install

Alternatively, if you are using Deno, no additional dependencies are required.

Usage

Here's how you can use Suno-Ma to generate and retrieve song links as buffer data:

1. Setup

Create a file named test-my-ai-music.js and use the following code as an example:

import SenoDeno from './SenoDeno.js';

async function main() {
    try {
        const cookie = 'your_cookie';
        const sid = 'your_sid';
        const suno = new SenoDeno(sid, cookie);

        await suno.init();

        const limit = await suno.getLimitLeft();
        console.log(`${limit} songs left`);

        const payload = {
            gpt_description_prompt: null,
            prompt: null,
            tags: null,
            make_instrumental: false,
            title: null,
            mv: 'chirp-v3-0',
            continue_clip_id: null,
            continue_at: null
        };

        const songInfo = await suno.generateSongs(payload);
        for (const song of songInfo) {
            const buffer = await suno.getSongBuffer(song.audio_url);
            console.log(`Song buffer for ${song.title}:`, buffer);
        }

        const ids = ['79742cdf-86c9-432f-81f2-8c2126de42d9', 'ae5ccb5-f4f8-49c9-8f5c-192e43ed9b0c', '0bba671e-b071-4da8-99e7-361b4c69f8b3'];
        const specificSongs = await suno.getMetadata(ids);

        const allSongs = await suno.getAllSongs();

        const lyrics = await suno.generateLyrics("hissin in the kitchen");
        console.log(lyrics);
    } catch (error) {
        console.error('Error:', error);
    }
}

main();

2. Running the Code

To run the code, use the following command:

node test-my-ai-music

Or if you are using Deno:

deno run --allow-net test-my-ai-music.js

3. Methods Overview

init()

Initializes the SenoDeno instance and renews the authentication token.

getLimitLeft()

Returns the number of song generation credits left.

generateSongs(payload)

Generates songs based on the provided payload.

getSongBuffer(url)

Retrieves the song link as buffer data.

getMetadata(ids)

Retrieves metadata for the specified song IDs.

getAllSongs()

Retrieves metadata for all generated songs.

generateLyrics(prompt)

Generates song lyrics based on the provided prompt.

Example Payloads

Generate a song with a prompt

{
  "gpt_description_prompt": "a syncopated blues song about how you're always there for me",
  "mv": "chirp-v3-5",
  "prompt": "",
  "make_instrumental": false
}

Generate a song with custom lyrics

{
  "prompt": "[Intro Clapping]\nسأسافرُ عبرَ الارض\nباحثا في كلِ مكان \n عن بوكيمون اداةِ \nالسلام\nقوةُ لا تهان\nبوكيمون سأجمعها الان\nفلتساندني\nبقوتك ساعدني\nآه لحلمنا الوحيد نحو عالمِ جديد",
  "tags": "dreamy kids music",
  "mv": "chirp-v3-0",
  "title": "Lines",
  "make_instrumental": false,
  "continue_clip_id": null,
  "continue_at": null
}

Continue generating a song from a specific point

{
  "prompt": "",
  "tags": "futuristic jazz",
  "mv": "chirp-v3-0",
  "title": "",
  "continue_clip_id": "d55b5269-6bad-4f61-a8f5-871fb124044d",
  "continue_at": 109
}

Remix and continue a song

{
  "prompt": "[Verse]\nWalking down the street, nobody takes a second glance\nLost in the crowd, I'm just a faceless passerby (oh-oh-oh)\n",
  "tags": "electronic hip hop",
  "mv": "chirp-v3-5",
  "title": "Lost in the Shuffle",
  "continue_clip_id": "62ed33cb-f802-47d3-a233-9a7f3fc804a3",
  "continue_at": 90.36
}

License

This project is licensed under the MIT License. See the LICENSE file for details.