Return to LanScape's home page Go back a page...       Active TopicsActive Topics   Display List of Forum MembersMember List   Knowledge Base SearchSearch   HelpHelp  RegisterRegister  LoginLogin

LanScape VOIP Media Engine™ - Technical Support
 LanScape Support Forum -> LanScape VOIP Media Engine™ - Technical Support
Subject Topic: Record phone line question - using portaudio library Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
gcamp0730
Intermediate
Intermediate


Joined: June 12 2006
Location: United States
Posts: 35
Posted: December 06 2006 at 12:37pm | IP Logged Quote gcamp0730

I'm looking at using the StartPhoneLineRecording API and had a question regarding the PHONE_LINE_RECORD_DATA struct.

Specifically, I'm using portaudio (http://www.portaudio.com) for the audio library and the API requests sample rate, frames per buffer, number of channels, and the sample format (based on their examples, this could be float, char, unsigned char, or short).

Where I need help is in translating the PHONE_LINE_RECORD_DATA struct data elements into appropriate elements on the portaudio side. I see from the docs that I'll get a void * to 20ms of 8k PCM data and a buffer length in blocks. Obviously the sample rate would be 8000 and the number of channels is most likely 1 (mono). But what about frames per buffer and sample format? Portaudio doesn't appear to support void as a format, so I can try char or some of the others. But I need a little assistance getting started as I'm not an audio guru.

Can you offer any pointers or suggestions?

Thanks,
Greg
Back to Top View gcamp0730's Profile Search for other posts by gcamp0730
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: December 06 2006 at 1:10pm | IP Logged Quote support

Hi Greg,

When the PHONE_LINE_RECORD_DATA structure is passed back to your application via the callback, part of the data it contains is an address to a 20 Ms block of 8kHz PCM audio data.

The 2 structure members you want to access are:

void *pSampleBuffer;
unsigned long BufferLengthInBytes;

The pSampleBuffer points to a buffer that contains 16 bit 8kHz PCM samples.
Even though the pSampleBuffer is defined as a “pointer to void”, it really is a pointer to short or (short *).

The number of PCM samples is simply: BufferLengthInBytes/2

I would imagine that the portaudio API can be passed blocks of 8kHz PCM samples directly. So if this is true, then you can feed the 16 bit PCM samples from the pSampleBuffer address directly into the portaudio API. You will probably have to type cast the pSampleBuffer pointer so you can pass it to the portaudio API.


Just curious: What are you planning to do with the media engine’s recorded audio that is going to be processed by the portaudio lib?

If this has not helped, make sure to repost again.


Support
Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 
gcamp0730
Intermediate
Intermediate


Joined: June 12 2006
Location: United States
Posts: 35
Posted: December 06 2006 at 3:35pm | IP Logged Quote gcamp0730

I'll give it a go and post my results.

We are going to take the audio and feed it into a software audio device (it looks like a sound card, basically). We have a 3rd party app that will perform a screen capture and record audio from the software audio device providing an AVI file for us to use for training, quality assurance, etc.

Is the audio sent out stereo or mono? If stereo, would it be possible to have the transmit / receive audio on different channels instead of mixed together? For example, the transmit audio on the left channel and the receive audio on the right channel? If there was an audio problem it could potentially help isolate the issue (local vs. remote).

Thanks,
Greg
Back to Top View gcamp0730's Profile Search for other posts by gcamp0730
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: December 06 2006 at 3:43pm | IP Logged Quote support

Greg,

Sounds cool.

Question 1:
Is the audio sent out stereo or mono?

Mono – because all phone call audio (RTP media) is mono. The 20Ms sample block is a digital mix of transmit and receive phone line audio.

Support
Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 
gcamp0730
Intermediate
Intermediate


Joined: June 12 2006
Location: United States
Posts: 35
Posted: December 08 2006 at 9:53am | IP Logged Quote gcamp0730

Success! I added one line of code in the callback routine to write the audio blocks out to the software audio device. I was then able to open Windows recorder and record the audio. Our screen/audio capture app also worked flawlessly.

Thanks again,
Greg
Back to Top View gcamp0730's Profile Search for other posts by gcamp0730
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

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






Contact LanScape Hear what the Lawyers have to say How youm may use this site Read your privacy rights