Touhou Patch Center:BGM modding/zh-hans: Difference between revisions

From Touhou Patch Center
Jump to navigation Jump to search
No edit summary
(Updating to match new version of source page)
 
(14 intermediate revisions by 2 users not shown)
Line 9: Line 9:
* MP3 (.mp3)<br />只有当你别无选择,且你修改过的BGM过于冷门或太老以至于它从未以另一种格式发布时才使用该格式。<br />此格式最难完成曲目循环,且不可在≥TH07的游戏中被二次补丁。
* MP3 (.mp3)<br />只有当你别无选择,且你修改过的BGM过于冷门或太老以至于它从未以另一种格式发布时才使用该格式。<br />此格式最难完成曲目循环,且不可在≥TH07的游戏中被二次补丁。


<div class="mw-translate-fuzzy">
所有thcrap支持的ZUN制STG(th06~th16.5)均可以使用上述格式。
所有thcrap支持的ZUN制STG(th06~th16.5)均可以使用上述格式。
</div>


<div class="mw-translate-fuzzy">
[https://discord.thpatch.net/ 想要更多的格式支持?请通过Discord告诉我!]——Nmlgc
[https://discord.thpatch.net/ 想要更多的格式支持?请通过Discord告诉我!]——Nmlgc
</div>


=== 关于补丁叠加 ===
=== 关于补丁叠加 ===
Line 33: Line 37:
每一首原曲可以被两个BGM文件替换(补丁)掉:一首引子曲文件,命名和原文件一样;以及一首循环节曲文件,在原来的扩展名前额外加入 <tt>.loop</tt> 。<br />那么,对于TH06的标题曲,如果是OGG文件,这两个文件就是 <tt>th06_01.ogg</tt> 和 <tt>th06_01.loop.ogg</tt>。<br />
每一首原曲可以被两个BGM文件替换(补丁)掉:一首引子曲文件,命名和原文件一样;以及一首循环节曲文件,在原来的扩展名前额外加入 <tt>.loop</tt> 。<br />那么,对于TH06的标题曲,如果是OGG文件,这两个文件就是 <tt>th06_01.ogg</tt> 和 <tt>th06_01.loop.ogg</tt>。<br />
循环在程序内部处理,只需在当前播放的文件播放完后倒回去重放即可,thcrap忽略来自游戏本身或循环点MOD的任何循环值。<br />
循环在程序内部处理,只需在当前播放的文件播放完后倒回去重放即可,thcrap忽略来自游戏本身或循环点MOD的任何循环值。<br />
这意味着你可以省略.loop文件,将整个曲目放入引子文件,这样thcrap将只循环该文件。否则在引子文件播放后讲无限循环.loop文件中的曲子。
这意味着你可以省略.loop文件,将整个曲目放入引子文件,这样thcrap将只循环该文件。否则在引子文件播放后将无限循环.loop文件中的曲子。


如果你有无损的源文件,那么,在将无损转化为两个OGG之前,最好先把该文件切成两个文件,以免最后导出的OGG出现音质损耗。
如果你有无损的源文件,那么,在将无损转化为两个OGG之前,最好先把该文件切成两个文件,以免最后导出的OGG出现音质损耗。
Line 40: Line 44:


===怎样使 MP3 文件也能循环播放===
===怎样使 MP3 文件也能循环播放===
For your first MP3, double-check whether the audio editor you want use for loop cutting actually supports the LAME extension for gapless MP3. (GoldWave v6.35 and Audacity 2.3.0 don't.) To do this, convert the MP3 to a FLAC or WAV using something that does (I used foobar2000 v1.4), and check whether your editor shows the same amount of silence at the beginning of both the FLAC/WAV and the MP3.<br />
对于MP3文件,仔细检查用于循环剪切的音频编辑器是否真的支持无间隙MP3的LAME扩展(已知GoldWave v6.35 Audacity 2.3.0 不支持)。要做到这步,将MP3转码为FLAC或WAV(我是用foobar2000 v1.4转的),然后检查编辑器中,对于FLAC/WAV文件和MP3文件,两者开头的空白是否一样长。<br />
If it doesn't, always convert to a FLAC/WAV file to "apply" the removal of the MP3 pre-gap, and use that converted file to determine the loop start/end samples. (After the loop works, you'd just throw away that lossless file.)
如果不一样,则必须每次编辑前用原来的MP3转一个FLAC/WAV来去除MP3预置空白的干扰,并总是使用FLAC/WAV文件来定位循环头和循环尾。(当然,编辑完就可以扔掉这个无损文件了)
Then, use [[:File:pcutmp3.zip|pcutmp3]] on the command line to perform sample-accurate cutting.
然后,使用命令行工具 [[:File:pcutmp3.zip|pcutmp3]] 进行精确的循环节裁剪。


是的,很不幸,你需要Java才能执行这个操作。没有Java,mp3DirectCut将'''不会'''工作。<s>好了,还有谁想要用MP3的?</s>
但是很不幸,你需要Java才能执行这个操作。没有Java,mp3DirectCut将'''不会'''工作。<s>好了,还有谁想要用MP3的?</s>


<tt>java -jar pcutmp3.jar --crop 1:0-123,1:123-456 "C:\path\to\the\original.mp3"</tt> with 123 being the loop start, and 456 being the loop end sample.<br />
<tt>java -jar pcutmp3.jar --crop 1:0-123,1:123-456 "C:\path\to\the\original.mp3"</tt> → 123作为循环头,456作为循环尾<br />


<div class="mw-translate-fuzzy">
===注意事项以及ZUN bug===
===注意事项以及ZUN bug===
You can purchase fixes for all of those! 如果你感兴趣,请联系Nmlgc!
You can purchase fixes for all of those! 如果你感兴趣,请联系Nmlgc!
</div>


* TH06(红魔乡)是唯一的BGM支持任意码率、任意比特深度、任意声道数的游戏。
* TH06(红魔乡)是唯一的BGM支持任意码率、任意比特深度、任意声道数的游戏。


* TH06: Performance on track switches could be improved a bit.
* TH06(红魔乡):音轨切换的性能能提升一点。


* TH09(花映冢):确保你修改的标题曲一开始有至少0.3秒的空白。出于某种原因,游戏总是希望在正式切换到关卡对话前前播放一小段标题BGM。:zun:
* TH09(花映冢):确保你修改的标题曲一开始有至少0.3秒的空白。出于某种原因,游戏总是希望在正式切换到关卡对话前播放一小段标题BGM。:zun:


* TH11: Similar issue, but with the Stage 6 theme: The game starts playing a few milliseconds of it when entering the stage, then pauses playback, and only resumes it ~4.9 seconds later.
* TH11(地灵殿):同上,但只针对6面道中曲:游戏会在进入6面关卡时播放几毫秒,然后突然暂停,再从曲目时间轴的4.9秒后继续播放曲目。


* TH13: Performance when switching to the trance tracks and back could be improved a bit.
* TH13(神灵庙):音轨切换的性能能提升一点。


<div lang="en" dir="ltr" class="mw-content-ltr">
===Touhou BGM changing for dummies===
A simplified step-by-step tutorial
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
1.Open your thcrap folder and create a new folder. Name it as you wish.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
2.Create a new folder within that new folder that you just created and name it if you feel like doing it.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
3.Insert your audio file in the folder (the folder inside the folder)
'''IMPORTANT''' You must use the correct naming scheme otherwise the game won't read it correctly. Use [https://docs.google.com/spreadsheets/d/14-DAv89VNzIXPM2q4mLBJXUIck_K1fWNuBLo9cF_kaA/edit#gid=0] for naming.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
4. '''IMPORTANT''' Make sure the audio file is in .flac format, with 44100Hz sample rate and 16-bit sound depth otherwise it won't work. Audacity is a recommended program for all those tasks.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
5.Go into the following location (still in thcrap folder, NOT THCRAP INSIDE GAME FOLDER) thcrap -> config and open the .js file containing game data you
wish to edit. The following file starts with
'''''{ 
  "console": false,
  "dat_dump": false,
  "patches": [
    {'''''
'''''IMPORTANT''''' Keep in mind how you named your game configuration (ex. if you want to replace an audio track in IN, make sure you are editing IN game configuration)
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
6.Add this line into the .js file :
</div>
   
<div lang="en" dir="ltr" class="mw-content-ltr">
},
{
  "archive": "*insert name of the folder/insert the name of the folder"
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
and make sure after everything is done that it's ended with:
</div>
  <div lang="en" dir="ltr" class="mw-content-ltr">
<nowiki>}
]
}</nowiki>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
7. Run your game and it should be working.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
''Note: In future games, the sampling rate might not be required to be 44100Hz and 16bit sound depth but I cannot confirm this statement.
''
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''''Still not working? Mail me (ratchet12663@gmail.com) or find me on discord (d12trg)'''''
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
== For Tasofighters (TH13.5, TH14.5, TH15.5) ==
== For Tasofighters (TH13.5, TH14.5, TH15.5) ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
[https://aocf.koumakan.jp/User:VasteelXolotl From VasteelXolotl's AoCF Wiki Page]<br />
[https://aocf.koumakan.jp/User:VasteelXolotl From VasteelXolotl's AoCF Wiki Page]<br />
</div>


The above includes example music replacement packs.
<div lang="en" dir="ltr" class="mw-content-ltr">
The above link includes example music replacement packs.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Music replacements are fully client-side and do not affect netplay in any way. You also don't actually touch the game's files, as this is a "softmod" through thcrap.
Music replacements are fully client-side and do not affect netplay in any way. You also don't actually touch the game's files, as this is a "softmod" through thcrap.
   
   
===1) Setup===
===1) Setup===
Make a new folder under thcrap's directory. Name it whatever you want, I just went with "bgm155" for simplicity.<br />
Make a new folder under thcrap's "repos" directory. Name it whatever you want, I just went with "bgm155" for simplicity.<br />
In that folder, make another called "th155", then under that one make "data", then "bgm". Go back to the main thcrap folder for now.
In that folder, make another called "th155", then under that one make "data", then "bgm". Go back to the main thcrap folder, then go into the "config" folder.
   
   
Somewhere in there should be a .js file named after your default configuration. If you haven't messed with anything when installing the english patch, it should be "en.js". Copy and paste it. Rename the copy to "bgm155.js". Open it in a text editor of your choice.
Somewhere in there should be a .js file named after your default configuration. If you haven't messed with anything when installing the english patch, it should be "en.js". Copy and paste it. Rename the copy to "bgm155.js". Open it in a text editor of your choice.
   
   
The opened file should look similar to this<br />
The opened file should look similar to this<br />
https://cdn.discordapp.com/attachments/475336678379356172/475356364903022593/1.PNG<br />
https://cdn.discordapp.com/attachments/475336678379356172/658734848982253579/1.PNG<br />
Add your patch to this. Throw it in after all the other ones to prevent any issues. Make the file look more or less like this and save it.<br />
Add your patch to this. Throw it in after all the other ones to prevent any issues. Make the file look more or less like this and save it.<br />
https://cdn.discordapp.com/attachments/475336678379356172/475356367188787235/2.PNG
https://cdn.discordapp.com/attachments/475336678379356172/658734850970484736/2.PNG
   
   
Now find your th155 thcrap shortcut and once again copy-paste it. Rename it to something convenient. Right click it and click Properties, then go into the Shortcut tab in the window that shows up. At the end of the Target field, change "en.js" to "bgm155.js". Press OK.
Now find your th155 thcrap shortcut (in the main thcrap folder) and once again copy-paste it. Rename it to something convenient. Right click it and click Properties, then go into the Shortcut tab in the window that shows up. At the end of the Target field, change "en.js" to "bgm155.js". Press OK.
   
   
You've got everything set up. Neat.
You've got everything set up. Neat.
Line 86: Line 169:
===2) Actually replacing music===
===2) Actually replacing music===
Each theme has 3 files - two .ogg files (one of which is simply just the music to play in-game, and the other is a 20-second preview for the stage select) and an .sfl file containing loop metadata for the in-game theme.<br />
Each theme has 3 files - two .ogg files (one of which is simply just the music to play in-game, and the other is a 20-second preview for the stage select) and an .sfl file containing loop metadata for the in-game theme.<br />
Rename them to fit AoCF's file names. For convenience, here they are<br />
Rename them to fit AoCF's file names. For convenience, [https://pastebin.com/KaC3s2vV here] they are.<br />
https://pastebin.com/KaC3s2vV .
   
   
Remember all those folders you made? Go down to the "bgm" folder and place the files you want there. Boom, you did it.
Remember all those folders you made? Go down to the "bgm" folder and place the files you want there. Boom, you did it.
Line 109: Line 191:
   
   
===4) Custom loop points===  
===4) Custom loop points===  
Use Egor's sfl-loop tool [[File:sflloop_v2.zip]].
Use Egor's [[:File:sflloop_v2.zip|.sfl loop tool]].
</div>
 
