• Welcome to SC4 Devotion Forum Archives.

Custom Query Sound Effects?

Started by BlackDragonAJ89, November 11, 2009, 11:50:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BlackDragonAJ89

Yes, another question...

Okay, so let's say I have some buildings made up, like say some Cafes, Mini Marts, and a few Paper Shuffling Offices at the moment. However, one thing I don't like is that I get stuck with the game's generic Commercial sounds. I see that you can make your own query sounds and give them a hex number ID to be used by the lot, but I don't know how to convert the sounds into a DAT file or anything like that... could somebody explain this for me please?

Travis

I've attached the tutorial I use for it- saves me having to explain it step by step. :P Let me know if you have any questions about it. ;)

cogeo

Also dl my HSR Stations Essentials from the STEX. It contains a custom query and some sound files. My GSHR Stations pack uses this depenency, and features sounds of three types (query, ambient and alarm). That is you hear a sound when you move close to the station (these are the ambient sounds), periodically some "alarm" events are triggered (announcements, in this case) and of course you hear a different sound when you query them.

This example is a bit more compicated, as each of the above sound effects actually consists of three different sounds (played randomly). This is done through the use of HLS file, which can group multiple TRK files under one query ID. For example, for residential lots you hear (one out of) three different bell sounds every time you query them. HLS files can be edited manually (in the HEX editor), for example if you need a HLS file grouping two TRK files (instead of three), search sound.dat for such a HLS file (with two entries), make a local copy (and give it a different ID of course), and overtype the bytes containing the TRK references.

BlackDragonAJ89

I'll check into that to see what I can do... I downloaded your tutorial, Travis...

crushedcar

Travis-I've tried your (well actually pegasus's) tutorial but have run into a bit of a road block. I have successfully inserted the wav file in my lot file as well as managed to place a trk file in as well. However, when I load up my game and test the lot no sound will play. I have double-checked to make sure that trk refers to the Instance ID of my wav and that the exemplar points to the Instance ID of my trk file.

Also do I need to be assigned a ID value range for my wav and trk files?

jmyers2043

@ crushed car - if you say you've checked it and are sure the IID's are correct - then my first 'wonder if' is whether your track is recorded loud enough.

I've used the tutorial before and it will work if you follow the steps and do not deviate. I don't make too many custom sounds but usually have to do them several times until I get the audio level where I want it to be.

Jim Myers  (5th member of SC4 Devotion)

Andreas

One thing I've noticed: If you give the WAV and the TRK file the same IID, the sound won't play properly if you query a couple of lots within a short time. Maybe the game is using an internal ID buffer or something, and it checks for the ID of the next sound that is activated while the first one is still playing. It's been a while since I toyed with TRK files, but some of those properties can be used to adjust the volume and speed of the sound as it plays in the game. Unfortunately, I don't know if those properties have been deciphered and documented somewhere, so it's pretty much trial and error.
Andreas

RippleJet

Quote from: Andreas on November 13, 2009, 04:16:02 AM
Unfortunately, I don't know if those properties have been deciphered and documented somewhere, so it's pretty much trial and error.

Unless somebody unknown has made some private investigations and findings, everything that's known should be documented here: TRK

BlackDragonAJ89

Well, I'm not sure how to define everything about TRK files, but I was able to get my buildings to work the custom sounds quite well (and I even got a set of doorbells up for my Corrupted homes, as well as to working on others). I have though, found that these values on certain lines tend to kick out a workable result for custom query noises:

Field 0: 2
Field 23: 22000
Field 24: 1000

All other fields except for the XA instance (in this case, the sound) are blank. I was also basing this off of Andrea's query settings...

Anyway, I got another question, although this one is gonna sound really stupid: Where's good collection of good quality sounds for free? I've got some good ones so far, but I need to find some barnyard animal sounds and some better traffic noise collections. Anyone know where I can find some? =P

RippleJet

Quote from: Andreas on November 13, 2009, 04:16:02 AM
If you give the WAV and the TRK file the same IID, the sound won't play properly if you query a couple of lots within a short time.

Andreas, why haven't you told me this before... ::)
I just realised I've got that problem with the custom sound files for BSC Functional Seaports and AC Functional Airports.


Quote from: BlackDragonAJ89 on November 13, 2009, 10:31:00 AM
Field 0: 2
Field 23: 22000
Field 24: 1000

