Acusis S play and record while playing stream

I have just got an Acusis S and first tried recording with arecord whilst the internet radio was playing ( Goodvibes a gstreamer frontend ) through the device. The result was fantastic.

However once I start rhasspy (docker) arecord and aplay stops working for the raven module.

Recognise in the home page no longer plays the wake response however the recognition works correctly (as if the radio is not playing at all).
Arecord at the command prompt fails while rhasspy is running.

If I stop the rhasspy docker it works again.

Has anyone got any ideas for a way around this.

After directly defining the device I got this

arecord -D sysdefault:CARD=S test.wav
ALSA lib pcm_dsnoop.c:641:(snd_pcm_dsnoop_open) unable to open slave
arecord: main:852: audio open error: Device or resource busy

The main problem is that the wakeword is not recognized while the radio is playing and the rhasspy response doesn’t play.
The response will not be a problem when all the responses are handled over mqtt however not responding to the wake word is the main problem.
Training wake words without the radio is fine,

I’ll try this

ok that failed even setting up /etc/asound.conf

Oh well I dunno.
Ideas??

Ok so with the deb installed it works fine. The only part that doesn’t work is rhasspy wont play while the radio is playing however the Raven wake word works fine as well as the intent handling.

n.b.
both rhasspy and goodvibes are running as the same user

However I am getting this error.
But rhasspy continues to work.

[ERROR:2021-07-18 20:51:25,535] rhasspyserver_hermes: 
Traceback (most recent call last):
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 824, in api_speakers
    speakers = await core.get_speakers()
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 881, in get_speakers
    handle_finished(), messages, message_types
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 994, in publish_wait
    result_awaitable, timeout=timeout_seconds
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/asyncio/tasks.py", line 449, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError
[ERROR:2021-07-18 20:51:25,539] rhasspyserver_hermes: 
Traceback (most recent call last):
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 789, in api_microphones
    microphones = await core.get_microphones()
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 848, in get_microphones
    handle_finished(), messages, message_types
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 994, in publish_wait
    result_awaitable, timeout=timeout_seconds
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/asyncio/tasks.py", line 449, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

and this is the error when rhasspy tries to respond.

ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
aplay: main:852: audio open error: Device or resource busy
[ERROR:2021-07-18 21:33:07,118] rhasspyspeakers_cli_hermes: handle_play
Traceback (most recent call last):
  File "/usr/lib/rhasspy/rhasspy-speakers-cli-hermes/rhasspyspeakers_cli_hermes/__init__.py", line 80, in handle_play
    subprocess.run(self.play_command, input=wav_bytes, check=True)
  File "/usr/lib/rhasspy/usr/local/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['aplay', '-q', '-t', 'wav', '-D', 'sysdefault:CARD=S']' returned non-zero exit status 1.

Ok I solved it with gstreamer

recording is set to local command

Record Program
gst-launch-1.0
Record Arguments
alsasrc ! audioconvert ! audioresample ! audio/x-raw, rate=16000, channels=1, format=S16LE ! filesink location=/dev/stdout

playback is also local command
Program
gst-play-1.0
Arguments
/dev/stdin

i also added -q for quiet
auto audiosink seems to work fine

The only thing that doesn’t work is the raven playback and playback from the home page.
But for that you can just swap back to alsa for training then back to gstreamer for normal use,

The Acusis S is truely a very cool microphone.
I can play the radio loud and speak normally and even raven wake words word fine,
Not sure how this would work in docker but it should I guess.

I am however getting the following on startup of the rhasspy

DEBUG:rhasspysupervisor:Generating supervisord conf
WARNING:rhasspysupervisor:No microphone device listing command provided.
WARNING:rhasspysupervisor:No microphone device testing command provided.
WARNING:rhasspysupervisor:No sound output device listing command provided.
ERROR:rhasspysupervisor:handle.command.program is required

If anyone has any ideas that would be helpful

Thanks.

Ok the final solution to this was actually very simple.
As I had not installed pulse audio the system was trying to use alsa direct.
With Alsa it is difficult to sort out multiple streams. However pulse does it simply.
In the process of working through this suddenly pulse became the default.
I somehow did not have pulse server running before and now I do.
to be honest I don’t know which part I did to add and enable pulse. But that was the key.

Anywho
with pulse running and arecord -L showing

default
Playback/recording through the PulseAudio sound server
and
pulse
PulseAudio Sound Server

I can now select it in the Audio Recording arecord settings and everything now works as expected.
Even recording the raven wake word while playing the radio works.

The Acusis S will filter out the radio up to a reasonable volume. Over a certain point it fails though. However this could be better sorted with more appropriate microphone and speaker placement.

This is very cool.

Something I have wanted for a long time.

1 Like