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

musicgpt

v1.0.1

Published

Official TypeScript client for MusicGPT API

Downloads

43

Readme

MusicGPT SDK

npm version TypeScript License: ISC

Official TypeScript package for the MusicGPT API - AI-powered music generation, voice conversion, and audio processing.

MusicGPT public Api

https://musicgpt.com/api

📚 Documentation

https://docs.musicgpt.com/

🎵 Features

  • AI Music Generation - Create original music from text prompts
  • Voice Conversion - Transform voices with AI technology
  • Audio Processing - Denoise, enhance, and modify audio files
  • Voice Cloning - Create covers with different voices
  • Audio Transcription - Convert speech to text
  • Music Analysis - Extract key, BPM, and stems from audio
  • TypeScript Support - Full type safety and IntelliSense
  • Async/Await - Modern Promise-based API

📦 Installation

npm install musicgpt
# or
yarn add musicgpt

🚀 Quick Start

import { MusicGPTClient, MusicGPTConversionType } from 'musicgpt';

const client = new MusicGPTClient('your-api-key');

// Generate music from text
const music = await client.music_ai({
  prompt: 'A cheerful pop song about summer',
  music_style: 'pop',
  make_instrumental: false,
});

// Wait for completion
const result = await client.waitForCompletion(music.task_id, MusicGPTConversionType.MUSIC_AI);

console.log('Music generated!', result);

🔧 API Reference

Client Initialization

const client = new MusicGPTClient(apiKey, logLevel);

Parameters:

  • apiKey (string): Your MusicGPT API key
  • logLevel (optional): 'DEBUG' | 'INFO' | 'ERROR' (default: 'DEBUG')

Core Methods

🎵 Music Generation

const response = await client.music_ai({
  prompt: 'A relaxing jazz melody',
  music_style: 'jazz',
  lyrics: 'Optional lyrics here',
  make_instrumental: false,
  webhook_url: 'https://your-webhook.com/callback',
});

🎤 Voice Conversion

const response = await client.voice_changer({
  voice_id: 'voice-id-here',
  audio_url: 'https://example.com/audio.mp3',
  pitch: 0,
  remove_background: true,
});

🎧 Audio Cover Generation

const response = await client.cover({
  voice_id: 'voice-id-here',
  audio_url: 'https://example.com/song.mp3',
  pitch: 2,
});

🗣️ Text to Speech

const response = await client.text_to_speech({
  text: 'Hello, this is a test message',
  voice_id: 'optional-voice-id',
  language: 'en',
  gender: 'f',
});

🔍 Voice Search

// Get all voices
const voices = await client.getAllVoices(0, 20);

// Search for specific voices
const femaleVoices = await client.searchVoices('female', 0, 10);

⏳ Wait for Completion

const result = await client.waitForCompletion(
  taskId,
  conversionType,
  3000, // Poll interval (ms)
  300000, // Timeout (ms)
  1 // Verbose level (0-2)
);

Audio Processing

🔊 Denoise Audio

const response = await client.denoise({
  audio_url: 'https://example.com/noisy-audio.mp3',
});

📝 Audio Transcription

const response = await client.audio_transcription({
  audio_url: 'https://example.com/speech.mp3',
  language: 'en',
  translate: false,
  word_timestamps: true,
});

🔄 File Format Conversion

const response = await client.file_conversion({
  audio_url: 'https://example.com/audio.wav',
  target_sampling_rate: 44100,
  target_format: 'mp3',
  target_bit_depth: 16,
});

🎵 Music Analysis

// Extract key and BPM
const keyBpm = await client.extract_key_bmp({
  audio_url: 'https://example.com/song.mp3',
});

// Extract stems (vocals, instruments, etc.)
const stems = await client.extraction({
  audio_url: 'https://example.com/song.mp3',
  stems: ['vocals', 'instrumental', 'drums'],
});

✂️ Audio Cutter

const response = await client.audio_cutter({
  audio_url: 'https://example.com/audio.mp3',
  start_time: 10.5,
  end_time: 30.0,
  output_extension: 'mp3',
});

🎛️ Audio Mastering

const response = await client.audio_mastering({
  audio_url: 'https://example.com/audio.mp3',
  reference_audio_url: 'https://example.com/reference.mp3', // Required
  output_extension: 'wav',
});

⚡ Audio Speed Changer

const response = await client.audio_speed_changer({
  audio_url: 'https://example.com/audio.mp3',
  speed_change_factor: 1.25, // 0.25 to 4.0
  audio_extension: 'mp3',
});

🎹 Audio to MIDI

const response = await client.audio_to_midi({
  audio_url: 'https://example.com/audio.mp3',
  sonify_midi: true,
  save_note_events: false,
});

📈 Rate Limiting

The API has rate limits. The SDK automatically handles:

  • Rate limit errors with appropriate exceptions
  • Exponential backoff (when implemented)
  • Request queuing (planned feature)

⚠️ Error Handling

The SDK provides detailed error information with proper JSON formatting:

try {
  const result = await client.music_ai({
    prompt: 'Generate music',
  });
} catch (error) {
  console.error('API Error:', error.message);
  // Error messages include detailed JSON responses for debugging
}

Common Error Types:

  • INTERNAL_SERVER_ERROR - Server-side issues
  • 422 Unprocessable Entity - Invalid parameters
  • 404 Not Found - Endpoint not available
  • Rate limiting errors

📋 Supported Audio Formats

  • Input: MP3, WAV, FLAC, OGG, AAC, WEBM
  • Output: MP3, WAV, FLAC, OGG, AAC, WEBM
  • Sampling Rates: 8kHz to 192kHz
  • Bit Depths: 16-bit, 24-bit

Made with ❤️ by the MusicGPT team