As far as I know, Field 0 has the value 2 for all TRK files out there...
For the other fields, it doesn't seem as they have any meaning at all...
changing them has no effect as far as I know... the sound always plays in the game anyways.
There are even lots of in-game TRK files lacking both those fields.

BlackDragonAJ89

Well, when I messed with fields 23 and 24, the sound for my paper shuffler offices could play properly when I queried them. At the values I first got them as, the sound wasn't even playing or audible (considering it uses a combination of paper shuffling, keyboard typing, the dreaded dial up connection tone, and a printer, all loud enough). It wasn't until I used those levels though that the sounds all worked properly (all the buildings that used the sound could be queried over and over again and the sound didn't cut out or anything like that).

RippleJet

Could Field 23 be the sampling rate (in kHz)? :-\

BlackDragonAJ89

You might have a point there... But then wouldn't need a value of 22050 then for optimal results? (not that anything sounds bad when I tested them, for instance, all the door bells sounded fine even though I had to transpose one up to F)

crushedcar

I managed to figure out my problem as well. Hopefully, the first one is the hardest (I'd think so because after the first one you have a point of reference). The troubleshooting tips on simpeg should be part of the tutorial in my opinion.

RippleJet

Quote from: BlackDragonAJ89 on November 13, 2009, 12:52:33 PM
You might have a point there... But then wouldn't need a value of 22050 then for optimal results? (not that anything sounds bad when I tested them, for instance, all the door bells sounded fine even though I had to transpose one up to F)

That's why I've thought it doesn't have any meaning...

There is one (and only one) ingame TRK file having field 23 at 22050...
Group ID = 0xAA4D1930, Type ID = 0xA9F14C47

It's pointing at an HLO (Hit List), Type ID = 0x89F14B36
That hit list contains 12 Type ID's pointing to XA files with screaming sounds,
all of which have a sampling rate of 22,050 kHz.

nerdly_dood

Could I use a similar method to change the siren tones of SC4 emergency vehicle sirens? I'm sure I can find MP3s or WAVs of suitable tones online... it's just a matter of putting them into the game.

And since this involves REPLACING the siren tones, might I be able to keep the same IIDs, rather than changing them as Travis' tutorial suggests?
My days here are numbered. It's been great and I've had a lot of fun, but I've moved on to bigger and better things.
—   EGO  VOBIS  VADELICO   —
Glory be unto the modder and unto the fun and unto the city game!

Andreas

Quote from: RippleJet on November 13, 2009, 12:04:33 PM
Andreas, why haven't you told me this before... ::)

Heh, you didn't ask. ;) I think I've mentioned this here and there, but it's been a while since I created custom sounds last time. IIRC, I had playback speed issues (resulting in a high-pitched sounds) once, but by changing Field 23 to the actual sample rate of the sound, it seemed to work fine.
Andreas

jmyers2043

QuoteThe troubleshooting tips on simpeg should be part of the tutorial in my opinion.

Do you have a link? may save us other folk some time doing searches at Pegs place... Thanks.   ;) 
Jim Myers  (5th member of SC4 Devotion)

tamorr

   That will not be too difficult to find as it is in the Tutorial section, but here is the link anyway that I believe you are refering to..

Custom Sounds

Hope that is the correct one. :)
  "It is wiser to think about your actions before doing them, but be warned One must act quickly before another takes action for you."
  "Knowledge may be Power, but it is how you use that Knowledge that makes One Powerful."
  "I am a Philosopher, Punnist, Poet, and Rambler so keep in mind I think ahead and backwards to point where communication is sometimes not completely understood, even if Enlish is my primary language, it doesn't mean I know it well N proper."
  "Always do your best to acheive your goals and Dreams one at a time."
"Patience is a virtue."

RippleJet

That tutorial was originally posted on Simtropolis, and is still available there:
http://www.simtropolis.com/forum/messageview.cfm?catid=42&threadid=49433


Quote from: Andreas on November 13, 2009, 01:58:04 PM
IIRC, I had playback speed issues (resulting in a high-pitched sounds) once, but by changing Field 23 to the actual sample rate of the sound, it seemed to work fine.

If you can change the pitch by changing Field 23, then you should probably also be able to change the volume somehow.
Looking at certain LEV files (which I have no idea what they are) in sound.dat,
there's a field called vol which contains values between 0 and 1,024 (usually the latter).

Since Field 24 in the ingame TRK files has values ranging between 0 and 1,024,
I'd suggest Field 24 is indeed the volume (with 1,024 being maximum).
I guess some testing could verify this...