[[Category:Project overview]]

Latest revision as of 21:58, 13 February 2024

对于上海爱丽丝幻乐团制游戏

(以下内容直接抄自Discord)

支持的文件格式

越上面的格式越优先被读取。

  • FLAC (.flac)
    理想情况下,你已经获得了一个无损格式的修改过的BGM,FLAC支持允许你直接向你的玩家提供这种格式。
  • Ogg Vorbis (.ogg)
    目前而言压缩率和音质之间的最佳折衷格式。限制16位。
  • MP3 (.mp3)
    只有当你别无选择,且你修改过的BGM过于冷门或太老以至于它从未以另一种格式发布时才使用该格式。
    此格式最难完成曲目循环,且不可在≥TH07的游戏中被二次补丁。

所有thcrap支持的ZUN制STG(th06~th16.5)均可以使用上述格式。

关于补丁叠加

  • 如果应用了多个BGM补丁,在应用下一个补丁之前,BGM补丁的优先级会按照上面的格式顺序重新排列。这意味着即使你把MP3补丁先打上了,也会被原本低优先级的FLAC格式的补丁覆盖。
  • 循环节文件必须和引子文件在同一个补丁包里,并使用相同的文件格式。

文件名格式

Splashman制作的BGM表(谷歌文档)中查找data filename列中查找名称。
也可以在thcrap_log.txt中使用Ctrl+F搜索 flac > ogg > mp3 确保你拿到了对应的名字。

