Skip to content
Jogla edited this page Sep 6, 2025 · 25 revisions

Welcome to the Tonsmith wiki!

This wiki will gide you through the process of creating a soundpack compatible with Tonsmith.

Mod structure

A soundpack is basically a mod that contains and loads at least one TNSMI.pack (more on that later) function inside it.

To create a soundpack, one must create the following mod structure.

root (a folder inside your mods directory)
├ main.lua
├ manifest.json
└ assets
  ├ 1x
  │ ├ modicon.png?
  │ └ thumbnail.png?
  ├ 2x
  │ ├ modicon.png?
  │ └ thumbnail.png?
  └ sounds
    ├ ambientFire1.ogg?
    ├ ambientFire2.ogg?
    ... etc

Note

The entries marked with a question mark are optional.

manifest.json

This file tells steamodded that your mod exists and how to load it. The most barebones file should look like this.

{
	"id": "na",
	"name": "My soundpack",
	"author": ["Your name"],
	"description": "Soundpack description",
	"prefix": "na",
	"main_file": "main.lua",
	"priority": 0,
	"version": "1.0.0",
	"dependencies": [
		"tonsmith (>=1.2.1)"
	]
}

One should change the id and prefix of the mod, very importantly, as well as optionally the name, description and authors of the soundpack.

Note

The id and prefix tell steamodded how to identify your mod and whatever it creates. It is recommended to keep them the same and both between 3 and 5 characters long.

Important

This description won't be the one displayed in the soundpack selection menu, but rather when one opens the mod through steamodded's mod menu.

For a more complete guide on how to set up your manifest file, read the official SMODS wiki page

main.lua

This file will be the one loaded for your soundpack through TNSMI.Pack. Feel free to copy and paste this example:

TNSMI.Pack{ 
    name = "Name",
    description = {
        { -- Descriptions can be localized for different languages. 'en_us' is the code for english.
            lan = 'en-us',
            text = { -- The description can have multiple lines
                "Line 1",
                "Line 2",
            }
        }
    },
    sound_table = { -- Here is where one defines the sounds to replace.
        -- Each entry can have different fields, the only one being required is 'key',
        -- which points to the sound one wants to replace.
        { key = "ambientFire1" }, 
    }
}

Further details on how to utilize TNSMI.Pack below.

assets

This is a folder containing all assets (both sounds and thumbnail) for your soundpack. Inside it, create three folders: 1x, 2x and sounds.

  • The first two are where one places images, at normal and double the resolution. This is where one should place the soundpack's thumbnail, if any.
    The thumbnail should be 71x95 (the standard size of any given card) static image.
  • The sounds folder is where one should place all the sound files. It is optional for the filenames to be the same as the sound one is replacing, but recommended if one isn't experienced on making mods.

TNSMI.Pack

Note

One can make multiple packs within one mod by calling this function multiple times.

This function is used to register a soundpack. It takes 1 argument as a table (args).

  • name? - String. The name of the soundpack.
  • description? - Table. The description of the soundpack. Supports localization to an extent using the following structure:
