New to javascript here, is there a sample on how to control the volume of the user's mic in chime vanilla using amazon-chime-sdk-js? There is a sample in typescript https://aws.amazon.com/blogs/business-productivity/transforming-audio-and-shared-content-in-the-amazon-chime-sdk-for-javascript/ but I can't manage to convert it to vanilla js this part of the code
import {
SingleNodeAudioTransformDevice,
} from 'amazon-chime-sdk-js';
export class VolumeTransformDevice extends SingleNodeAudioTransformDevice<GainNode> {
private volume: number = 1.0; // So we can adjust volume prior to creating the node.
async createSingleAudioNode(context: AudioContext): Promise<GainNode> {
const node = context.createGain();
// Start at whatever volume the user already picked for this device, whether
// or not we were connected to the audio graph.
node.gain.setValueAtTime(this.volume, context.currentTime);
return node;
}
setVolume(volume: number): void {
this.volume = volume;
if (this.node) {
this.node.gain.linearRampToValueAtTime(volume, this.node.context.currentTime + 0.25);
}
}
}