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™ - Pre-Sales Technical Support
 LanScape Support Forum -> LanScape VOIP Media Engine™ - Pre-Sales Technical Support
Subject Topic: how to verify rtp stream... Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
atripathi_eps
Intermediate
Intermediate


Joined: June 12 2007
Location: India
Posts: 6
Posted: July 06 2007 at 3:47pm | IP Logged Quote atripathi_eps

Hi,

My application requires feeding the rtp audio buffer to a speech recognition engine. However, the rtp buffer are forwarded to the recognition engine, no begin of speech is found. The audio format I am using is mu-law.

To verify the rtp stream, I made the following changes to the program to store the ulaw data in a file.

void __stdcall PhoneLineReceiveAudioCallback(IVR_RECOGNITION_DATA *pIvrRecognitionData)
{

     pDlg = (CSingleLinePhoneDlg *)pIvrRecognitionData->pUserData;
     pDlg->saveSpeech((char *)pIvrRecognitionData->pSampleBuffer);
}


int CSingleLinePhoneDlg::saveSpeech(char* speechdata)
{
     FILE * nuanceData = NULL;
     nuanceData = fopen("./nuanceData.ulaw", "ab");
//     fprintf(nuanceData, speechdata);
//     fclose(nuanceData);
     if (nuanceData!=NULL)
      {
           fputs(speechdata,nuanceData);
           fclose (nuanceData);
      }
     return 0;
}


This save the rtp stream data. I want to verify
1. if the rtp stream data is correct
2. why begin of speechis not found
3. is it possible to get a tool which converts ulaw file to a playable format (wav file), so that i may listen the sound to verify it.

Regards
Arvind
Back to Top View atripathi_eps's Profile Search for other posts by atripathi_eps
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: July 06 2007 at 4:56pm | IP Logged Quote support

Hi Arvind,

That is a good idea to write your raw ulaw samples to a file. You can use the open source sox utility to convert the raw ulaw sample file data into a ulaw wave file. It’s a great little utility.

First, go get the latest version of the sox utility ”SoX - Sound eXchange”. It is used to convert between all sorts of formats, rates, etc:

Assuming you have your raw ulaw samples in a file, create a wave file using the sox command line:

Code:

:convert a raw Ulaw file to a Ulaw wave file
sox -r 8000 -c 1 -U InRawFile.raw OutputFile.wav



The “InRawFile.raw” file is the file your software created. The sox utility will create your Ulaw “OutputFile.wav” file. To hear the wave file results, just double click on it. Windows media player will play it for you.

If the wave file sounds OK, then you must have a problem feeding the buffers to the speech recognition engine.

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


Joined: June 12 2007
Location: India
Posts: 6
Posted: July 06 2007 at 5:09pm | IP Logged Quote atripathi_eps

Thanks a lot for a quick help...

will try verifying the audio stream and let you know...

regards
Arvind
Back to Top View atripathi_eps's Profile Search for other posts by atripathi_eps
 
atripathi_eps
Intermediate
Intermediate


Joined: June 12 2007
Location: India
Posts: 6
Posted: July 07 2007 at 7:00am | IP Logged Quote atripathi_eps

Hello,

I downloaded Sox and tried to convert the ulaw file to PCM wav files as follows...

sox -r 8000 -c 1 ivrData1.ul ivrData1.wav

However, when I listen to the converted wav file, I can hear only noise. Does this mean the format of the rtp stream is not correct?

Regards
Arvind
Back to Top View atripathi_eps's Profile Search for other posts by atripathi_eps
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: July 07 2007 at 8:54am | IP Logged Quote support

Hi Arvind,

Now we see what your problem is, the proc you have for writing the ulaw samples from the phone line is not correct. You need to do something like this:

Code:

