Best way to upload binary data from an agent?


My goal is to sample and upload audio data to an external server. I am getting audio through the sampler API and uploading the chunks to my agent as they come in. These are in blob format. The agent collects them appends them to a server-side blob that is the full audio sample. Once I stop sampling, I need to send that binary audio data in the blob to an external server, where I will download it and attempt to play it back, to verify the audio was captured correctly. Eventually it will be sent as part of a larger set of data to an external server.

Looking at the capabilities of the agent, I don’t see any way to do this other than manually convert the blob to an encoded string of some kind. The API takes strings for the body, and gives an error if I feed it a blob. I see on the forums that base64 encoding, etc. is expected in the near future. What are my best options right now?

base64 encode should be appearing very shortly, it just got checked in on friday. Just need to get the docs sorted!

Until then you could write a base64 encoder in squirrel, but it may not be worth it if you can wait until mon/tue?

Great, thanks! I just wanted to make sure I was going down the right path. I did end up borrowing a Squirrel base64 encoding shared elsewhere on the main forum, and I am able to upload and play my resulting audio (albeit it is low volume and noisy, but that should be my problem). Looking forward to testing the optimized platform version.

By the way, the new http.base64encode works great. I get the same output as my borrowed version. No issues found. Thanks.