MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Microphone advise for PI2 & voice control

    Scheduled Pinned Locked Moved Hardware
    18 Posts 5 Posters 6.9k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dvbit
      last edited by

      PlayStation pseye works great.
      4 mic array. And camera :-)
      Works out of the box
      Costs 8 eur

      1 Reply Last reply Reply Quote 0
      • richland007R Offline
        richland007
        last edited by

        @dvbit @maxbachmann I do not want to run anything any here else but at the same room at the same pi…i want to run alexa and MMM-voice thats it but they will not work with one mic …they need 2 mics to be configured somehow on the pi.
        Hotword and Snowboy will not help me much but something like MMM-MirrorMirrorOnTheWall will but that is getting way to difficult to install for some reason…i am on my 3rd try
        as far as the playstation mic goes i am sure that may be a good mic but i am not suffering from quality …does that act as 2 separate mics not as an array??
        Denis

        1 Reply Last reply Reply Quote 0
        • M Offline
          maxbachmann
          last edited by maxbachmann

          @richland007 I am not familar with the ps eye (I know a couple people using it where it works way worse then the respeaker 2 mic hat the moment your not close to the mic, but I only saw the ps eye in action in a quite noisy environment once, which is definetly not the normal case at home)

          I personally use the respeaker 4mic hat for the pi (25$) and the respeaker mic array v2 (70$)(pretty awesome but definetly overkill for you)

          The 4 mic array always inputs with 4 separate channels the mic array v2 has two different firmwares one only outputs the processed audio channel the other one outputs the input of the 4 mics, the processed audio channel and the music you play with the array which gets used for the AEC)
          The 2 mic hat (10$) is already quite good and I guess it just streams the 2 channels aswell.

          get the index

          import pyaudio
          
          p = pyaudio.PyAudio()
          info = p.get_host_api_info_by_index(0)
          numdevices = info.get('deviceCount')
          
          for i in range(0, numdevices):
                  if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
                      print "Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name')
          

          thats the output when executing

          Input Device id  2  -  ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0)
          
          import pyaudio
          import wave
          
          RESPEAKER_RATE = 16000
          RESPEAKER_CHANNELS = 6 # change base on firmwares, 1_channel_firmware.bin as 1 or 6_channels_firmware.bin as 6
          RESPEAKER_WIDTH = 2
          # run getDeviceInfo.py to get index
          RESPEAKER_INDEX = 2  # refer to input device id
          CHUNK = 1024
          RECORD_SECONDS = 5
          WAVE_OUTPUT_FILENAME = "output.wav"
          
          p = pyaudio.PyAudio()
          
          stream = p.open(
                      rate=RESPEAKER_RATE,
                      format=p.get_format_from_width(RESPEAKER_WIDTH),
                      channels=RESPEAKER_CHANNELS,
                      input=True,
                      input_device_index=RESPEAKER_INDEX,)
          
          print("* recording")
          
          frames = []
          
          for i in range(0, int(RESPEAKER_RATE / CHUNK * RECORD_SECONDS)):
              data = stream.read(CHUNK)
              frames.append(data)
          
          print("* done recording")
          
          stream.stop_stream()
          stream.close()
          p.terminate()
          
          wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
          wf.setnchannels(RESPEAKER_CHANNELS)
          wf.setsampwidth(p.get_sample_size(p.get_format_from_width(RESPEAKER_WIDTH)))
          wf.setframerate(RESPEAKER_RATE)
          wf.writeframes(b''.join(frames))
          wf.close()
          

          Thats a code example of respeaker on how two get the channels in python with the mic array v2, but I guess it should work similar with other mic arrays

          1 Reply Last reply Reply Quote 0
          • D Offline
            dvbit
            last edited by

            I got the info here
            https://medium.com/snips-ai/benchmarking-microphone-arrays-respeaker-conexant-microsemi-acuedge-matrix-creator-minidsp-950de8876fda
            And it works pretty well.

            1 Reply Last reply Reply Quote 0
            • M Offline
              maxbachmann
              last edited by

              Yeah i know that benchmark (using that speech recognition with my mirror already) :) (newer reapeakers not included there yet they definetly perform a lot better with background music as they use the xvf3000 resulting in them nearly completely removing the background music from any samples)
              When I saw it it was used in a small robot with speech recognition and it absolutely failed with a distance over around 1 m, but it was on a hackathon so maybe it was just the background noise causing problems.
              @dvbit it just sends all four channels to the pc aswell? or does it already create just one channel out of the four?

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 1 / 2
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy