Add new sounds ?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Add new sounds ?

Post by Joubarbe » Sat, 4. Oct 14, 10:08

Hi,

I cannot find anything on this subject... Strange. Anyway, I've tried to register a new sound in the types\sounds.pck without result, so... How can I add new sounds into X3, in a way that I could call them with the "play sample" command ?

Thanks.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Thu, 9. Oct 14, 17:44

I had some trouble with that myself, Joubarbe. Apparently sounds has some additional requirements; beyond most types files.

If I recall correctly, I think that I had to package both the sound files and the sounds.pck in a .cat to make it work. You can look at the Detector package(s) for examples that work.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 9. Oct 14, 17:55

Oh ok, thanks DrBullwinkle !

And good to see you :)

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Thu, 9. Oct 14, 17:58

Keep up the good work, Joubarbe. Your work on generic missions sounds like fun.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Wed, 15. Oct 14, 16:53

You really don't have anything special in your Detector. Just sounds in the cat (in "s" folder) and a "play sample [integer]". But when I do that, it doesn't work, maybe it has something to do with the wav itself ? Is a special format required ?

Strange thing is that you don't even have the Sounds.pck file. It's like you didn't register your custom sounds.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 15. Oct 14, 17:58

Yeah I think that was all there was to it; just putting the sounds in the .cat. Some of the packages include a sounds.pck; others do not (they use vanilla sound IDs).

Regarding format, I have seen contradictory opinions on that. I followed an old tutorial that insisted on doing a final save with Windows Sound Recorder, because that is guaranteed of saving in the correct format. However, it does not make intuitive sense that that is the only way to get the correct format.

An easy test is to replace one of the vanilla wavs with your own. That removes sounds.pck from the test, and tests just your format.

Phraggah
Posts: 29
Joined: Fri, 30. Mar 12, 05:54
x3ap

Post by Phraggah » Thu, 16. Oct 14, 08:59

The sounds.pck file has been extremely finicky. If you've added your own pool (not replacing default sounds or using the custom sounds pool) I've noticed the game tends not to find them, as if there is a hardcoded limit to the numerical IDs sounds can have, and this limit I think is very low.

Have you tried adding your sound to pool 800 (I think that's the custom sounds pool)? If you add yours to one of the spots there and the sound still does not work then that probably means your problem is elsewhere.

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Thu, 16. Oct 14, 19:08

had a quick look but its a while ago i did this, i used the 800 range and you need to make sure its saved as below


Filename: 809.wav
File Type: 11025Hz, 8-bit, Stereo
File Format: Windows PCM
Windows PCM

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 16. Oct 14, 19:09

Thanks guys :)

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Sat, 18. Oct 14, 17:07

Ohh that is ****** stupid ; I have a sound from LU that I can play (11khz, 176kbps, mono), then when I try with my sound (same number, 11khz, 88kbps, mono - because I don't know how to be more precise) it does not work.

Seriously, how stupid are the guys who have thought of that ? It's pretty simple to play a single wav in any ****** dev language !

Anyway.... DrBullwinkle, when you said Windows Sounds Recorder, what did you mean exactly ? The thing that comes with windows only record from a mike and in wma.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Sat, 18. Oct 14, 17:28

OK, good. Mystery solved. Now all you need is the right format.

Windows Sound Recorder was a cool tool distributed with Windows for ... decades, I think. Sadly it was severely dumbed down in Win7 and Win8.

If you have a copy of XP somewhere, just copy sndrec32.exe. Use compatibility mode or Run as Admin to avoid the startup error.

If you don't have a copy of XP handy, I found sndrec32.exe in MatthewCCarter's post near the bottom of this page:

answers.microsoft.com/en-us/windows/forum/windows_7-pictures/windows-xps-sound-recorder-sndrec32exe-in-64-bit/ad0a6f3b-f3df-48cc-998a-59e0553241be?page=2
  • EDIT: Audacity should also be able to save in the correct format.
    The default save format of sndrec32 is: "PCM 22.050 kHz, 16 Bit, Mono"
    So use Audacity's "WAV (Microsoft) signed 16 bit PCM" format
Last edited by DrBullwinkle on Sat, 18. Oct 14, 17:56, edited 2 times in total.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Sat, 18. Oct 14, 17:36

I also have Audacity, not working :) Thanks, I'll try sound recorder.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Sat, 18. Oct 14, 17:43

You tried Audacity's "WAV (Microsoft) signed 16 bit PCM" format, yes?

Well, good luck. You should be able to get it working now.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Sat, 18. Oct 14, 17:50

Hurray ! It works with Audacity ; I hadn't tried 16bit because LV said that the correct format was 8bit. It doesn't work with sound recorder, but only with Audacity though.

Egosoft works in mysterious ways !

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Sat, 18. Oct 14, 17:53

Excellent!
  • The default save format of sndrec32 is: "PCM 22.050 kHz, 16 Bit, Mono"

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Sun, 19. Oct 14, 10:14

Hmm... It's not as easy as just export the sound via Audacity. No, in fact, you must first save your .wav into 16 bit mono 11khz with a crappy software of your choice (sound recorder for instance) THEN load it into Audacity and export it again using the only .wav option this software has.

EDIT : instead of Sound Recorder, I use Freemake Audio Converter. It works fine too.

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Sun, 19. Oct 14, 13:01

PCM signed 16-bit 44100, 705 kbps, mono.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”