Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Audio and memblocks... can someone help??

Author
Message
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 27th Sep 2003 16:08
Hi all, im working on a voice chat application for my fps game and although some people say its impossible with the currrent version of dbpro, i have already managed simple send and recieve with minimal delay. The only problem is, the audio isnt compressed so it uses alot of bandwidth. My method is simple, im using make memblock from sound and vice versa. What i want to know is, when i convert a sound to a memblock, is the wav header included at the beggining of the memblock??? I want to downsample the audio before i convert it from a memblock back to a sound but i need to know if the wav header is included. Thank you.

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 27th Sep 2003 22:05
No the .wav header isn't included but there's a header that looks like this:
4 Bytes: Bits per Sample
4 Bytes: Frequency
4 Bytes: Number of Samples

(unless it has changed from DBClassic)

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 28th Sep 2003 03:24
so if i was to remove a byte every other byte, would i effectivly half the sample rate?

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 28th Sep 2003 04:55
Given the origanal audio data is 16 bit 44100 Hz
That would reduce the bitrate from 16 bit to eight bit (that is if you delete the least important byte of each word). In order to half the sample rate from 44100 to 22050 Hz you would have to delete every other word of the audio data.
BTW, I forgot to mention: The second 4 bytes of the header, the part that the DB help calls "Frequency" is actually the sample rate.

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 28th Sep 2003 05:12 Edited at: 28th Sep 2003 05:15
this is what im doing to read the memblock header...

load sound "c:test.wav",1
make memblock 1,11000
record sound 1,1000
wait 1000
stop recording sound
make memblock from sound 1,1
bits=memblock dword(1,1)
rate=memblock dword(1,5)
samples=memblock dword(1,9)
print bits
print rate
print samples
wait key

is this correct??
i get 285213016 for bits, 43 for rate and -2147483648 for samples... hmmm looks like they are audio samples coz they change each time i record.. *edit* sorry the values stay the same each time

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 28th Sep 2003 13:07
are these values signed or unsigned?

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 28th Sep 2003 15:05 Edited at: 28th Sep 2003 15:05
it's memblock dword(BankNo,Offset) and offset starts at 0 so it's

Bitrate = memblock dword(1,0)
Samplerate = memblock dword(1,4)
Length = memblock dword(1,8)

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 28th Sep 2003 15:33 Edited at: 28th Sep 2003 15:34
ok im getting closer... 88200 for bitrate, 11025 for samplerate and 0 for samples.. maybe they are in wrong order but values look better.. (8bit,11khz,mono). if i load a 16bit,22khz,stereo wav and record, i still get same values. ive also niticed only the first 10 bytes stay the same. is there no way we can get a specification for memblocks?

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 28th Sep 2003 16:03
Obviously the header structure has changed in DBPro.
You could email lee (lee@thegamecreators.com).

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 29th Sep 2003 03:35
cool thanx for your help.. ill do that

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |

Login to post a reply

Server time is: 2024-09-21 01:06:52
Your offset time is: 2024-09-21 01:06:52