* Return to the Main Page

Music-Related Utilities


Touhou Project BGM Extractor - an English GUI utility by NamelessLegacy written in C (visual studio build, source code included!). Supports all Windows Touhou games and a few others. Easily understandable and highly configurable; song playback and comment display, automatic translation downloading from the independent Touhou Wiki, data files for individual games, multiple ways of specifying intervals, built-in tagging in either Japanese or English and flac/ogg/mp3 encoding. Seems like it supersedes all other utilities made so far.

thbgmextractor - a Japanese GUI utility written in C# (visual studio build, source code included!). It has the ability to produce loops and fade-out, with a diagram visualising it. It also has configurable hooks for encoders like lame, oggenc and wma. Uses standard titles_thXX.txt data files, supports th06 and above.

thbgmtowav - a Japanese/English commandline tool by T. Solamarle written in C (gcc build, source code not included). It has the ability to produce loops, fade-out and silence. Uses standard titles_thXX.txt data files, supports th07 and above (and th06 after some hacking). Needs to have the thbgm.dat file in the same directory and extracts into the same directory. The output file name format is thbgm_XX.wav; ignores names in data file. Does not handle the extended titles file format (w/ input file names).

Thbgm-tool - a bundle of simple specialized commandline binaries to rip out bgm from th07, th07.5, th08 and th09 bgm data files. The author is unknown, C source code is available for the th09 extractor. They have the ability to produce loops and fade-out. Doesn't use any config files, all data is hardcoded. Those binaries that generate Japanese filenames need to run under the Japanese Locale to work properly.

Brightmoon - a generic touhou data file extractor w/ GUI; source code included, author unknown. Can be used to crack open the packed SWR/th105b.dat and UNL/th123b.dat, which store the soundtrack as Ogg Vorbis audio and Soundforge loop metadata. Can be combined with th105towav.php / th123towav.php, oggdec and thbgmtowav to produce looped output.


thplay - 東方蓄音機 (Touhou Gramophone) (Japanese)

bgmforall - BGM For All Version 1.1 By 野风信子 (Chinese)

THxxBGM - 東方BGM Player (Japanese)

Other utilities

th08bgm_patch - Binary patcher to fix several audio glitches in Imperishable Night's BGM file (source code included)

thbgmchg - BGM changer

thplay Data Convert - Create a custom bgm.dat file for thplay

Data Files

There is a common format for files that store information about BGM names and their positions in thbgm.dat files. The usual naming convention is titles_thXX.txt.

Here are some sources of these files:


Aside from a few special cases, all Touhou BGMs are meant to loop infinitely. Since no wave-based format I know of lets you specify looping rules, they are stored in separate files. The instructions themselves are essentially an offset into the wave data stream to mark the beginning of the loop, and a length value (or alternatively, end position). If the loop does not reach the end of the file, the part after the loop will never play.

Here's a brief description of how each game stores its loop data:


  • wave files in bgm/*.wav
  • loops in 紅魔郷MD.dat/*.pos
    <start sample>.4b <end sample>.4b

TH07 and above (Team Shanghai Alice games)

  • wave data in thbgm.dat, loops in th<xx>.dat/thbgm.fmt
    • Format: { <waw name>.16b <start offset>.4b <???>.4b <intro length>.4b <total length>.4b 0x0100020044ac000010b102000400100000000000 }.52b* <zeroes?>+


  • wave files and loop data in th075bgm.dat/*.wav (Brightmoon archive)
  • loop data is saved with special RIFF chunks at the end of each wave file
    • Format: <RIFF header>.40b <wave data size>.4b <wave data>.<wave data size>b <junk>.16b <start sample>.4b <junk>.40b <loop section length>.4b

TH10.5 and above (Tasofro games)

  • ogg files in th<xxx>b.dat/*.ogg, loops in th<xxx>b.dat/*.sfl; loops are stored inside Soundforge metadata, some tracks don't have loops
    • Format: <junk>.28b <start sample>.4b <junk>.40b <length in samples>.4b

All wave files are 44100 Hz 16 bit stereo. When dealing with sample-based loop data (th06/tasofro games), multiply the sample values by 4 and add the size of the wave header (0x2C = 44 bytes) when calculating byte offsets.

Other Utilities

  • Vertical Play - Allows play on vertically-oriented monitors. Works with Mountain of Faith, Subterranean Animism, and Undefined Fantastic Object.
  • Patch Making/Extraction Tools - Link to patch making and extraction tools download
  • anm2png Converts anm files in Touhou dat files to png images. The anm2png program is a console application; a Windows application written in c# is included that produces a batch file to run the program for every anm file in a folder.
  • Control Changes - This rar folder contains a script that can be used to change the in-game controls for the game. All instructions are included in the script. Use the hotkey program to compile the script. Place the .exe inside of your Touhou games folder and run the script you created. If you need help using the script feel free to email me at Credits to Spexwood for creating the script.
  • Touhou Sky Arena: Tension Bar Maker - A program to help make tension bars for Touhou Sky Arena.

Game Specific

Embodiment of Scarlet Devil

  • Retexture Patch Ver 0.3 by Emarrel. The patch replaces all the images in EoSD with cleaner, higher resolution images. The sprites have also been updated with those from the newer games. Read the readme before installing, as it contains some important information. This patch is packaged with the English translation patch as well.

Perfect Cherry Blossom

  • No-Hitbox Patch. Removes the visible hitbox. Read the readme before patching.

Imperishable Night

Mountain of Faith

  • No Hitbox Patch by Emarrel. Removes the visible hitbox. Read the readme before patching.

Subterranean Animism

  • No Hitbox Patch by Emarrel. Removes the visible hitbox. Read the readme before patching.

External Links