Page 1 of 1

### Total Samples in Stereo Recordings, Used in Hex Code

Posted: Sun Dec 24, 2017 6:54 am
I'm trying to mod music into a game, and I'm very new to editing code, files, and audio overall, though i have made substantial progress in the past 3 weeks. Specifically, I'm trying to put music from other video games into one called "Dragon's Dogma: Dark Arisen", for PC. The game uses .arc files, which I have unpacked (with an arctool) and opened with a hex editor (HxDen), and begun to edit. I'm using this pastebin as a guide: http://pastebin.com/raw/hTBxweH8, and this google sheet for reference: https://docs.google.com/spreadsheets/d/ ... 1211595786.

The game requires, in the hex code, that you input the size of the file, the total samples of a given track, and for it to loop properly, the total samples of the timestamp for the loop start, and the total samples of the timestamp for the loop end. When I load the game after repacking and pasting the .arc into the game's files, as well as pasting the track into its proper place, the game produces no sound. I assumed this had to do with the total samples, as I don't entirely know how they work yet, so that was the most likely factor of human error.

(TL;DR for people who don't care about/don't understand the rest)From what I understand, the way to get the total samples of an audio track is to multiply the Kilohertz rate by the length of the song in seconds. So a song with a rate of 48,000 Hz (48 kHz) that is 1'30", or 90 seconds long, would have a total of 4,320 samples. Now I'm not sure, but it would make sense if a stereo track would have double the samples, due to it being double the sound (i think). Let's continue with the example of 90 seconds and say that we would get 8,640 total samples in a stereo track of the same length.

When I edited the hex code with 4,320 samples (after converting it to hex code of course) and loaded the song to play in-game, no sound played, for the entire duration. I also verified multiple times that the loop points were set accordingly as well. I then edited the hex code according to 8,640 samples, and received ear-shattering static at random intervals. Not the best sound, but after two days of silence, you bet I was happy to hear it. Anyways, I'm running out of possibilities to my knowledge here, so I'd love some confirmation on my sample calculation, or any other feedback.

### Re: Total Samples in Stereo Recordings, Used in Hex Code

Posted: Sun Dec 24, 2017 11:21 am
SirKibbler wrote:From what I understand, the way to get the total samples of an audio track is to multiply the Kilohertz rate by the length of the song in seconds

Almost. It's the "sample rate" (samples per second) time the length in seconds.

If the sample rate is 48 kHz, that is 48,000 samples per second.
That means that in one second there are 48000 samples.
In two seconds there are 48000 x 2 = 96000 samples
in 90 seconds there are 48000 x 90 = 4320000 samples.

In Audacity, you can see the length of the track / selection by setting the time units to "samples" in the Selection Toolbar. Note that the number of samples shown there is based on the "Project Rate", which is usually the same as the sample rate of the track, but can be different.

SirKibbler wrote:Now I'm not sure, but it would make sense if a stereo track would have double the samples

I've only skimmed through the pastebin document, but it looks to me like they are saying "the length" as number of samples, in which case the length (hence the number of sample) is the same regardless of the number of channels. On the other hand, you could be right and they may mean "the number of samples of audio data (total)".