{"action":"created","issue":{"url":"https://api.github.com/repos/alexa/avs-device-sdk/issues/993","repository_url":"https://api.github.com/repos/alexa/avs-device-sdk","labels_url":"https://api.github.com/repos/alexa/avs-device-sdk/issues/993/labels{/name}","comments_url":"https://api.github.com/repos/alexa/avs-device-sdk/issues/993/comments","events_url":"https://api.github.com/repos/alexa/avs-device-sdk/issues/993/events","html_url":"https://github.com/alexa/avs-device-sdk/issues/993","id":365212047,"node_id":"MDU6SXNzdWUzNjUyMTIwNDc=","number":993,"title":"how to save response audio to a file?","user":{"login":"gunnicus","id":4023477,"node_id":"MDQ6VXNlcjQwMjM0Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/4023477?v=4","gravatar_id":"","url":"https://api.github.com/users/gunnicus","html_url":"https://github.com/gunnicus","followers_url":"https://api.github.com/users/gunnicus/followers","following_url":"https://api.github.com/users/gunnicus/following{/other_user}","gists_url":"https://api.github.com/users/gunnicus/gists{/gist_id}","starred_url":"https://api.github.com/users/gunnicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunnicus/subscriptions","organizations_url":"https://api.github.com/users/gunnicus/orgs","repos_url":"https://api.github.com/users/gunnicus/repos","events_url":"https://api.github.com/users/gunnicus/events{/privacy}","received_events_url":"https://api.github.com/users/gunnicus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-30T10:09:04Z","updated_at":"2018-10-02T02:47:46Z","closed_at":null,"author_association":"NONE","body":"**IMPORTANT**: Before you create an issue, please take a look at our [Issue Reporting Guide](https://github.com/alexa/avs-device-sdk/wiki/Issue-Reporting-Guide).\r\n\r\n\r\n## Briefly summarize your issue:\r\n<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->\r\nI'm trying to save response audio to a file, I added these code to SpeechSynthesizer, inside executePreHandleAfterValidation funtion. The file is saved no problem, However, when I open the result.mp3 file in a player, the voice is shattered, as twice as fast compare to normal speak. Can't really hear it properly, it only last 4 seconds, it is very different to what Alexa spoke, I wonder if this is a format/decode issue? If I want to save exactly what Alexa said audio to a file, where is the best place to do that?\r\n\r\nI shared result.mp3 on google drive [https://drive.google.com/file/d/1wsnOl8ChO1RZJahscPrWnzJCK5cWAg0l/view?usp=sharing](url)\r\n\r\nThis is the code I add at SpeechSynthesizer after line 456 \r\nstd::ofstream out(\"result.mp3\");\r\n\t\tif (out.is_open()) {\r\n\t\tchar buf[1024];\r\n\t\tavsCommon::avs::attachment::AttachmentReader::ReadStatus status;\r\n\t\twhile (true) {\r\n        auto len = speakInfo->attachmentReader->read(buf, sizeof(buf), &status);\r\n\t\t\t\tif (status == avsCommon::avs::attachment::AttachmentReader::ReadStatus::OK) {\r\n\t\t\t\t\tout.write(buf, len);\r\n\t\t\t\t\t ACSDK_DEBUG9(LX(\"executePreHandleAfterValidation\")\r\n                           .d(\"ReadStatus\", \"OK\"));\r\n\t\t\t\t} else if (status == avsCommon::avs::attachment::AttachmentReader::ReadStatus::CLOSED) {\r\n\t\t\t\t\t ACSDK_DEBUG9(LX(\"executePreHandleAfterValidation\")\r\n                           .d(\"ReadStatus\", \"CLOSED\"));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tspeakInfo->attachmentReader->close();\r\n\t\t\t ACSDK_DEBUG9(LX(\"executePreHandleAfterValidation\")\r\n                           .d(\"output .mp3 file\", \"finished\"));\r\n\t\t}\r\n## What is the expected behavior?\r\n<!--- Tell us what should happen -->\r\n\r\n## What behavior are you observing?\r\n<!--- Tell us what's happening instead -->\r\n\r\n## Provide the steps to reproduce the issue, if applicable:\r\n<!--- Provide the steps for reproduce -->\r\n\r\n## Tell us about your environment:\r\n<!--- Include as many relevant details about the environment you experienced the bug in -->\r\n### What version of the AVS Device SDK are you using?\r\n      <x.y.z>\r\n\r\n### Tell us what hardware you're using:\r\n- [x] Desktop / Laptop\r\n- [ ] Raspberry Pi\r\n- [ ] Other - tell us more:\r\n\r\n\r\n### Tell us about your OS (Type & version):\r\n- [ ] Linux\r\n- [ ] MacOS \r\n- [ ] Raspbian Stretch\r\n- [ ] Raspbian Jessy\r\n- [x] Other - tell us more: Windows 10\r\n"},"comment":{"url":"https://api.github.com/repos/alexa/avs-device-sdk/issues/comments/426129426","html_url":"https://github.com/alexa/avs-device-sdk/issues/993#issuecomment-426129426","issue_url":"https://api.github.com/repos/alexa/avs-device-sdk/issues/993","id":426129426,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjEyOTQyNg==","user":{"login":"mavamazon","id":32750278,"node_id":"MDQ6VXNlcjMyNzUwMjc4","avatar_url":"https://avatars3.githubusercontent.com/u/32750278?v=4","gravatar_id":"","url":"https://api.github.com/users/mavamazon","html_url":"https://github.com/mavamazon","followers_url":"https://api.github.com/users/mavamazon/followers","following_url":"https://api.github.com/users/mavamazon/following{/other_user}","gists_url":"https://api.github.com/users/mavamazon/gists{/gist_id}","starred_url":"https://api.github.com/users/mavamazon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavamazon/subscriptions","organizations_url":"https://api.github.com/users/mavamazon/orgs","repos_url":"https://api.github.com/users/mavamazon/repos","events_url":"https://api.github.com/users/mavamazon/events{/privacy}","received_events_url":"https://api.github.com/users/mavamazon/received_events","type":"User","site_admin":false},"created_at":"2018-10-02T02:47:46Z","updated_at":"2018-10-02T02:47:46Z","author_association":"CONTRIBUTOR","body":"Hi!\r\nI would suggest you to play around GStreamer's plugin \"filesink\" that can be used in MediaPlayer. \r\nhttps://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-filesink.html\r\nMediaPlayer code:\r\nMediaPlayer/GStreamerMediaPlayer/src/MediaPlayer.cpp\r\n\r\nIf you want to save speech only you can make sure that your modified MediaPlayer is used there:\r\nhttps://github.com/alexa/avs-device-sdk/blob/master/SampleApp/src/SampleApplication.cpp#L366\r\n\r\n"}}
{"actor":{"display_login":"mavamazon"}}