forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Audio input from both GoCam/Talkman or Socom Microphones

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
mypspdev



Joined: 11 Jul 2007
Posts: 178

PostPosted: Thu Nov 01, 2007 12:26 am    Post subject: Audio input from both GoCam/Talkman or Socom Microphones Reply with quote

Hi to all!
Thanks in advance for your help, specially to funs of Audio Mechanica (Art's!) homebrew and audio input/output control.

I'm developing an application sending and receiving audio between two PSP using adhoc client-server connection and then video&audio streaming using GoCam.

Actually good results:
- audio input from Socom microphone is quicky transferred from one PSP to another at 5112 hz (telephony quality)
- video input from GoCam is quicky viewed on the other PSP using 160x120 frame size

Now I'd like to trasfer audio input from GoCam microphone.

My problem is the following:
Using Gocam this the instruction to capture audio buffers:

Code:
result = sceUsbCamReadMicBlocking(audiobuffer, sizeof(audiobuffer));


where:
u8 audiobuffer;


using Socom microphone the following variable is for capturing audio :

Code:

unsigned short audiobuffer[buffersize];


Well, finally, outputting buffer from Socom all sounds are clear and true:

Code:

ubuf[i].l = audiobuffer[i];
ubuf[i].r = audiobuffer[i];


But how can I output sounds as "short" from the incoming GoCam buffer Microphone as well as it is u8 type and not short?

Thanks, may be it is a stupid conversion, I'm sorry for my poor knowledge.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Nov 01, 2007 12:57 am    Post subject: Reply with quote

Well good work on what you've achieved so far.
I don't think that's been done yet. Always great to see a first.

The short data type is a 16 bit signed two's complement integer.
(lifted that definition off the net actually!)
Minimum value is -32768 and a maximum of 32767.
u8 is a plain old byte. 8 bits unsigned 0 to 255 (only 256 possible values).

You'll be able to copy the value of a byte to a short, but not the other way round.

If you're only learning, and it helps, you can make a new short
"anotherbuffer"
and copy either a u8 or short value to it, and then at the recieving end
you can copy the value from that back to a u8 or short variable type.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
mypspdev



Joined: 11 Jul 2007
Posts: 178

PostPosted: Thu Nov 01, 2007 1:26 am    Post subject: Reply with quote

Art wrote:
Well good work on what you've achieved so far.
I don't think that's been done yet. Always great to see a first.

yes! it's very good to see it works almost fine: two approches I've tested: continous 4096 sound buffer sending or "talk command" then "stop talk command" and send full buffer.
Both are well. Some problems I'm still having when both PSP are talking and sending (duplex mode...).
Quote:

The short data type is a 16 bit signed two's complement integer.
(lifted that definition off the net actually!)
Minimum value is -32768 and a maximum of 32767.
u8 is a plain old byte. 8 bits unsigned 0 to 255 (only 256 possible values).

ok!
Quote:

You'll be able to copy the value of a byte to a short, but not the other way round.
If you're only learning, and it helps, you can make a new short
"anotherbuffer"
and copy either a u8 or short value to it, and then at the recieving end
you can copy the value from that back to a u8 or short variable type.


something like, sender:
Code:

u8 audiobuffer[4096];
short anotherbuffer[4096];
result = sceUsbCamReadMicBlocking(audiobuffer, sizeof(Myaudiobuffer));
for (i=0; i<4096;i++) {
anotherbuffer[i]=(short*) audiobuffer[i];      
}
send(anotherbuffer);


receiving with audiocallback:
Code:

sample_t* ubuf = (sample_t*) buf;
short ReceiveBuffer[1024]
ubuf[i].l = ReceiveBuffer[i];
ubuf[i].r = ReceivedBuffer[i];
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon Nov 03, 2008 4:57 pm    Post subject: Reply with quote

Quote:

But how can I output sounds as "short" from the incoming GoCam buffer Microphone as well as it is u8 type and not short?

Thanks, may be it is a stupid conversion, I'm sorry for my poor knowledge.

Maybe it doesn't matter anymore, but you just write double the number of bytes into the buffer :D

BTW...
Talkman mic isn't the same as the camera mic.
If you've used the Talkman mic pls let me know...
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group