// Use this procedure to write raw Ulaw samples to a temp file. The temp raw sample
// file can then be used to verify that you are receiving the proper audio data from
// the VOIP Media Engine’s receive IVR callback proc.
//
void CSingleLinePhoneDlg::saveSpeech(IVR_RECOGNITION_DATA *pIvrRecognitionData)
{
     FILE *nuanceData = NULL;
     BOOL Err = FALSE;


     // make sure we are receiving uLaw samples from the phone line.
     if(pIvrRecognitionData->Req uestedFormat != AUDIO_BW_ULAW_8K)
     {
           // Error. You did not specify the propper value for the ReceiveIvrDataType
           // parameter when your code called the OpenRxIvrChannel() API proc.
           //
           Err = TRUE;
     }
     else
     {
           // open the temp raw sample file.
           nuanceData = fopen("./nuanceData.ulaw", "ab");

           if(nuanceData != NULL)
           {
                 // now take all the ulaw samples from the IVR_RECOGNITION_DATA structure
                 // and write them as raw bytes to the file.
                fwrite(
                      pIvrRecognitionData->pSampleBuffer,
                      1,
                      pIvrRecognitionData->BufferLengthInBytes,
                      nuanceData
                      );

                fclose(nuanceData);
           }
     }
}


Now your sample file should be ok.


Support

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


Joined: June 12 2007
Location: India
Posts: 6
Posted: July 12 2007 at 9:37pm | IP Logged Quote atripathi_eps

I have made the changes accordingly... However now I can see that the condition:

if(pIvrRecognitionData->RequestedFormat != AUDIO_BW_ULAW_8K)

always gets true. This means I am not receiving the data in the format AUDIO_BW_ULAW_8K. Do you have any idea why this is happening?

Regards
Arvind
Back to Top View atripathi_eps's Profile Search for other posts by atripathi_eps
 
atripathi_eps
Intermediate
Intermediate


Joined: June 12 2007
Location: India
Posts: 6
Posted: July 13 2007 at 4:06pm | IP Logged Quote atripathi_eps

I am still facing the same problem. I looks as simple as calling the OpenRxIvrChannel() function, specify the name of the callback function, and desired AUDIO_BANDWIDTH. This will return the audio stream in the callback function which can be written to a file.

I have called OpenRxIvrChannel() function as follows:

status = OpenRxIvrChannel(
     hSipEngine,
     0,
     PhoneLineReceiveAudioCallback,
     this,
     TRUE,    & nbsp;         & nbsp;     // request format/rate conversion on received samples.
     AUDIO_BW_ULAW_8K,  & nbsp;       // we want receive 8k uLaw sample blocks.
     &IvrReceiveChannelHandle),&nbs p;    
     &SamplesPerIvrBuffer,
     &BytesPerIvrBuffer,
     &RequestSampleInByteArray
);

I have set AUDIO_BANDWIDTH to AUDIO_BW_ULAW_8K. As I have requested for format conversion in parameter 5 (true), hence I should always receive AUDIO_BW_ULAW_8K samples in the callback function PhoneLineReceiveAudioCallback().

However, function PhoneLineReceiveAudioCallback() do not return AUDIO_BW_ULAW_8K stream and that's why the problem is coming.

I am still tracing the problem. If you get any idea of the problem, please help me.

Regards
Arvind
Back to Top View atripathi_eps's Profile Search for other posts by atripathi_eps
 
atripathi_eps
Intermediate
Intermediate


Joined: June 12 2007
Location: India
Posts: 6
Posted: July 13 2007 at 5:06pm | IP Logged Quote atripathi_eps

It was a mistake in my program. I got the solution.

I am getting the ulaw files generated correctly. I have checked them using Sox and able to hear the voice.

Thanks a lot.
Back to Top View atripathi_eps's Profile Search for other posts by atripathi_eps
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: July 18 2007 at 1:05pm | IP Logged Quote support

Hi Arvind,

Thanks for waiting for us to respond. We upgraded network software and equipment last week that caused us to not be able to properly perform support duties. We are back to normal now.

Let us know if we can assist further. The response delay should be shorter now.

Thanks,


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

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