No description
Find a file
Konstantin Pereiaslov b11d67fa18
Version bump
2025-07-24 04:50:43 +03:00
imelody.d.ts First version 2025-07-23 18:54:10 -05:00
imelody.js First version 2025-07-23 18:54:10 -05:00
index.html First version 2025-07-23 18:54:10 -05:00
LICENSE Initial commit 2025-07-24 02:27:59 +03:00
package.json Version bump 2025-07-24 04:50:43 +03:00
README.md Update README.md 2025-07-24 04:50:25 +03:00

imelody-play

This library can play simple melodies in iMelody format using Web Audio API. iMelody format was used when sending messages via SMS.

Installation

npm add imelody-play

Example use

import {playIMelody} from "./node_modules/imelody-play/imelody.js";
playIMelody(`BEGIN:IMELODY
VERSION:1.2
FORMAT:CLASS1.0
BEAT:80
MELODY:c3c4;d2;c2;f2;e1;c3c4;d2;c2;g2;f1;c3c4;*5c2;a2;
END:IMELODY`
);

Note: browsers require a user interaction to play sound, in practice, you'll want to bind this to a click or a similar event.

See index.html for an example of a click event. Run npx serve . to run the example locally.