ViennaMike
ViennaMike

Reputation: 2337

Can't get SoX to play mp3 stream with query parameters

I'm trying to use AlexaPi with SoX as the audio processor (since it has effects, which VLC lacks). For the most part it works, however I found that it fails on some Alexa requests because Alexa returns a URL with required query parameters after the URL, and SoX things the whole string after the "." is the file type. Here's an example of the error message generated by AlexaPi's main.py routine:

2017-09-15 17:51:50 DEBUG: Error attempting play. sox FAIL formats: no handler for file extension `mp3?Expires=1505541107&Signature=g~nHwqbFYxYYPd3WHHYgDdM2Ukvw0J9OICcBI2Jq9M6ORM7pLp97pwt4I3k-S76f3EUC-543csgXOsbRboqXl8RQqqrp3~xxsegy6E-7Y4Fq2itICT14SsmLxXMTr3WRxzOaCujqhvX7vaUENBgH2Tg47RKRqvQTkx5g44iBokRsEgwcFNdQdEKllzfN1I~srBroUMy97XL1NYUVcOPeuRG0ctmu3jsxgKVlONhanc1AHx8wqqU9dJvGcl3OtyD2vw7lRxE2f6aUavgm0ayKpkmVdJyczsk5yJlIMSawjCMoUkLpQrHaU4EzI0w5YsQLggjQEe5KAlsHlNTKY8eRmg__&Key-Pair-Id=APKAJMAIYIGWWT37OIHA'

Any ideas on how to address this? The expiration, signatures, and key-pair-id are all required in order to fetch the response from Amazon, so I can't simply strip them off.

Upvotes: 1

Views: 1118

Answers (2)

Илья Вишня
Илья Вишня

Reputation: 11

I add &dummysox.mp3 to end of the URL:

http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=ru&
q=%D0%AF%20%D1%81%D0%BA%D0%B0%D0%B7%D0%B0%D0%BB&dummysox.mp3

Upvotes: 1

ViennaMike
ViennaMike

Reputation: 2337

Never mind, I figured it out. You just need to specify the file type explicitly before the URL string on the call, i.e., "-t mp3". SoX is ok with the URL, it just couldn't figure out what type of sound file it was, because of the query string that came after .mp3. if you explicitly tell it the type, it goes by what you tell it.

Upvotes: 1

Related Questions