1

I would like to create an Amazon Echo using the Matrix Creator connected with to a Raspberry Pi.

My actual idea is use a beamforming algorithm to define the direction of the sound and turn on an LED according to the direction detected. Do you think it's possible with Matrix Creator? How can I get the stream from the microphones? Is there any ready software?

  • Welcome to the RPi StackExchange. If you haven't already, please read the tour. As it is currently written, your question is more of a discussion, which makes it off topic. If you have specific questions about various parts of the project, we can help, but as is, it's too broad for this format. – Jacobm001 Jul 22 '16 at 15:55
2

Thanks for the question! You can see an example on how to get a stream in the following example: https://github.com/matrix-io/matrix-creator-hal/blob/master/demos/mic_demo.cpp

/*
 * Copyright 2016 <Admobilize>
 * All rights reserved.
 */

#include <wiringPi.h>

#include <string>
#include <cmath>
#include <iostream>
#include <valarray>

#include "../cpp/driver/microphone_array.h"
#include "../cpp/driver/everloop_image.h"
#include "../cpp/driver/everloop.h"
#include "../cpp/driver/wishbone_bus.h"

namespace hal = matrix_hal;

int main() {
  hal::WishboneBus* bus = new hal::WishboneBus();
  bus->SpiInit();

  hal::Everloop everloop;
  everloop.Setup(bus);

  hal::MicrophoneArray mics;
  mics.Setup(bus);

  hal::EverloopImage image1d;

  std::valarray<int> lookup = {23, 27, 32, 1, 6, 10, 14, 19};

  std::valarray<float> magnitude(hal::kChannels);

  while (true) {
    mics.Read();
    magnitude = 0.0;
    for (unsigned int s = 0; s < mics.NumberOfSamples(); s++) {
      for (unsigned int c = 0; c < hal::kChannels; c++) {
        magnitude[c] += mics.At(s, c) * mics.At(s, c);
      }
    }

    for (auto& m : magnitude) {
      m = std::sqrt(1.0 / (float)mics.NumberOfSamples() * m);
    }

    for (unsigned int c = 0; c < hal::kChannels; c++) {
      image1d.leds[lookup[c]].red = magnitude[c] / 255;
      std::cout << image1d.leds[lookup[c]].red << "\t";
    }
    std::cout << std::endl;

    everloop.Write(&image1d);
  }

  return 0;
}

We'll be updating the examples next week as well so keep checking out the wiki: https://github.com/matrix-io/matrix-creator-quickstart/wiki

  • While your answer may provide the help needed, it doesn't do much to explain how. Additionally, you haven't explicitly disclosed if you're affiliated with this product, which makes it iffy for the spam rules. – Jacobm001 Jul 22 '16 at 15:41
  • I think it would be better to keep the more pertinent parts of the code here and explain them. As you've linked to it, the code can be downloaded by the user on github, so copying the entire thing without additional information doesn't seem particularly helpful. – Jacobm001 Jul 22 '16 at 15:42
  • Cool. Thank you for your help. This is the code to get the streaming from the matrix to the pi. Right? Do you something to implement the beamfoarming? – Alodavide Jul 22 '16 at 15:44
2

We (MATRIX Creator development team) have posted another bare metal example about reading a raw audio stream from the FPGA:

https://github.com/matrix-io/matrix-creator-hal/blob/master/demos/micarray_recorder.cpp

We still working in the beamforming algorithms, we will release the code soon.

1

We have published the first recipe to make a Amazon Echo DIY device using a Raspberry Pi + MATRIX Creator.

http://www.instructables.com/id/Build-a-DIY-Amazons-Alexa-With-a-Raspberry-Pi-and-/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.