Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

respeakerd in pulse mode, module-pipe-source rate:16000? #2

Closed
pipe89 opened this issue Apr 7, 2019 · 3 comments
Closed

respeakerd in pulse mode, module-pipe-source rate:16000? #2

pipe89 opened this issue Apr 7, 2019 · 3 comments
Assignees
Labels
pi_repo Label for pi_repo UAY Unassigned yet

Comments

@pipe89
Copy link

pipe89 commented Apr 7, 2019

Hi,

I've been having issues getting respeakerd to work in pulse mode.
When I load the pipe module and add the default source:

pactl load-module module-pipe-source source_name="respeakerd_output" format=s16le rate=16000 channels=1
pactl set-default-source respeakerd_output

I get this error:

connected to fifo file: /tmp/music.input
(39ms)INFO -- pulseaudio context connecting... [pulse_collector_node.cc:317]
(40ms)DEBUG -- context state: 1 [pulse_collector_node.cc:328]
(41ms)DEBUG -- context state: 2 [pulse_collector_node.cc:328]
(42ms)DEBUG -- context state: 2 [pulse_collector_node.cc:328]
(43ms)DEBUG -- context state: 4 [pulse_collector_node.cc:328]
(43ms)INFO -- pulseaudio context connected to the server. [pulse_collector_node.cc:341]
(43ms)INFO -- The target source name: default [pulse_collector_node.cc:344]
(44ms)INFO -- The source's original info: name: respeakerd_output, rate: 16000, format: s16le, channels:1 [pulse_collector_node.cc:372]
(44ms)ERROR -- PulseCollectorNode the sample rate can not be negotiated, it's fixed to 48000 for now! [pulse_collector_node.cc:381]
(44ms)ERROR -- PulseCollectorNode it's for bypassing the resamplers inside PulseAudio since we have builtin resampler in this node. [pulse_collector_node.cc:382]
(44ms)ERROR -- PulseCollectorNode please configure PulseAudio to work at a default 48000 sample rate. [pulse_collector_node.cc:383]
Assertion 'pa_atomic_load(&(s)->_ref) >= 1' failed at pulse/stream.c:320, function pa_stream_unref(). Aborting.
Aborted

When I change the code to:
pactl load-module module-pipe-source source_name="respeakerd_output" format=s16le rate=48000 channels=1

I get this error:
connected to fifo file: /tmp/music.input
(39ms)INFO -- pulseaudio context connecting... [pulse_collector_node.cc:317]
(40ms)DEBUG -- context state: 1 [pulse_collector_node.cc:328]
(42ms)DEBUG -- context state: 2 [pulse_collector_node.cc:328]
(43ms)DEBUG -- context state: 4 [pulse_collector_node.cc:328]
(43ms)INFO -- pulseaudio context connected to the server. [pulse_collector_node.cc:341]
(43ms)INFO -- The target source name: default [pulse_collector_node.cc:344]
(44ms)INFO -- The source's original info: name: respeakerd_output, rate: 48000, format: s16le, channels:1 [pulse_collector_node.cc:372]
(44ms)INFO -- The source's negotiated info: name: respeakerd_output, rate: 48000, format: float32le, channels:1, flat volume: 1 [pulse_collector_node.cc:404]
(44ms)INFO -- Initialize RingBuffer successed. [pulse_collector_node.cc:426]
(46ms)DEBUG -- record stream state: 1 [pulse_collector_node.cc:482]
(56ms)DEBUG -- record stream state: 2 [pulse_collector_node.cc:482]
(57ms)INFO -- Connected to PulseAudio server. [pulse_collector_node.cc:493]
(57ms)DEBUG -- PulseCollectorNode input: channels 1 rate 48000, output: channels 8 rate 16000 [pulse_collector_node.cc:504]
(57ms)INFO -- PulseCollectorNode thread started. [pulse_collector_node.cc:506]
Failed to setschedparam: Operation not permitted
(59ms)INFO -- PulseCollectorNode thread joined. [pulse_collector_node.cc:635]
Can not start the respeaker node chain.
Segmentation fault

How can I get respeakerd to work in pulse mode?

Thank you for your time!

