Use xbox 360 Kinect as microphone


#1

Hello,

I would like to use my Kinect as microphone for Snips :slightly_smiling_face:
if anybody have a valid alsa configuration i’m very interested !
@cedcox maybe …


#2

Hello,

I don’t use alsa but pulseaudio.
I use openkinect (freenect) only for the led.
I have to check, but i think i remember that the result of audio process via openkinect was not a real success and i choose to use kinect-audio-setup (in debian contrib). The kinect is seen as generic USB microphone.
But, for me, the result is not as precise as the kinect can be with xbox 360.
I use the kinect because when i installed snips in living room on my multimedia box, i had not other micro, and the challenge was interesting.

But finally, i think to replace the kinect by respeaker v2 array that are better than the kinect. in any case, I did not know how to optimize the sensibility of the kinect microphone.

However, i have the kinect for 3 months now, and it did the job.

Ced


#3

Thank you very much !

I have tried with pulseaudio … but without success.
Seem errors of rules, the user _snips is part of all groups : pulse, audio, pulse-access etc, but not sound with the command “sam test speaker” (aplay work well …)

Do you use pulseaudio as systemwide Daemon for Sam/Snips ? Do you have a real user _snips with home directory ? Pulseaudio need X11 (i have an error of DBus with Stretch Lite) ?

Gilles


#4

I’m on full debian with graphical interface (kodi, spotify etc…)
So, i don’t use the sytemwide config of pulse.

i have to remember all what i did :slight_smile: I’ll look this evening and i’ll come back with more informations

Ced


#5

Ok, so here is what i did, quick and dirty because i want proof of concept… and as usual, become production without take time to change :rofl:

The idea is that the user of owner of pulseaudio creates a socket server to wich will connect the _snips user pulseaudio

  • Create a home folder to _snips user
  • Create .config/pulse folder in _snips home
  • in client.conf of pulse file in _snips home add this :
    default-server = unix:/tmp/pulse-socket
  • in default.pa of owner user of pulseaudio (/home/pi/.config/pulse/ for raspberry) , add this line :
    set-default-source alsa_input.usb-Microsoft_Kinect_USB_Audio_<BLABLABLA>.input-4-channels . You’ll find the exact info with pactl list at Source #0
  • in default.pa of owner user of pulseaudio, uncomment this line :
    load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket

After that, i found that the sound recorded by Kinect was very low. So, via UI, i was able to increase the volume to 150% but did not manage to do it with pulseaudio commandline. (Ok, i did not search a lot :smile: ).

If you manage to run the microphone of the kinect with openkinect, tell me !

Here is the little python script for basic led on/off with openkinect :

import paho.mqtt.client as mqtt
import json
import freenect
import time
import sys

def on_connect(client, userdata, flags, rc):
    mqtt.subscribe("hermes/hotword/default/detected")

def on_message(client, userdata, msg):
    freenect.set_led(dev, 6)
    time.sleep(2)
    freenect.set_led(dev,0)

mqtt = mqtt.Client()
mqtt.on_connect = on_connect
mqtt.on_message = on_message
mqtt.connect('snips-master', 1883)

ctx = freenect.init()
dev = freenect.open_device(ctx, freenect.num_devices(ctx) - 1)
if not dev:
     freenect.error_open_device()

mqtt.loop_forever()

Good luck :slight_smile:

Ced


#6

Yes !! with all this tips I can find the configuration for my kinect …

It’s impossible to manage the audio with openkinect in python, the wrapper is too old, the function “freenect_set_audio_in_callback” not exist in the definition of the wrapper :confused:

Only in C or maybe C++ … a day maybe lol …

Thank for your help !