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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sm-tomusic-ai

v1767867.374.989

Published

Professional integration for https://tomusic.ai/

Readme

sm-tomusic-ai

A JavaScript library for interacting with the ToMusic.ai platform, providing convenient access to its music generation and analysis capabilities. This package simplifies integrating ToMusic.ai's powerful features into your JavaScript applications.

Installation

Install the package using npm: bash npm install sm-tomusic-ai

Usage

Here are several examples demonstrating how to use the sm-tomusic-ai package in your JavaScript applications:

1. Generating Music from a Prompt: javascript const toMusic = require('sm-tomusic-ai');

async function generateMusic(prompt) { try { const musicData = await toMusic.generateMusic({ prompt: prompt }); console.log('Music generated successfully:', musicData); // Process the music data (e.g., save to file, play in browser) } catch (error) { console.error('Error generating music:', error); } }

generateMusic("A happy and upbeat melody for a children's cartoon.");

2. Analyzing Music for Genre and Mood: javascript const toMusic = require('sm-tomusic-ai');

async function analyzeMusic(musicFile) { try { const analysisResult = await toMusic.analyzeMusic({ file: musicFile }); console.log('Music analysis result:', analysisResult); // Access genre, mood, key, tempo, etc. } catch (error) { console.error('Error analyzing music:', error); } }

analyzeMusic('/path/to/your/music.mp3');

3. Creating Variations of an Existing Song: javascript const toMusic = require('sm-tomusic-ai');

async function createVariation(musicFile, variationType) { try { const variation = await toMusic.createVariation({ file: musicFile, type: variationType }); console.log('Music variation generated:', variation); // Use the generated variation } catch (error) { console.error('Error generating music variation:', error); } }

createVariation('/path/to/your/original_song.wav', 'acoustic'); // Example: acoustic variation

4. Converting Music Between Formats: javascript const toMusic = require('sm-tomusic-ai');

async function convertMusic(inputFile, outputFormat) { try { const convertedFile = await toMusic.convertFormat({ file: inputFile, format: outputFormat }); console.log('Music converted successfully:', convertedFile); // Access the converted file } catch (error) { console.error('Error converting music:', error); } }

convertMusic('/path/to/your/music.wav', 'mp3');

5. Generating Music Based on Specific Instruments: javascript const toMusic = require('sm-tomusic-ai');

async function generateInstrumentalMusic(instruments) { try { const musicData = await toMusic.generateInstrumental({ instruments: instruments }); console.log('Instrumental music generated:', musicData); } catch (error) { console.error('Error generating instrumental music:', error); } }

generateInstrumentalMusic(['piano', 'violin', 'cello']);

API Summary

The sm-tomusic-ai package provides the following functions:

  • generateMusic(options: { prompt: string }): Promise<MusicData>: Generates music based on a text prompt. Returns a Promise that resolves with the generated music data.
  • analyzeMusic(options: { file: string }): Promise<AnalysisResult>: Analyzes a music file and returns information about its genre, mood, key, tempo, etc.
  • createVariation(options: { file: string, type: string }): Promise<MusicData>: Creates a variation of an existing song. type can be 'acoustic', 'remix', 'instrumental', etc.
  • convertFormat(options: { file: string, format: string }): Promise<string>: Converts a music file to a different format.
  • generateInstrumental(options: {instruments: string[]}): Promise<MusicData>: Generates music based on a list of instruments.

All functions return Promises and can throw errors if the request fails or the input is invalid.

License

MIT

This package is part of the sm-tomusic-ai ecosystem. For advanced features and enterprise-grade tools, visit: https://tomusic.ai/