https://github.com/garcia/simfile
A modern simfile parsing & editing library for Python 3
https://github.com/garcia/simfile
dance-dance-revolution python simfile sm ssc stepmania
Last synced: about 2 months ago
JSON representation
A modern simfile parsing & editing library for Python 3
- Host: GitHub
- URL: https://github.com/garcia/simfile
- Owner: garcia
- License: mit
- Created: 2013-04-02T18:06:44.000Z (about 13 years ago)
- Default Branch: main
- Last Pushed: 2025-01-30T22:48:38.000Z (over 1 year ago)
- Last Synced: 2025-01-30T23:26:17.817Z (over 1 year ago)
- Topics: dance-dance-revolution, python, simfile, sm, ssc, stepmania
- Language: Python
- Homepage:
- Size: 1.08 MB
- Stars: 63
- Watchers: 8
- Forks: 7
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README

A modern simfile parsing & editing library for Python 3.
Full documentation can be found on **[Read the Docs](https://simfile.readthedocs.io/en/main/)**.
## Features
* Supports both SM and SSC files
- [Format-agnostic API for reading & writing simfiles](https://simfile.readthedocs.io/en/main/reading-writing.html)
- [SM ↔︎ SSC conversion](https://simfile.readthedocs.io/en/main/autoapi/simfile/convert/index.html)
* [Timing data support](https://simfile.readthedocs.io/en/main/timing-note-data.html#reading-timing-data)
- [Beat ↔︎ song time conversion](https://simfile.readthedocs.io/en/main/timing-note-data.html#converting-song-time-to-beats)
- Handles BPM changes, stops, delays and warps
- Accepts "split timing" from SSC charts
* [Note streams from charts](https://simfile.readthedocs.io/en/main/timing-note-data.html#reading-note-data)
- [Algorithms for grouping jumps & hold/roll head/tail notes](https://simfile.readthedocs.io/en/main/timing-note-data.html#handling-holds-rolls-and-jumps)
- [Flexible note counting functions](https://simfile.readthedocs.io/en/main/timing-note-data.html#counting-notes)
- [Timing data integration](https://simfile.readthedocs.io/en/main/timing-note-data.html#combining-notes-and-time)
* Fully typed, documented, and tested API
## Installation
**simfile** is available on PyPI:
```bash
pip3 install simfile
```
## Quickstart
Load simfiles from disk using `simfile.open` or `simfile.load`:
```python
>>> import simfile
>>> springtime = simfile.open('testdata/Springtime/Springtime.ssc')
>>> springtime
>>> with open('testdata/nekonabe/nekonabe.sm', 'r') as infile:
... nekonabe = simfile.load(infile)
...
>>> nekonabe
```
Use lowercase attributes to access most common properties:
```python
>>> springtime.artist
'Kommisar'
>>> springtime.banner
'springbn.png'
>>> springtime.subtitle = '(edited)'
>>> springtime
```
Alternatively, use uppercase strings to access the underlying dictionary:
```python
>>> springtime['ARTIST']
'Kommisar'
>>> springtime['ARTIST'] is springtime.artist
True
>>> list(springtime.keys())[:7]
['VERSION', 'TITLE', 'SUBTITLE', 'ARTIST', 'TITLETRANSLIT', 'SUBTITLETRANSLIT', 'ARTISTTRANSLIT']
```
Charts are stored in a list under the `.charts` attribute and function similarly to simfile objects:
```python
>>> len(springtime.charts)
9
>>> chart = springtime.charts[0]
>>> chart
>>> list(chart.keys())[:7]
['CHARTNAME', 'STEPSTYPE', 'DESCRIPTION', 'CHARTSTYLE', 'DIFFICULTY', 'METER', 'RADARVALUES']
```
## Developing
**simfile** uses Pipenv for dependency management. Activate the environment:
```bash
pipenv shell
```
To run the unit tests:
```bash
py -m unittest
```
To build the documentation:
```bash
docs/make html
```