simai-sharp
v1.0.0
Published
TypeScript port of SimaiSharp - A parser and serializer for simai chart format used in maimai rhythm games
Maintainers
Readme
Simai-Sharp TypeScript
TypeScript port of SimaiSharp - A parser and serializer for the simai chart format used in the maimai
Current Status
✅ Production Ready (v1.0.0) - 100% Complete
- ✅ Lexical Analysis: Tokenizer fully functional
- ✅ Syntactic Analysis: Complete parser with all state readers
- ✅ Serializer: Basic implementation working
- ✅ File I/O: SimaiFile class for .txt/.maidata files
- ✅ Data Structures: All enums and classes converted
- ✅ Error Handling: Full exception system
Features
import { SimaiConvert, SimaiFile } from 'simai-sharp';
// Read from maidata file
const file = new SimaiFile('chart.txt');
console.log(file.getValue('title')); // Get metadata
const chartData = file.getValue('inote_1'); // Get chart
// Parse simai chart
const chart = SimaiConvert.deserialize(chartData);
console.log(chart.noteCollections.length);
console.log(chart.timingChanges[0].tempo);
// Serialize back
const simai = SimaiConvert.serialize(chart);Test Coverage (38 tests)
- SimaiFile (12 tests): File I/O, key-value parsing, UTF-8 support
- SimaiChart (7 tests): Basic parsing, tempo, holds, slides, touch notes
- Extended Tests (19 tests): Complex charts, decorators, round-trip serialization
Installation
npm install simai-sharp
# or
bun add simai-sharpDevelopment
# Install dependencies
bun install
# Build
bun run build
# Run tests
bun run test
# Run examples
bun run examples/test-parser.tsBasic Usage (Planned)
// Deserialize a simai chart string
const chart = SimaiConvert.deserialize('1,2,3,4');
// Serialize back to string
const simaiText = SimaiConvert.serialize(chart);Current API
While full parsing is being implemented, you can use the tokenizer and type definitions:
import { Tokenizer, Location, NoteGroup, NoteType } from 'simai-sharp';
// Tokenize simai notation
const tokenizer = new Tokenizer('1,2,3,4');
for (const token of tokenizer.getTokens()) {
console.log(token.type, token.lexeme);
}
// Create and manipulate chart structures
const location = new Location(0, NoteGroup.Tap);
console.log(location.toString()); // "1"Project Structure
src/
├── structures/ # Data structures (Note, Location, MaiChart, etc.)
├── internal/
│ ├── errors # Custom error classes
│ └── lexical-analysis/ # Tokenizer
├── SimaiConvert # Main API (in progress)
└── index # Main exportsAbout Simai Format
Simai is a text-based chart format for maimai charts. Learn more about the format at:
Original Project
This is a TypeScript port of SimaiSharp, originally written in C# for use in AstroDX.
License
MIT
