JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q47137F
  • License MIT

A javascript library for Smule's mobile API

Package Exports

  • smule.js
  • smule.js/dist/index.cjs
  • smule.js/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (smule.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Smule API

initially hard coded inside of smule-desktop, but i've decided to release it separately too.

HEAVY WIP --- HOBBY PROJECT

This project is in a usable state, although many things are subject to change. Expect major updates, re-implementations, renames, or breaking changes, without a major version change.

Check some parts of the roadmap, or report issues here

Installing

This project is currently hosted on npm, therefore all major package manager are able to install it

npm install smule.js / pnpm install smule.js / bun install smule.js

How to use?

!!! Structure may differ version-to-version, as i tend to be indecesive when it comes to placing certain functions

The library exports a Smule class, for the mobile api, and a SmuleDotCom class, for the website api. Generally speaking, the mobile api is more powerful than the website one.

It is structured based on "fake objects", therefore account-related functions will generally be found under Smule.account.

import { Smule, SmuleUtil } from "smule.js"

const smule = new Smule()
// Login as a guest
smule.account.loginAsGuest().then(async () => {
    // Fetch the main songbook page
    const songbook = await smule.songs.fetchSongbook()

    // Fetch a specific arrangement
    const song = await smule.songs.fetchOne("some_smule_arrangement_id")

    // Get the mp3 file url
    const mp3url = SmuleUtil.getFilesFromArr(song.arrVersion).song_file

    // Fetch a specific arrangement's time-synced lyrics and/or pitches automatically
    const { lyrics, pitches, type } = await smule.songs.fetchLyricsAndPitches("some_smule_arrangement_id")
})

// Login with an account
smule.account.login("your@email.com", "yourPass").then(async () => {
    // Fetch a published performance
    const { performance } = await smule.performances.fetchOne("some_smule_performance_id")

    // Comment on a performance
    const response = await smule.social.createComment(performance.performanceKey, "hello from javascript!")
})

... and much more! Check out the main Smule file for all available interactions.

P.S. Naming schemes, just like in smule-desktop, aren't stabilised. In some places, arrangements will be mentioned as songs. This will be fixed in future updates, eventually (maybe :3)