@pipe89 pipe89 changed the title respeakerd in pulsemode, module-pipe-source rate:16000? respeakerd in pulse mode, module-pipe-source rate:16000? Apr 7, 2019
@KillingJacky
Copy link
Member

Hi @pipe89

Have you done the 1.1 part of README ? https://github.com/respeaker/respeakerd#11-prerequisites

Although the scripts cover many details underneath, there're two commands very important:

  • sudo respeakerd-pi-tools setup-pulse
  • respeakerd-pi-tools select-array in install_all.sh
    It seems you haven't done those, so that you got error (44ms)ERROR -- PulseCollectorNode the sample rate can not be negotiated, it's fixed to 48000 for now! , this is because you haven't configured PulseAudio the right way, please refer to https://github.com/respeaker/respeakerd/blob/master/scripts/respeakerd-pi-tools#L49 to see how you should do if you want to do the configurations manually.

The 2nd error, simply you need reboot the board.

@pipe89
Copy link
Author

pipe89 commented Apr 8, 2019

Hi @KillingJacky

I have done the first part.
The second part, I can't choose myself which microphone I have when I do the install. Instead, at the end of the installation, I get this message:

Get:1 https://seeed-studio.github.io/pi_repo stretch/main armhf respeakerd armhf 1.2.3-build181119 [34.0 kB]
Fetched 34.0 kB in 0s (37.4 kB/s)
(Reading database ... 84930 files and directories currently installed.)
Preparing to unpack .../respeakerd_1.2.3-build181119_armhf.deb ...
Unpacking respeakerd (1.2.3-build181119) over (1.2.3-build181119) ...
Setting up respeakerd (1.2.3-build181119) ...
sudo: pip: command not found
Detected seeed 8mic voicecard on Pi
1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option sudo systemctl start respeakerd
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option echo "The respeakerd services has been started."
Please select the type of your microphone array: invalid option echo "You can view it's log via:"
Please select the type of your microphone array: invalid option echo ""
Please select the type of your microphone array: invalid option echo "sudo journalctl -f -u respeakerd"
Please select the type of your microphone array: invalid option echo ""
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option cd $H
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option if [[ -e $H/respeakerd ]] ; then
Please select the type of your microphone array: invalid option     cd $H/respeakerd
Please select the type of your microphone array: invalid option     git pull
Please select the type of your microphone array: invalid option else
Please select the type of your microphone array: invalid option     git clone https://github.com/respeaker/respeakerd.git
Please select the type of your microphone array: invalid option fi
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option IP_ETH=`ip -f inet -br address|grep -v 'lo'|grep -v 'wlan'|awk '{print $3}'|sed -e 's//24//'`
Please select the type of your microphone array: invalid option IP_WLAN=`ip -f inet -br address|grep -v 'lo'|grep 'wlan'|awk '{print $3}'|sed -e 's//24//'`
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option echo "Before we can run the Alexa demo, we need you to do the authorization for the Alexa service."
Please select the type of your microphone array: invalid option echo "We need you to VNC connect to the board. If you haven't practiced on VNC operation, please refer to:"
Please select the type of your microphone array: invalid option if [[ $PLATFORM == axol ]] ; then
Please select the type of your microphone array: invalid option     echo "https://github.com/respeaker/get_started_with_respeaker/blob/master/docs/ReSpeaker_Core_V2/getting_started.md#2-vnc"
Please select the type of your microphone array: invalid option else
Please select the type of your microphone array: invalid option     echo "https://www.raspberrypi.org/documentation/remote-access/vnc/"
Please select the type of your microphone array: invalid option fi
Please select the type of your microphone array: invalid option echo ""
Please select the type of your microphone array: invalid option echo "The IP addresses of your board are:"
Please select the type of your microphone array: invalid option if [ x${IP_ETH} != x ]; then
Please select the type of your microphone array: invalid option     echo "- eth: ${IP_ETH}"
Please select the type of your microphone array: invalid option fi
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option if [ x${IP_WLAN} != x ]; then
Please select the type of your microphone array: invalid option     echo "- wlan: ${IP_WLAN}"
Please select the type of your microphone array: invalid option fi
Please select the type of your microphone array: invalid option echo ""
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option echo "------"
Please select the type of your microphone array: invalid option echo "Open the browser inside the VNC desktop, and go to 'http://127.0.0.1:3000'"
Please select the type of your microphone array: invalid option echo "Login with your Amazon account and authorize Alexa service."
Please select the type of your microphone array: invalid option echo "If you enabled 2FA, you need to login amazon.com first and then 'http://127.0.0.1:3000'"
Please select the type of your microphone array: invalid option echo "When you finish that, the script will continue, or press Ctrl+C if you've done this before"
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option alexa-auth 2>&1 > /dev/null
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: invalid option echo "Run the Alexa demo via the following command, the trigger word is 'snowboy'"
Please select the type of your microphone array: invalid option echo ""
Please select the type of your microphone array: invalid option echo "python ${H}/respeakerd/clients/Python/demo_respeaker_v2_vep_alexa_with_light.py"
Please select the type of your microphone array: invalid option echo ""
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: 1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: 
Your microphone array type is: CIRCULAR_6MIC