文件层级

你可以把BGM文件放在补丁根目录或者特定游戏的目录。一般情况下是放在补丁目录的。
特别的,对于Player's Score(疮痍曲),在TH10~TH12中应用请命名为 th10_17 ,在≥TH12.8中应用则命名为 th128_08 ,且必须放置于补丁根目录才能覆盖不止一个游戏。当然,如果只想改特定游戏的疮痍曲,可以把文件放置于特定游戏的目录。 even in addition to putting a generic file into the patch root.
Also, for consistency with later games, BGM mods for TH06 don't go into a separate bgm/ subdirectory, contrary to what the original files might suggest.

对于补丁而言,如果你同时提供无损和有损格式的BGM补丁,建议采用如下格式命名和制作补丁:

  • <补丁名>_base: 改过的图和音乐室曲评,只提供MP3全曲,依赖补丁base_tsa
  • <补丁名>: 由无损格式转换出的OGG格式,依赖补丁<补丁名>_base
  • <补丁名>_lossless: 无损格式。依赖补丁<补丁名>_base

循环播放

每一首原曲可以被两个BGM文件替换(补丁)掉:一首引子曲文件,命名和原文件一样;以及一首循环节曲文件,在原来的扩展名前额外加入 .loop
那么,对于TH06的标题曲,如果是OGG文件,这两个文件就是 th06_01.oggth06_01.loop.ogg
循环在程序内部处理,只需在当前播放的文件播放完后倒回去重放即可,thcrap忽略来自游戏本身或循环点MOD的任何循环值。
这意味着你可以省略.loop文件,将整个曲目放入引子文件,这样thcrap将只循环该文件。否则在引子文件播放后将无限循环.loop文件中的曲子。

