bespoken/virtual-device-sdk

Add support for audio

Closed this issue · 8 comments

Is your feature request related to a problem? Please describe.
We can send audio in base64 format inside the payload for our virtual-device. We want to make it easier by adding this inside this library.

Describe the solution you'd like
Our message and batch process should be able to receive an audio file, it can have two different inputs

  • A local path, in this scenario we just need to convert it to base64 and generate the payload.
  • A URL, in this scenario we need to download the file, convert it to base64, generate the payload and then delete the file.

Since our inputs don't have to match 1 to 1 with what we send to virtual device we can have the IMessage interface have two optional values: audioPath and audioURL, depending on which one is present we can process and convert to a payload to send to virtual device.

For the batch process, the audio should be processed in parallel.

So IMessage would now look like this:

IMessage {
    audioURL?: string,
    audioPath?: string,
    text?: string;
    phrases?: string[];
}

Does that seem right?

yes

for raw files we need this parameters: "frame_rate":["int"], "channels":["int"], "sample_width":["int"]. I will add those as optional properties. @jperata @jkelvie

Since those ones refer only to audio, let's change the Interfaces like this:

IAudio {
    audioURL?: string,
    audioPath?: string,
   frame_rate?: number,
   channels?: number,
   sample_width?: number,
}
IMessage {
    audio?: IAudio;
    text?: string;
    phrases?: string[];
}

can be tested on virtual-device-sdk@1.5.13

Attached a small project to test the new changes

test-virtual-device-sdk.zip

Marked a verified