Sony's Developer World forum

    • Home
    • Forum guidelines

    How to connect 4 microphones and hear the voice at the same time?

    Spresense
    2
    5
    127
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      XY last edited by

      I am trying to monitor the human heartbeat by using a microphone array. But there got some problems. Channels A and B work fine but channels C and D do not work. I don't know why this is happening. I am using the "through" example of the Arduino IDE.

      C 1 Reply Last reply Reply Quote
      • C
        CamilaSouza DeveloperWorld @XY last edited by

        Hi @XY

        How are you connecting the microphones?
        Please share your code so we can take a look at it.

        X 2 Replies Last reply Reply Quote
        • X
          XY @CamilaSouza last edited by

          @CamilaSouza
          Hi
          this is my code

          #include <Audio.h>
          
          AudioClass *theAudio;
          
          /**
           * @brief Audio attention callback
           *
           * When audio internal error occurc, this function will be called back.
           */
          
          static void audio_attention_cb(const ErrorAttentionParam *atprm)
          {
            puts("Attention!");
            
            if (atprm->error_code >= AS_ATTENTION_CODE_WARNING)
              {
                exit(1);
             }
          }
          
          /**
           * @brief Setup audio through to I2s input to speaker
           *
           * Set output device to speaker <br>
           * Set input mic gain to 16.0 dB
           */
          void setup()
          {
          
            /* start audio system */
            theAudio = AudioClass::getInstance();
            theAudio->begin(audio_attention_cb);
          
            puts("initialization Audio Library");
          
            /* Set input source with first argument.
             * The second argument means source of I2s output.
             * If you set "I2sIn" as the first argument, please set "None" as the second argument.
             * Set speaker driver mode to LineOut with last argument.
             * If you want to change the speaker driver mode to other,
             * specify "AS_SP_DRV_MODE_1DRIVER" or "AS_SP_DRV_MODE_2DRIVER"
             * or "AS_SP_DRV_MODE_4DRIVER" as an argument.
             *
             */
            int err = theAudio->setThroughMode(AudioClass::MicIn, AudioClass::None, true, 160, AS_SP_DRV_MODE_LINEOUT);
            if (err != AUDIOLIB_ECODE_OK)
              {
                printf("Through initialize error\n");
                exit(1);
              }
          
            theAudio->setVolume(-160);
            if (err != AUDIOLIB_ECODE_OK)
              {
                printf("Set Volume error\n");
                exit(1);
              }
          }
          
          1 Reply Last reply Reply Quote
          • X
            XY @CamilaSouza last edited by

            @CamilaSouza
            Regarding the connection of the microphones, I used four analogue microphones, connected to the JP10 according to the connection on the official website. Since all four mics work on channels A and B, I think there is no problem with the connection method.

            C 1 Reply Last reply Reply Quote
            • C
              CamilaSouza DeveloperWorld @XY last edited by

              Hey @XY

              After some investigation:

              Through sends the sound from microphone directly to speaker. And speaker has just 2 channels: Left and Right.
              So the behavior you are experiencing is the normal one. Ch A sends to left channel and Ch B sends it to right channel.

              If you want to listen to the 4 channels there are two ways.
              One is to save it in wav file. WAV format can support 4 channels in one file. 
              The other is software mixer. 4 channels data is coming as Ch1, Ch2, Ch3, Ch4, Ch1, Ch2, Ch3, Ch4..... So you can make a kind of audio mixer to mix Ch1 and Ch2, Ch3 and Ch4, and then, output to speaker as Left Right channel.

              1 Reply Last reply Reply Quote
              • First post
                Last post
              Developer World
              Copyright © 2021 Sony Group Corporation. All rights reserved.
              • Contact us
              • Legal