如果你有无损的源文件,那么,在将无损转化为两个OGG之前,最好先把该文件切成两个文件,以免最后导出的OGG出现音质损耗。

如果某些情况下你不希望曲子自动循环,曲子应该在一次播放后结束播放,这相当于“循环一段短暂的沉默”。在相应的.loop文件中放入4秒的空缺音频是最有效的选择。

怎样使 MP3 文件也能循环播放

对于MP3文件,仔细检查用于循环剪切的音频编辑器是否真的支持无间隙MP3的LAME扩展(已知GoldWave v6.35 和 Audacity 2.3.0 不支持)。要做到这步,将MP3转码为FLAC或WAV(我是用foobar2000 v1.4转的),然后检查编辑器中,对于FLAC/WAV文件和MP3文件,两者开头的空白是否一样长。
如果不一样,则必须每次编辑前用原来的MP3转一个FLAC/WAV来去除MP3预置空白的干扰,并总是使用FLAC/WAV文件来定位循环头和循环尾。(当然,编辑完就可以扔掉这个无损文件了) 然后,使用命令行工具 pcutmp3 进行精确的循环节裁剪。

但是很不幸,你需要Java才能执行这个操作。没有Java,mp3DirectCut将不会工作。好了,还有谁想要用MP3的?

java -jar pcutmp3.jar --crop 1:0-123,1:123-456 "C:\path\to\the\original.mp3" → 123作为循环头,456作为循环尾

注意事项以及ZUN bug

