swar_demo.mp4
Swar is a command-line tool that converts any textual or code input into musical notes, generating MIDI files and optional music sheets. This project is ideal for creative data transmission, artistic audio encoding, or simply transforming messages into music.
- Converts plain text or code into musical notes
- Generates playable
.midfiles from input text - Optionally outputs printable MusicXML sheet music
- Supports special character encoding via custom note mapping
- Built with a clean and modular CLI using
click - Includes a built-in MIDI player
- Cross-platform (works on Windows, macOS, Linux)
- Easily installable via
pip install .
To install and use Swar, ensure you have Python 3.7+ installed.
-
Clone the repository:
git clone https://github.com/darshanC07/swar.git cd swar -
Install the project using pip:
pip install .
After installation, you can run Swar from any terminal: Introduction
swarThis prints the welcome message, logo, and basic help.
Convert Text to Music
swar musicfy "your message here"This creates a MIDI file named swar.mid in the current directory.
Options:
--output [filename]
Specify a custom output name (without .mid extension).
-ms
Save a MusicXML file (sheet music) along with the MIDI.
Examples:
swar musicfy "hello world" --output greeting -msPlay a MIDI File
swar playThis plays the most recently created swar.mid file.
You can also specify a custom file (without extension):
swar play greeting