Disable sound play of Audio2Face in docker container

I have successfully started A2F in docker container.

When A2F tries to play sound, it fails with error sounddevice.PortAudioError: Error querying device -1


[A2F SDK] [INFO] ProcessorFullface: Using CUDA device: [0] NVIDIA GeForce RTX 4070 Ti
[A2F SDK] [INFO] AnimatorSkinV2: Using CUDA device: [0] NVIDIA GeForce RTX 4070 Ti
[A2F SDK] [INFO] AnimatorTongue: Using CUDA device: [0] NVIDIA GeForce RTX 4070 Ti
2024-05-31 05:54:35 [1,332,724ms] [Warning] [omni.fabric.plugin] No source has valid data array=0x7c214e0 usdValid=0 cpuValid=0
2024-05-31 05:54:35 [1,332,724ms] [Warning] [omni.fabric.plugin] No source has valid data array=0x7c29948 usdValid=0 cpuValid=0
[TRT INFERENCE] [INFO] TensorRT Processor: Using CUDA device: [0] NVIDIA GeForce RTX 4070 Ti
2024-05-31 05:54:35 [1,332,874ms] [Error] [grpc._server] Exception calling application: Error querying device -1
Traceback (most recent call last):
  File "/audio2face-2023.2.0/exts/omni.audio2face.player_deps/deps/py/grpc/_server.py", line 444, in _call_behavior
    response_or_iterator = behavior(argument, context)
  File "/audio2face-2023.2.0/exts/omni.audio2face.player/omni/audio2face/player/scripts/streaming_server/server.py", line 68, in PushAudioStream
    self._audio_start_callback(instance_name, samplerate)
  File "/audio2face-2023.2.0/exts/omni.audio2face.player/omni/audio2face/player/scripts/instances.py", line 609, in _audio_start_callback
    self.get_instance(instance_name)._audio_start_callback(samplerate)
  File "/audio2face-2023.2.0/exts/omni.audio2face.player/omni/audio2face/player/scripts/instances.py", line 524, in _audio_start_callback
    self._audio_player.set_track(track)
  File "/audio2face-2023.2.0/exts/omni.audio2face.player_deps/deps/audio2face-sdk/python/audio2face/audio/audio_player.py", line 161, in set_track
    self._reset_stream()
  File "/audio2face-2023.2.0/exts/omni.audio2face.player_deps/deps/audio2face-sdk/python/audio2face/audio/audio_player.py", line 284, in _reset_stream
    self.stream.reset(self.track.samplerate)
  File "/audio2face-2023.2.0/exts/omni.audio2face.player_deps/deps/audio2face-sdk/python/audio2face/audio/audio_player.py", line 125, in reset
    default_device = self._sounddevice.query_devices(None, "output")["name"]
  File "/audio2face-2023.2.0/exts/omni.audio2face.player_deps/deps/py/sounddevice.py", line 564, in query_devices
    raise PortAudioError('Error querying device {}'.format(device))
sounddevice.PortAudioError: Error querying device -1

This error is because there is no sound device in container.

I tried to attach a null device --privileged=true --device /dev/null:/dev/snd, it does not work.
I tried to create a dummy sound card like here, also failed…

In fact I don’t need sound play, can I disable sound play of A2F in docker container?

I have to modify /audio2face-2023.2.0/exts/omni.audio2face.player_deps/deps/audio2face-sdk/python/audio2face/audio/audio_player.py to force use DummyStream instead of SoundDeviceStream

class AudioPlayer(object):
    def __init__(self, **params):
        self._is_dummy = params.get("is_dummy", False)  # Change to true
        self.verbose = params.get("verbose", False)
        self.latency = params.get("latency", 0.15)
        self.blocks_per_sec = params.get("blocks_per_sec", 240)
        self.track = AudioTrack()
        if self._is_dummy:
            self.stream = DummyStream(play_callback=self._play_callback, **params)
        else:
            self.stream = SoundDeviceStream(play_callback=self._play_callback, **params)
        self.looping = False
        self._reset_pointers()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.