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.

Code Snippets / [DBP] mix 2 wav samples

Author
Message
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 22nd Jun 2009 01:06 Edited at: 22nd Jun 2009 01:07
hi below is a function to mix 2 16 bit mono wav files



nvidia geforce 9500gt + amd athlon 64
windows xp pro.
Uberdroid
17
Years of Service
User Offline
Joined: 6th Apr 2007
Location:
Posted: 25th Jun 2009 07:15
Thanks! What do you use it for? It would be great to make a tracker program with DB!
chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 2nd Jul 2009 23:59
seeing though you liked that one heres another where you can cut out a section from a sample in milliseconds .



I was making a sample editor , but its starting to get difficult lol , will keep at it though.

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd Jul 2009 14:30 Edited at: 3rd Jul 2009 14:30
I'm not sure it's a good idea to simply add the 2 values together. For one thing it might be signed data, so you'll get crazy results if you used a signed with a non-signed sample, and probably weird results with signed samples anyway.

See if your data reads in at 2 high a value, that will exceed the DWORD range, and you'd end up with broken sample data. What I suggest is adding the 2 data values together, then divide that by 2 to get the average - this is probably not how it should be done.

Really, I think you'd have to check the data to see if adding the samples would affect the DWORD range - which it probably would unless your samples are really quiet. I would step through the data and work out the highest dword, then using that as a scale, work out how much to multiply the values by to normalize. This would keep your sample in the DWORD range,


Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2024-11-22 01:11:08
Your offset time is: 2024-11-22 01:11:08