I have tried running the command:

pi@raspberrypi:~ $ respeakerd-pi-tools select-array
Detected seeed 8mic voicecard on Pi
1) ReSpeaker 6 Mic Array for Raspberry Pi
2) ReSpeaker 4 Mic Array for Raspberry Pi
3) Others - not supported now
Please select the type of your microphone array: 1
Your microphone array type is: CIRCULAR_6MIC

But when I run the respeakerd, I still get the same error.

pi@raspberrypi:~ $ respeakerd --debug
configuration file: /etc/respeaker/respeakerd.conf
==========================================================
parameters
----------------------------------------------------------
mode: pulse
mic_type: CIRCULAR_6MIC
hotword_engine: snowboy
snowboy_res_path: /usr/share/respeaker/snowboy/resources/common.res
snowboy_model_path: /usr/share/respeaker/snowboy/resources/snowboy.umdl
snowboy_sensitivity: 0.5
snips_model_path: /usr/share/respeaker/snips/model
snips_sensitivity: 0.5
source: default
agc_level: -3
debug: 1
enable_wav_log: 0
ref_channel: 6
fifo_file: /tmp/music.input
dynamic_doa: 0
==========================================================
get d-bus connection ...
connected to fifo file: /tmp/music.input
(45ms)INFO  -- pulseaudio context connecting...  [pulse_collector_node.cc:317]
(46ms)DEBUG -- context state: 1  [pulse_collector_node.cc:328]
(48ms)DEBUG -- context state: 2  [pulse_collector_node.cc:328]
(49ms)DEBUG -- context state: 4  [pulse_collector_node.cc:328]
(49ms)INFO  -- pulseaudio context connected to the server.  [pulse_collector_node.cc:341]
(49ms)INFO  -- The target source name: default  [pulse_collector_node.cc:344]
(50ms)INFO  -- The source's original info: name: respeakerd_output, rate: 16000, format: s16le, channels:1  [pulse_collector_node.cc:372]
(50ms)ERROR -- PulseCollectorNode the sample rate can not be negotiated, it's fixed to 48000 for now!  [pulse_collector_node.cc:381]
(50ms)ERROR -- PulseCollectorNode it's for bypassing the resamplers inside PulseAudio since we have builtin resampler in this node.  [pulse_collector_node.cc:382]
(50ms)ERROR -- PulseCollectorNode please configure PulseAudio to work at a default 48000 sample rate.  [pulse_collector_node.cc:383]
Assertion 'pa_atomic_load(&(s)->_ref) >= 1' failed at pulse/stream.c:320, function pa_stream_unref(). Aborting.
Aborted

@KillingJacky
Copy link
Member

KillingJacky commented Apr 8, 2019

@pipe89 You should have noticed that respeakerd is consuming audio stream from the source respeakerd_output, that's not your microphone source, you should specify the command line option like this

respeakerd --debug --source=alsa_input.platform-soc_sound.seeed-8ch

The installation script error, it's new to me. Could you post the output of the following commands?

cat /etc/issue
uname -a
which python
which pip

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pi_repo Label for pi_repo UAY Unassigned yet
Projects
Status: Done
Development

No branches or pull requests

5 participants