Separating stereo buffers in individual mono buffers

Audio software developers forum.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Separating stereo buffers in individual mono buffers

Permanent link to this post Posted by Anish.kumar » Sun Jul 19, 2015 4:47 pm

Hello,

This is my first post in audacity. I have been using audacity a lot for all my android projects and now have come across a problem for which I need audio experts advice.

http://stackoverflow.com/q/31494841/3903331
I have succinctly posted the problem here but couldn't get any reply and reasons for that is Preety obvious as this should have been posted here.

Can anyone guide me in right direction?

Please let me know if I did any mistake in posting here.
Anish.kumar
 
Posts: 4
Joined: Sun Jul 19, 2015 4:40 pm
Operating System: Please select

Re: Separating stereo buffers in individual mono buffers

Permanent link to this post Posted by kozikowski » Sun Jul 19, 2015 7:34 pm

Page Not Found
This question was voluntarily removed by its author.

Koz
kozikowski
Forum Staff
 
Posts: 37937
Joined: Thu Aug 02, 2007 5:57 pm
Location: Los Angeles
Operating System: OS X 10.9 Mavericks

Re: Separating stereo buffers in individual mono buffers

Permanent link to this post Posted by Anish.kumar » Sun Jul 19, 2015 7:35 pm

I have moved the query to http://sound.stackexchange.com/question ... -and-right this place as this seems to be the right place to post audio related queries.
Anish.kumar
 
Posts: 4
Joined: Sun Jul 19, 2015 4:40 pm
Operating System: Please select

Re: Separating stereo buffers in individual mono buffers

Permanent link to this post Posted by steve » Sun Jul 19, 2015 8:55 pm

Anish.kumar wrote:this place as this seems to be the right place to post audio related queries.

I think that it would be more relevant to an Android forum. As far as I can tell your question is about the Android sound system and really has nothing to do with Audacity.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44629
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Separating stereo buffers in individual mono buffers

Permanent link to this post Posted by Anish.kumar » Sun Jul 19, 2015 9:03 pm

Hello,

I just wanted to know how does the audacity parses the raw pcm buffer and separate out left and right buffer?
I see the code in importPCM.cpp as below:

if (block) {
for(c=0; c<mInfo.channels; c++) {
if (mFormat==int16Sample) {
for(int j=0; j<block; j++)
((short *)buffer)[j] =
((short *)srcbuffer)[mInfo.channels*j+c];
}
else {
for(int j=0; j<block; j++)
((float *)buffer)[j] =
((float *)srcbuffer)[mInfo.channels*j+c];
}

channels[c]->Append(buffer, (mFormat == int16Sample)?int16Sample:floatSample, block);
}
From this i can see channel[0] will have left buffer and channel[1] will have right buffer. Is my understanding right i.e. alternate buffers 0, 2, 4, 6 will constitute left buffer and 1,3,5,7.. is right buffer?
If my understsanding is right dumping channel[0] in audacity should show me only mono stream instead of stereo which is happening currently. Please guide me.
Anish.kumar
 
Posts: 4
Joined: Sun Jul 19, 2015 4:40 pm
Operating System: Please select

Re: Separating stereo buffers in individual mono buffers

Permanent link to this post Posted by Anish.kumar » Mon Jul 20, 2015 4:08 pm

I now find the problem. Audacity goes by what you give as input i.e. in my case i was giving number of channels as 2 so probably that was the reason it was just displaying two channels with same mono data right? I have just one more question is that my separated out buffer size is 892kb but stereo buffer size is 1.73MB but both are playing for 10.313 seconds.How is this possible?
Anish.kumar
 
Posts: 4
Joined: Sun Jul 19, 2015 4:40 pm
Operating System: Please select


Return to General Audio Programming



Who is online

Users browsing this forum: No registered users and 4 guests