You can purchase fixes for all of those! 如果你感兴趣,请联系Nmlgc!

  • TH06(红魔乡)是唯一的BGM支持任意码率、任意比特深度、任意声道数的游戏。
  • TH06(红魔乡):音轨切换的性能能提升一点。
  • TH09(花映冢):确保你修改的标题曲一开始有至少0.3秒的空白。出于某种原因,游戏总是希望在正式切换到关卡对话前播放一小段标题BGM。:zun:
  • TH11(地灵殿):同上,但只针对6面道中曲:游戏会在进入6面关卡时播放几毫秒,然后突然暂停,再从曲目时间轴的4.9秒后继续播放曲目。
  • TH13(神灵庙):音轨切换的性能能提升一点。

Touhou BGM changing for dummies

A simplified step-by-step tutorial

1.Open your thcrap folder and create a new folder. Name it as you wish.

2.Create a new folder within that new folder that you just created and name it if you feel like doing it.

3.Insert your audio file in the folder (the folder inside the folder) IMPORTANT You must use the correct naming scheme otherwise the game won't read it correctly. Use [1] for naming.

4. IMPORTANT Make sure the audio file is in .flac format, with 44100Hz sample rate and 16-bit sound depth otherwise it won't work. Audacity is a recommended program for all those tasks.

5.Go into the following location (still in thcrap folder, NOT THCRAP INSIDE GAME FOLDER) thcrap -> config and open the .js file containing game data you wish to edit. The following file starts with {

 "console": false,
 "dat_dump": false,
 "patches": [
   {

IMPORTANT Keep in mind how you named your game configuration (ex. if you want to replace an audio track in IN, make sure you are editing IN game configuration)

6.Add this line into the .js file :


},

{
 "archive": "*insert name of the folder/insert the name of the folder"

and make sure after everything is done that it's ended with:

} ] }


7. Run your game and it should be working.


Note: In future games, the sampling rate might not be required to be 44100Hz and 16bit sound depth but I cannot confirm this statement.

Still not working? Mail me (ratchet12663@gmail.com) or find me on discord (d12trg)

For Tasofighters (TH13.5, TH14.5, TH15.5)

The above link includes example music replacement packs.

Music replacements are fully client-side and do not affect netplay in any way. You also don't actually touch the game's files, as this is a "softmod" through thcrap.

1) Setup

Make a new folder under thcrap's "repos" directory. Name it whatever you want, I just went with "bgm155" for simplicity.
In that folder, make another called "th155", then under that one make "data", then "bgm". Go back to the main thcrap folder, then go into the "config" folder.

Somewhere in there should be a .js file named after your default configuration. If you haven't messed with anything when installing the english patch, it should be "en.js". Copy and paste it. Rename the copy to "bgm155.js". Open it in a text editor of your choice.

The opened file should look similar to this
1.PNG
Add your patch to this. Throw it in after all the other ones to prevent any issues. Make the file look more or less like this and save it.
2.PNG

Now find your th155 thcrap shortcut (in the main thcrap folder) and once again copy-paste it. Rename it to something convenient. Right click it and click Properties, then go into the Shortcut tab in the window that shows up. At the end of the Target field, change "en.js" to "bgm155.js". Press OK.

You've got everything set up. Neat.

2) Actually replacing music

Each theme has 3 files - two .ogg files (one of which is simply just the music to play in-game, and the other is a 20-second preview for the stage select) and an .sfl file containing loop metadata for the in-game theme.
Rename them to fit AoCF's file names. For convenience, here they are.

Remember all those folders you made? Go down to the "bgm" folder and place the files you want there. Boom, you did it.

3) Changing in-game music titles

So you changed Marisa's theme to the objectively superior one, switched Nitori's theme to Aya's or something else entirely. There's one small problem, though - the music title doesn't match. You wanna fix that? Sure you do, or else it'll keep bugging you for all eternity.

In the "bgm" folder, make a new file called "bgm.csv.jdiff". Open it in a text editor of your choice. Remember the numbers in brackets in the other paste? They'll come in handy now. Open a curly bracket in the first line. In the second line, type in the number of the theme you want to change in quotes, then a colon and another curly bracket, e.g "2": {

In the next line, type in "7": "[track title]"

If you want to change the name of the arranger/composer as well, you can do it as such in the next line: "8": "[composer name]"

Afterwards, close the curly bracket in the next line with }. Repeat the above as many times as necessary, then add another }. You're done. Here's my jdiff file, if you need a reference
jdiff.PNG

4) Custom loop points

Use Egor's .sfl loop tool.