npm.io
1.3.0 • Published 4d ago

@gui-chat-plugin/music

Licence
MIT
Version
1.3.0
Deps
4
Size
297 kB
Vulns
0
Weekly
115

@gui-chat-plugin/music

npm version

MusicXML sheet music plugin for GUI Chat applications. Displays and plays sheet music from MusicXML format.

Features

  • Display sheet music from MusicXML format
  • Audio playback with OpenSheetMusicDisplay and osmd-audio-player
  • Tempo control
  • Cursor following during playback

Installation

yarn add @gui-chat-plugin/music

Usage

Vue Integration
// In src/tools/index.ts
import MusicPlugin from "@gui-chat-plugin/music/vue";

const pluginList = [
  // ... other plugins
  MusicPlugin,
];

// In src/main.ts
import "@gui-chat-plugin/music/style.css";
Core-only Usage
import { executeMusic, TOOL_DEFINITION } from "@gui-chat-plugin/music";

// Show sheet music
const result = await executeMusic(context, {
  musicXML: "<musicxml-content>",
  title: "My Song",
});

API

MusicArgs
interface MusicArgs {
  musicXML: string;  // The music in MusicXML format
  title?: string;    // Optional title for the music piece
}
MusicToolData
interface MusicToolData {
  musicXML: string;
}

Dependencies

This plugin requires:

  • opensheetmusicdisplay: For rendering MusicXML as sheet music
  • osmd-audio-player: For audio playback

Development

# Install dependencies
yarn install

# Run demo
yarn dev

# Build
yarn build

# Lint
yarn lint

Test Prompts

Try these prompts to test the plugin:

  1. "Create sheet music for a simple C major scale"
  2. "Write a short melody in G major"
  3. "Generate sheet music for Twinkle Twinkle Little Star"

License

MIT

Keywords