#745·adarkroom

一定程度上解决在选择了语言的情况下没有声音的方法 | A method to address the lack of sound when a language is selected to some extent

Author: waji-ruiCreated Aug 27, 2025Updated Feb 11, 2026

For English readers, you can go to the bottom of the page for the English text. Please note that the translation may not be 100% accurate; please refer to the Chinese version for reference. 注意,翻译不一定100%准确,请以中文版为准。

中文

截至目前(2025年8月27日),此问题(在选择了语言的情况下没有声音)仍然在我自己部署项目时出现。以下是仅供参考的解决办法,适合编程小白或者不太追求完美的人士。

原因:

在选择了语言”language“的情况下,你的网址应该会变成类似于"*/adarkroom/?lang=zh_cn"的形式,而这会导致js文件访问的audio音频文件夹变成"*/adarkroom/?lang=zh_cn/audio"并尝试访问里面的音频文件。默认情况下js文件应该在"*/adarkroom/audio"中查找音频,但显然,语言的选择混乱了文件的路径,js文件找不到音频。

不完美的解决办法:

幸好在script文件夹中,有一个名叫audioLibrary.js的文件存储了所有音频文件的位置并专门被用来访问目标音频,默认打开情况如图

Image

解决思路是,既然默认直接访问”audio/*.flac“,那么在选择语言的情况下,只要在访问音频时先返回上一级目录,也就是先前是"*/adarkroom/?lang=zh_cn",返回上一级就变成"*/adarkroom",那么js文件就能访问"*/adarkroom/audio"了,从而避开”?lang=zh_cn“。 解决办法是,把所有的”audio/*.flac“修改成”../audio/*.flac“,那么js文件在找音频时会默认返回上一级。如图。

Image

那么恭喜,现在你就能够在选择任意语言的情况下享受音频了。

不足:

因为这样子修改会导致访问音频时默认从上一级目录访问,所以在默认情况下(也就是不选择语言,即网址不包含“?lang=zh_cn"部分时),我们反而不能听到声音,也就是说,您必须选择语言(即在网址中添加上”?lang=zh_cn")才能够听见声音。

声明:

本Issue所提供的方法仅供参考,不作为您实际部署网站的依据,且此方法存在不足之处,介意者请不要使用。因为此方法导致您的网站出现问题,我不承担任何责任。我无比喜欢 adarkroom 这个项目,并希望它能够感染更多的玩家,让更多玩家享受这美好的游戏。

English

As of today (August 27, 2025), this issue (no sound when a language is selected) still occurs when I deploy the project myself. Below is a workaround for reference, suitable for beginners or those who do not mind an imperfect solution.

Cause

When you select a language using the ?lang=xx parameter, your URL becomes something like:

*/adarkroom/?lang=zh_cn

This causes JavaScript files to attempt to load audio files from:

*/adarkroom/?lang=zh_cn/audio

instead of the expected default path:

*/adarkroom/audio

As a result, the JavaScript code cannot find the audio files, since the ?lang=... query parameter interferes with the correct file path.

Imperfect Workaround

Fortunately, in the script folder there is a file named audioLibrary.js that stores the paths to all audio files and is specifically used to access them. By default, the paths look something like this :

Image

The idea is: since the audio should normally be accessed via audio/*.flac, when a language parameter is present in the URL, we need to go one directory up first.

For example:

With ?lang=zh_cn, the URL is */adarkroom/?lang=zh_cn

Going one level up leads to */adarkroom, which allows JS to correctly find */adarkroom/audio.

Solution: Change all instances of

audio/*.flac

to

../audio/*.flac

This ensures that when accessing audio, the script first goes up one level before looking for the audio folder.

Image

Result

Congratulations — now you can enjoy audio while using any selected language.

Limitation

However, this change introduces a drawback: When no language is selected (i.e., the URL does not contain ?lang=zh_cn), the audio will not play. In other words, you must select a language (by adding ?lang=xx to the URL) in order to hear sound.

Disclaimer

The method described in this Issue is for reference only and is not intended as an official solution. It comes with limitations, so please do not use it if you require a perfect deployment.

I take no responsibility if this workaround causes problems with your website.

That said, I truly love the A Dark Room project and sincerely hope it can reach more players, so that even more people can enjoy this wonderful game.

Source: doublespeakgames/adarkroom