Javascript SDK

Posted in API by Lian Shiying Tue Jul 11 2017 05:43:16 GMT+0000 (UTC)·3·Viewed 48 times

Is there a way to get the wav file or audio file from javascript sdk so that it can be relayed to another api to play
Dinu Chiriac
July 11, 2017

Hi Lian,

Javascript SDK is designed to work in browser and it is not supposed to generate mp3 files however you can generate wav files using Python SDK. See Chirp Python SDK documentation pages - (http://developers.chirp.io/docs/chirp-for-python) for more details about how to create wav files.

Thanks,
Dinu

Lian Shiying
Aug 1, 2017

Hi Chirp,

We are trying to use the python sdk over docker image but we found that it requires a audio device tied with the hardware due to the libraries involved. Do you have any experiences in running the python sdk over docker?

Quentin Roquefort
Aug 1, 2017

Hi Lian,

We don't have yet run the SDK in a container as it is usually used on hardware that have access to an audio interface.
However a future version might provide a completely disconnected way to generate wav files as the python SDK is the only one to allow saving a Chirp as a file at the moment.
In the meantime, maybe I can share some ideas with you that could help solve your problem:

  • Have you tried installing PortAudio in your container? PyAudio depends on it
  • If you only want to use the wav generation feature and feel comfortable with python, you can monkey patch a few methods of the ChirpSDK class in your own python script like so:
    ```python
    from chirpsdk import ChirpSDK

def monkey_init(self, app_key, app_secret, api_host=None):
self.api = API(app_key, app_secret, api_host)
self.audio_generator = AudioGenerator()
self.set_protocol()
ChirpSDK.init = monkey_init

def monkey_set_protocol(self, name='standard'):
self.protocol = Protocol(name)
self.audio_generator.set_protocol(self.protocol)
ChirpSDK.set_protocol = monkey_set_protocol
```

Hope this helps!

Thanks,
Quentin -

  
Markdown is allowed