Audio input from both GoCam/Talkman or Socom Microphones

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
mypspdev
Posts: 178
Joined: Wed Jul 11, 2007 10:30 pm

Audio input from both GoCam/Talkman or Socom Microphones

Post by mypspdev »

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: Select all

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


where:
u8 audiobuffer;
using Socom microphone the following variable is for capturing audio :

Code: Select all

unsigned short audiobuffer[buffersize];
Well, finally, outputting buffer from Socom all sounds are clear and true:

Code: Select all

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.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
mypspdev
Posts: 178
Joined: Wed Jul 11, 2007 10:30 pm

Post by mypspdev »

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...).
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!
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: Select all

u8 audiobuffer[4096];
short anotherbuffer[4096];
result = sceUsbCamReadMicBlocking(audiobuffer, sizeof(Myaudiobuffer));
for &#40;i=0; i<4096;i++&#41; &#123;
anotherbuffer&#91;i&#93;=&#40;short*&#41; audiobuffer&#91;i&#93;;		
&#125;
send&#40;anotherbuffer&#41;;
receiving with audiocallback:

Code: Select all

sample_t* ubuf = &#40;sample_t*&#41; buf;
short ReceiveBuffer&#91;1024&#93;
ubuf&#91;i&#93;.l = ReceiveBuffer&#91;i&#93;;
ubuf&#91;i&#93;.r = ReceivedBuffer&#91;i&#93;;
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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.
Post Reply