description = {
    {
        lan = 'en-us', -- Language key. Defaults to 'en-us' if no localization exists for the current language.
        text = {
            "first line",
            "second line"
        }
    }
    -- Add as many entries as languages one wants.
}
  • authors? - Table/String array. A list of all authors of the soundpack. It is recommended to also include the authors of the original sounds.
  • mods? - Table/String array. A list of mods the soundpack replaces the sounds of. If one is only replacing vanilla sounds, the list should only contain 'vanilla'.
  • thumbnail? - String. A thumbnail to be displayed in-game. It should point towards a 71x95 image inside /assets/1x, which should be the same as 2x. It should exclude the file extension.
  • sound_table? - Table. An array of all sound names that are in the soundpack. It should exclude the file extension.
    • key - The sound key one is replacing
    • file? - The file used for the sound. If absent, key is used
    • extension = ".ogg"` - The file extension used for the sound.
    • prefix? - The prefix of the mod the sound originates from. Leave blank if is a vanilla sound.
    • req_mod - String. Used for modded sounds. Prevents the sound from being loaded if the specified mod isn't present.

For further information on the other parameters, check SMODS' documentation in SMODS.Sound. Template:

sound_table = {
    { key = "sound_key", prefix = "MyMod", extension = ".wav", file = "sound_file", pitch = 0.7, volume = 0.6, sync = false },
}

For the convenience of all users, a skeleton of this function is provided, containing all vanilla sounds.

TNSMI.Pack{ 
    name = "Name",
    description = {
        {
            lan = 'en-us',
            text = {
                "Description",
            }
        }
    }
    mods = {"Vanilla"},
    authors = {"Author"},
    sound_table = {
        { key = "ambientFire1", },
        { key = "ambientFire2" },
        { key = "ambientFire3" },
        { key = "ambientOrgan1" },
        { key = "button" },
        { key = "cancel" },
        { key = "card1" },
        { key = "card3" },
        { key = "cardFan2" },
        { key = "cardSlide1" },
        { key = "cardSlide2" },
        { key = "chips1" },
        { key = "chips2" },
        { key = "coin1" },
        { key = "coin2" },
        { key = "coin3" },
        { key = "coin4" },
        { key = "coin5" },
        { key = "coin6" },
        { key = "coin7" },
        { key = "crumple1" },
        { key = "crumple2" },
        { key = "crumple3" },
        { key = "crumple4" },
        { key = "crumple5" },
        { key = "crumpleLong1" },
        { key = "crumpleLong2" },
        { key = "explosion_buildup1" },
        { key = "explosion_release1" },
        { key = "explosion1" },
        { key = "foil1" },
        { key = "foil2" },
        { key = "generic1" },
        { key = "glass1" },
        { key = "glass2" },
        { key = "glass3" },
        { key = "glass4" },
        { key = "glass5" },
        { key = "glass6" },
        { key = "gold_seal" },
        { key = "gong" },
        { key = "highlight1" },
        { key = "highlight2" },
        { key = "holo1" },
        { key = "introPad1" },
        { key = "magic_crumple" },
        { key = "magic_crumple2" },
        { key = "magic_crumple3" },
        { key = "multhit1" },
        { key = "multhit2" },
        { key = "music1" },
        { key = "music2" },
        { key = "music3" },
        { key = "music4" },
        { key = "music5" },
        { key = "negative" },
        { key = "other1" },
        { key = "paper1" },
        { key = "polychrome1" },
        { key = "slice1" },
        { key = "splash_buildup" },
        { key = "tarot1" },
        { key = "tarot2" },
        { key = "timpani" },
        { key = "voice1" },
        { key = "voice2" },
        { key = "voice3" },
        { key = "voice4" },
        { key = "voice5" },
        { key = "voice6" },
        { key = "voice7" },
        { key = "voice8" },
        { key = "voice9" },
        { key = "voice10" },
        { key = "voice11" },
        { key = "whoosh_long" },
        { key = "whoosh" },
        { key = "whoosh1" },
        { key = "whoosh2" },
        { key = "win" }
    },
}

Note

DEPRECATED, applies to tonsmith v1.1.0 and older
Tonsmith crashes when loading a modded sound if the mod the sound replaces isn't loaded. To prevent that, you can use a local variable that is all vanilla sounds that your soundpack adds and use if statements to add/remove sounds from it.

Example:

local soundtable = {
    {key = "key", file = "file"},
    -- and so forth
}
if next(SMODS.find_mod("Mod1")) then 
    soundtable[#soundtable+1] = {key = "Mod1_snd", file = "Mod1_file"}
    soundtable[#soundtable+1] = {key = "Mod1_snd2", file = "Mod1_file2"}
    -- and so forth
end
if next(SMODS.find_mod("Mod2")) then 
    soundtable[#soundtable+1] = {key = "Mod2_snd", file = "Mod2_file"}
    soundtable[#soundtable+1] = {key = "Mod2_snd2", file = "Mod2_file2"}
    -- and so forth
end
-- and so forth
TNSMI.Pack{ 
    name = "Name",
    -- ... other parameters
    sound_table = soundtable
}

Clone this wiki locally