Sound & Music

Moderators: Sephiroth
Number of threads: 597
Number of posts: 1201

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
blending audio data Posted by unclepauly on 5 Jun 2009 at 2:45 AM
hello,

can someone tell me how to blend audio data (its voice data actually) from a byte array point of view ? so lets say ive got 2 arrays of audio data, and each array is 10 bytes long:

array1 -> 0x01, 0x02, 0x03, 0x04, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05
array2 -> 0x06, 0x05, 0x09, 0x05, 0x04, 0x10, 0x0A, 0x06, 0x0B, 0x03

what i want to do is to blend/combine/merge these into one array. note i dont want to concatenate one onto the other, to give me a 20 byte array, i want to play both arrays at the same time. for example, if array one was someone saying 'hello', and array 2 was someone saying 'goodbye', then in the merged array you would hear both people saying 'hello' and 'goodbye' at the same time. is this even possible ?

a bit of background on what im doing - im making a VOIP system using the WAV api in a C# app. im using the GSM610 codec, and the result is that the average bytes per second recorded from the microphone is 6500 bytes. because the buffer size is 650 bytes, so each client sends 650 bytes of voice data to the server every 10th of a second, thus resulting in 6500 bytes per sec.

the server must then forward these 650 bytes onto all other clients. so if only 2 clients are connected to the server, this is fine, because client A sends 650 bytes to the server, and the server forwards these onto client B. in this case client B is playing client A's voice data at the same rate as client A recorded it. however when a third client C is introduced, now both client A and client C are sending 650 bytes to client B = 1300 bytes. if another client connected, this would now be 650 * 3 = 1950 bytes and so on....but each client only processes 6500 bytes per second, hence things start to sound wrong.

so i need a way of merging each set of 650 bytes into one set of 650 bytes, and then send this merged set to each client. is this performed using a bitwise operation on each byte for example ?


Report
Re: blending audio data Posted by darasan on 17 Jun 2009 at 8:03 PM
Hi,

Mixing (or blending) digital audio is just the sample-by-sample sum of the audio values. So if you have two buffers of audio data, create a third buffer of the same size and for each position in the new buffer, add the 2 values of the other buffers together and copy this new value into the third buffer. The third buffer will then contain the 2 channels mixed together.

Out of interest, what API / library are you using to process audio data?

Regards,

Daire
Report
Re: blending audio data Posted by Merriaminho on 6 May 2010 at 1:21 PM
Would Adobe Audition work?



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.