Raw data for some channels is very noisy (audio samples attached)


#1

I am using the following demo to dump raw wave from channel0-7. However, some channels produce very noisy recordings (low frequency noise). Is my matrix voice defective? I have uploaded the audio samples here: https://soundcloud.com/user935949112/sets/raw-audio

I am using the following command to convert int16 raw data to wav files:
sox -r 16000 -c 1 -e signed -c 1 -e signed -b 16 mic_16000_s16le_channel_0.raw channel_0.wav

/home/pi/matrix-creator-hal/build/demos/micarray_recorder

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

#include <wiringPi.h>

#include <string>
#include <fstream>
#include <iostream>
#include <valarray>

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

namespace hal = matrix_hal;

int main() {
  hal::WishboneBus bus;
  bus.SpiInit();

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

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

  hal::EverloopImage image1d;

  for (auto& led : image1d.leds) led.red = 10;

  everloop.Write(&image1d);

  uint16_t seconds_to_record = 10;

  int16_t buffer[mics.Channels() + 1][seconds_to_record * mics.SamplingRate()];

  mics.CalculateDelays(0, 0, 1000, 320 * 1000);

  uint32_t step = 0;
  while (true) {
    mics.Read(); /* Reading 8-mics buffer from de FPGA */

    for (uint32_t s = 0; s < mics.NumberOfSamples(); s++) {
      for (uint16_t c = 0; c < mics.Channels(); c++) { /* mics.Channels()=8 */
        buffer[c][step] = mics.At(s, c);
      }
      buffer[mics.Channels()][step] = mics.Beam(s);
      step++;
    }
    if (step == seconds_to_record * mics.SamplingRate()) break;
  }

  for (uint16_t c = 0; c < mics.Channels() + 1; c++) {
    std::string filename = "mic_" + std::to_string(mics.SamplingRate()) +
                           "_s16le_channel_" + std::to_string(c) + ".raw";
    std::ofstream os(filename, std::ofstream::binary);
    os.write((const char*)buffer[c],
             seconds_to_record * mics.SamplingRate() * sizeof(int16_t));

    os.close();
  }

  for (auto& led : image1d.leds) {
    led.red = 0;
    led.green = 10;
  }
  everloop.Write(&image1d);

  return 0;
}

#2

Try to run micarray_recorder without MALOS running


#3

@lucas How can I turn off MALOS? I reboot raspberry pi and run /home/pi/matrix-creator-hal/build/demos/micarray_recorder. The MALOS is already turned off in my case, right?


#4

sudo pkill -9 malos_eye


#5

@lucas I killed malos_eye and make sure it is killed by checking “ps -aux | grep malos_eye”. The recorded audio is still very noisy (especially channel 1 and channel 7). In general, channel 1, 3, 5, 7 are noisier than channel 0, 2, 4, 6. Could be hardware issue?


#6

@lucas I also tested on another matrix voice. The recording is still very noisy. I made sure malos eye is killed. Do you know other possible causes?


#7

Sorry, i said wrong. You should type sudo pkill -9 malos not malos_eye. They are two different process and i mistaken them.


#8

@lucas It works! BTW, what does malos and malos_eye do? What purpose do they serve, respectively?


#9

Glad to know. Well, malos is a Hardware Abstraction Layer for Matrix. But in a bad explanation malos_eye is related to our computer vision services. But you can check our GitHub repositories like the malos-eye