Represents a device that outputs audio.
Return the audio output properties.
const audioOut = new VIAM.AudioOutClient(machine, 'my_audio_out');const properties = await audioOut.getProperties(); Copy
const audioOut = new VIAM.AudioOutClient(machine, 'my_audio_out');const properties = await audioOut.getProperties();
Readonly
The name of the resource.
Play audio on the device.
The audio data to play
Optional
Information about the audio format (optional, required for raw pcm data)
const audioOut = new VIAM.AudioOutClient(machine, 'my_audio_out');const audioData = new Uint8Array([...]); // Your audio dataconst audioInfo = { codec: 'pcm16', sampleRateHz: 48000, numChannels: 2 };await audioOut.play(audioData, audioInfo); Copy
const audioOut = new VIAM.AudioOutClient(machine, 'my_audio_out');const audioData = new Uint8Array([...]); // Your audio dataconst audioInfo = { codec: 'pcm16', sampleRateHz: 48000, numChannels: 2 };await audioOut.play(audioData, audioInfo);
Send/Receive arbitrary commands to the resource.
The command to execute.
import { Struct } from '@viamrobotics/sdk';const result = await resource.doCommand( Struct.fromJson({ myCommand: { key: 'value' }, })); Copy
import { Struct } from '@viamrobotics/sdk';const result = await resource.doCommand( Struct.fromJson({ myCommand: { key: 'value' }, }));
Represents a device that outputs audio.