CLI
Requirements
- Node.js v20 or higher
Installation
npm install -g dill-pixel
Available Commands
Create a New Project
Create a new Dill Pixel project:
dill-pixel create my-project
Options:
--use-pnpm
- Use PNPM as package manager (recommended)--use-yarn
- Use Yarn as package manager
Example:
dill-pixel create my-game --use-pnpm
Update Dill Pixel
Update to the latest version:
dill-pixel update
Install Peer Dependencies
Install required peer dependencies:
dill-pixel install
Audio Tools
Convert Audio
Convert audio files to the correct format:
dill-pixel audio compress [input-directory]
Default input directory: ./src/assets/audio
Output will be placed in [input-directory]/output
Generate Captions
Generate caption files from CSV:
dill-pixel audio captions [input-directory] [output-directory]
Default paths:
- Input:
./src/assets/audio/captions
- Output:
./src/assets/json
Voiceover CSV Generation
Generate voiceover CSV files from your i18n locale files:
dill-pixel vo generate [input-directory] [output-directory]
Default paths:
- Input:
./src/locales
- Output:
./src/assets/audio/vo/csv
The tool supports parsing .js
, .ts
, and .json
locale files. It processes the following formats:
- Simple string values:
{ "greeting": "Hello world"}
Generated CSV output:
FILENAME LINE SCRATCH_VOICE SCRATCH_GENDER SCRATCH_LANGUAGE CAPTIONgreeting Hello world en-US-Wavenet-D female en-US Y
- Array of options (using pipe separator):
{ "greeting": "[Hello|Hi|Hey]"}
Generated CSV output:
FILENAME LINE SCRATCH_VOICE SCRATCH_GENDER SCRATCH_LANGUAGE CAPTIONgreeting_0 Hello en-US-Wavenet-D female en-US Ygreeting_1 Hi en-US-Wavenet-D female en-US Ygreeting_2 Hey en-US-Wavenet-D female en-US Y
- Dynamic replacements with options:
{ "greeting": { "replace": "Hello {name}", "replaceOpts": "[John|Jane|Alex]" }}
Generated CSV output:
FILENAME LINE SCRATCH_VOICE SCRATCH_GENDER SCRATCH_LANGUAGE CAPTIONgreeting_0 Hello John en-US-Wavenet-D female en-US Ygreeting_1 Hello Jane en-US-Wavenet-D female en-US Ygreeting_2 Hello Alex en-US-Wavenet-D female en-US Y
The generated CSV files will include the following columns:
FILENAME
- Unique identifier for the voice lineLINE
- The text to be voicedSCRATCH_VOICE
- Voice ID (default: en-US-Wavenet-D)SCRATCH_GENDER
- Voice gender (default: female)SCRATCH_LANGUAGE
- Voice language (default: en-US)CAPTION
- Caption flag (default: Y)
Text formatting:
<strong>text</strong>
is converted to*text*
<em>text</em>
is converted to_text_
- Other HTML tags are removed
Using Generated CSV Files with Google Text-to-Speech
The generated CSV files are formatted to work with Google Cloud Text-to-Speech service. Here’s how to use them:
-
Prerequisites:
- A Google Cloud account with Text-to-Speech API enabled
- Google Cloud credentials configured
-
CSV Format: The generated CSV files contain the necessary metadata for voice generation:
FILENAME
: Used as the output audio file nameLINE
: The text to be converted to speechSCRATCH_VOICE
: Google Cloud voice ID (e.g., ‘en-US-Wavenet-D’)SCRATCH_GENDER
: Voice gender preferenceSCRATCH_LANGUAGE
: Target language codeCAPTION
: Whether to generate captions (Y/N)
-
Example Workflow:
Terminal window # 1. Generate CSV files from your locale filesdill-pixel vo generate ./src/locales# 2. Use Google Cloud Text-to-Speech to generate audio files# Example using gcloud command (you'll need to adapt this for your specific setup)gcloud text-to-speech synthesize-speech \--voice-name=en-US-Wavenet-D \--text="$(cat path/to/generated.csv)" \--output-dir=./src/assets/audio/vo -
After Generation:
- Audio files will be created using the FILENAME from your CSV
- Generate captions using
dill-pixel audio captions
Version Information
Display the current version:
dill-pixel version
Project Structure
When creating a new project using dill-pixel create
, it will generate a standard project structure with all necessary configuration files. For more details on the project structure, see the Quick Start Guide
The easiest way to get started with Dill Pixel is to use the CLI to create a new project. Run the following command in your terminal:
npx dill-pixel create my-application
This will create a new directory called my-application with all the necessary files and dependencies pre-configured.
Using PNPM (Recommended)
npx dill-pixel create my-application --use-pnpm