We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Recorded audio does not play - audio is corrup

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
bizmate
Posts: 5
Joined: Thu Mar 24, 2011 10:53 am

Recorded audio does not play - audio is corrup

Post by bizmate »

Hi

I have an evaluation account set up where the standard audio recording example does not work correctly. The audio file is sent to the server but it cannot play.

What is the problem?

Basic example

<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.0">
<form>
<record name="myrecording" beep="true">
<prompt>
Please leave message
</prompt>
<filled>
You just recorded :
<value expr="myrecording"/>
<submit next="submitrecording.php" namelist="myrecording"
method="post" enctype="multipart/form-data"/>

</filled>
</record>
</form>
</vxml>

My Submitrecording PHP works fine so why the file is not playing?

Br

Diego

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Recorded audio does not play - audio is corrup

Post by support »

Hi Diego,

If you are using the example in the documentation (http://www.plumvoice.com/docs/dev/devel ... user_input) and have set up your submitrecording.php to look like this:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0">
  <form>
    <block>

<?php
if (isset($_FILES['myrecording']) && is_uploaded_file($_FILES['myrecording']['tmp_name'])) {
        move_uploaded_file($_FILES['myrecording']['tmp_name'],"message.wav");
        echo "<prompt bargein=\"false\">Audio saved.</prompt>";
}  else {
        echo "<prompt bargein=\"false\">Audio not saved.</prompt>";
}
?>

    </block>
  </form>
</vxml>
please keep in mind that the default media format of the file is "audio/basic", which means it's going to be a raw u-law media file. If you want to make your recorded file a .wav file, you should update your code to do so.

For your reference, we have included an example of another submitrecording.php file, which uses SoX program to convert the raw audio file to a wav file:

submitrecording.php:

Code: Select all

<?php
echo "<?xml version=\"1.0\" encoding=\"latin-1\"?>";
?>
<vxml version="2.0">
    <form id="greeting">
        <block>
<?php
	if (isset($_FILES['recording']) && is_uploaded_file($_FILES['recording']['tmp_name'])) {
		move_uploaded_file($_FILES['recording']['tmp_name'],"temp.ul");
		$timestamp = time();
		$cmdline = `/usr/local/bin/sox -t ul -r 8000 temp.ul $timestamp.wav`;
		unlink("temp.ul");
		echo "<exit/>\n";
	} else {
		echo "<exit/>\n";
	}
?>
        </block>
    </form>
</vxml>
Regards,
Plum Support

bizmate
Posts: 5
Joined: Thu Mar 24, 2011 10:53 am

Re: Recorded audio does not play - audio is corrup

Post by bizmate »

thanks for the reply

The environment i use does not have SOX installed. Can the format be changed on Plum's platform?

Br

Diego

bizmate
Posts: 5
Joined: Thu Mar 24, 2011 10:53 am

Re: Recorded audio does not play - audio is corrup

Post by bizmate »

Hi
i have a very old version of ffmpeg that should do the conversion automatically on the server.... but still the output file is corrupt, i cannot either play it or when i run


[SHELL]$ ffmpeg -i test.ul testDiego.wav

the output file is corrupt

I dont have sox

is there anyway i can get this done with ffmpeg?

bizmate
Posts: 5
Joined: Thu Mar 24, 2011 10:53 am

Re: Recorded audio does not play - audio is corrup

Post by bizmate »

Also this does not work either

[SHELL]$ ffmpeg -i test.ul -ar 8000 testFile2.wav

... the output file is unusable, also i tried the file i receive from your server ... tried to play it in VLC that should play all kind of media but it is not working

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Recorded audio does not play - audio is corrup

Post by support »

Hi Diego,

Alternatively, you can set the following within your <record> tag:

Code: Select all

<record name="myrecording" beep="true" type="audio/x-wav">
This will set the media format of the resulting recording to "audio/x-wav". In this way, you wouldn't have to send a raw audio file over to your server.

Hope this helps.

Regards,
Plum Support

bizmate
Posts: 5
Joined: Thu Mar 24, 2011 10:53 am

Re: Recorded audio does not play - audio is corrup

Post by bizmate »

support wrote:Hi Diego,

Alternatively, you can set the following within your <record> tag:

Code: Select all

<record name="myrecording" beep="true" type="audio/x-wav">
This will set the media format of the resulting recording to "audio/x-wav". In this way, you wouldn't have to send a raw audio file over to your server.

Hope this helps.

Regards,
Plum Support
It really is a platform problem. The audio does not play no matter if it is converted or not. It wont play in VLC even if set in the VXML.
See the file here

http://bizmate.dreamhosters.com/ivrTest ... 103124.wav

I am afraid for this project I will have to use another platform.

Br

Diego

Post Reply