Skip to main content

Unofficial UtaFormatix3 port for TypeScript.

Works with
This package works with Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
2 days ago (0.2.2)

utaformatix-ts / Unofficial Utaformatix3 wrapper for TypeScript

JSR

utaformatix-ts is an unofficial UtaFormatix3 wrapper for TypeScript. This library can parse, generate, and convert project files among singing voice synthesizer softwares.

Requirements

This library requires one of the following environments:

  • Deno
  • Node.js 20.0.0 or later
  • Bun
  • Browser environment

Installation

Please follow jsr documentation for installation instructions.

# Deno
deno add @sevenc-nanashi/utaformatix-ts

# Node.js (one of the below, depending on your package manager)
npx jsr add @sevenc-nanashi/utaformatix-ts
yarn dlx jsr add @sevenc-nanashi/utaformatix-ts
pnpm dlx jsr add @sevenc-nanashi/utaformatix-ts

# Bun
bunx jsr add @sevenc-nanashi/utaformatix-ts

Usage

Project#fromFormat converts a binary file to UtaFormatix Data.

import { Project } from "jsr:@sevenc-nanashi/utaformatix-ts";

const stdMidiData = await Deno.readFile("./standard.mid");
const result = await Project.fromStandardMid(stdMidiData);

// Exceptionally, parseUst allows multiple files to be passed. Each file represents a track.

const firstTrack = await Deno.readFile("./first_track.ust");
const secondTrack = await Deno.readFile("./second_track.ust");

const result2 = await Project.parseUst(firstTrack, secondTrack);

Project#toFormat converts UtaFormatix Data to a binary file.

import { Project } from "jsr:@sevenc-nanashi/utaformatix-ts";

const project = new Project(
  JSON.parse(await Deno.readFile("./standard.ufdata.json")),
);

const midResult: Uint8Array = await project.toStandardMid();
await Deno.writeFile("./standard.mid", midResult);

// generateUst and generateMusicXml returns multiple files. Each file represents a track.
const musicXmlResult: Uint8Array[] = await project.toMusicXml();
await Deno.writeFile("./first_track.musicxml", musicXmlResult[0]);
await Deno.writeFile("./second_track.musicxml", musicXmlResult[1]);

Lower level APIs are also available in /base.

import {
  generateMusicXml,
  parseStandardMid,
} from "jsr:@sevenc-nanashi/utaformatix-ts/base";

const stdMidiData = await Deno.readFile("./standard.mid");
const result = await parseStandardMid(stdMidiData);

const binary = await generateMusicXml(result);

License

This project is licensed under MIT License. See LICENSE for more information.

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @sevenc-nanashi/utaformatix-ts

Import symbol

import * as mod from "@sevenc-nanashi/utaformatix-ts";

Add Package

npx jsr add @sevenc-nanashi/utaformatix-ts

Import symbol

import * as mod from "@sevenc-nanashi/utaformatix-ts";

Add Package

yarn dlx jsr add @sevenc-nanashi/utaformatix-ts

Import symbol

import * as mod from "@sevenc-nanashi/utaformatix-ts";

Add Package

pnpm dlx jsr add @sevenc-nanashi/utaformatix-ts

Import symbol

import * as mod from "@sevenc-nanashi/utaformatix-ts";

Add Package

bunx jsr add @sevenc-nanashi/utaformatix-ts

Import symbol

import * as mod from "@sevenc-nanashi/utaformatix-ts";