⌨️
Thock
Get Thock
  • About
    • ⌨️Description
    • 🚀Quick Start
    • ™️Third-Party information
    • Sample Scenes
      • Example_ScreenTypewriter-and-Soundpacks
      • Example_Type
      • Example_StringEvents
  • Documentation
    • Thock
    • Convert JSON to Soundpack
      • ConvertJsonToSoundpack
    • Utilities
      • StringEventListener
        • StringEventListener Component Tutorial
      • KeyPressEventReceiver
      • KeyPressEventSender
    • Scriptable-Objects
      • SoundPackSO
      • IntToKeyCodeTable
      • StereoAudioMapping
      • StringToKeycodeTable
    • Types
      • SoundMap
Powered by GitBook
On this page
  • Overview
  • Features
  • JSON Structure
  • Usage
  • Example Workflow
  1. Documentation

Convert JSON to Soundpack

Converts JSON Soundpacks to Thock soundpacks

Overview

The Convert JSON to Soundpack tool is a Unity Editor extension that helps you convert JSON files into SoundPack ScriptableObjects. This tool simplifies importing sound packs defined in JSON format into Unity, allowing for easy integration and management of sound assets.

Features

  • Convert JSON files into SoundPack ScriptableObjects.

  • Custom key mappings using an IntToKeyCodeTable.

  • Optionally copy sound files to the project directory.

  • Automatically generate fallback keys.

  • User-friendly GUI for configuration and execution.

JSON Structure

The JSON file should have the following structure:

jsonCode kopieren{
  "name": "Sound Pack Name",
  "numpad": true,
  "sound": "Sound File Path",
  "defines": {
    "1": ["Sound Name", "Fallback Sound Name"],
    "2": ["Sound Name", "Fallback Sound Name"],
    ...
  }
}

Example

jsonCode kopieren{
  "name": "MySoundPack",
  "numpad": true,
  "sound": "mySoundFile.wav",
  "defines": {
    "1": ["Sound1", "Fallback1"],
    "2": ["Sound2", "Fallback2"]
  }
}

Usage

Opening the Tool

  1. Open Unity.

  2. Go to the menu bar and select Tools > Thock > Convert Json To Soundpack.

  3. The Convert JSON to Soundpack window will appear.

Configuring the Tool

  1. Sound Pack JSON: Drag and drop your JSON file into this field.

  2. Int To KeyCode Table: Select the IntToKeyCodeTable scriptable object.

  3. Name Identifier: The JSON key that contains the sound pack name (default is "name").

  4. Key Identifier: The JSON key that contains the key mappings (default is "defines").

  5. Generate Fallback Keys: Toggle whether to generate fallback keys.

  6. Copy Sound File: Toggle whether to copy the sound file to the project directory.

Example Workflow

  1. Prepare JSON File: Create a JSON file with the appropriate structure.

  2. Open Tool: Open the Convert JSON to Soundpack tool from the Unity menu.

  3. Configure Settings: Set the necessary fields in the tool.

  4. Parse JSON: Click the parse button and wait for the confirmation message.

  5. Verify Output: Check the created SoundPack ScriptableObject in your project directory.

PreviousThockNextConvertJsonToSoundpack

Last updated 1 year ago