Navigation

    Sony's Developer World forum

    • Register
    • Login
    • Search
    • Home
    • Forum guidelines
    1. Home
    2. atw72
    A
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups

    atw72

    @atw72

    4
    Posts
    6268
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    atw72 Follow

    Best posts made by atw72

    This user hasn't posted anything yet.

    Latest posts made by atw72

    • RE: Digital Microphones and Arduino

      Hi @TE-KarlKomierowski, below is the recorder sketch I was using. I am using an SD Card. It's a SanDisk 64GB Ultra microSDXC

      #include <SDHCI.h>
      #include <Audio.h>
      
      SDClass theSD;
      AudioClass *theAudio;
      
      File myFile;
      
      bool ErrEnd = false;
      
      /**
       * @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)
          {
            ErrEnd = true;
         }
      }
      
      /**
       * @brief Setup recording of mp3 stream to file
       *
       * Select input device as microphone <br>
       * Initialize filetype to stereo mp3 with 48 Kb/s sampling rate <br>
       * Open "Sound.mp3" file in write mode
       */
      
      static const int32_t recoding_frames = 400;
      static const int32_t recoding_size = recoding_frames*288; /* 96kbps, 1152sample */
      
      void setup()
      {
        theAudio = AudioClass::getInstance();
      
        theAudio->begin(audio_attention_cb);
      
        puts("initialization Audio Library");
      
        /* Select input device as microphone */
        theAudio->setRecorderMode(AS_SETRECDR_STS_INPUTDEVICE_MIC, AS_MICGAIN_HOLD, 68, true);
      
        /*
         * Initialize filetype to stereo mp3 with 48 Kb/s sampling rate
         * Search for MP3 codec in "/mnt/sd0/BIN" directory
         */
        theAudio->initRecorder(AS_CODECTYPE_MP3, "/mnt/sd0/BIN", AS_SAMPLINGRATE_48000, AS_CHANNEL_STEREO);
        puts("Init Recorder!");
      
        /* Open file for data write on SD card */
        myFile = theSD.open("Sound.mp3", FILE_WRITE);
        /* Verify file open */
        if (!myFile)
          {
            printf("File open error\n");
            exit(1);
          }
      
        theAudio->startRecorder();
        puts("Recording Start!");
      }
      
      /**
       * @brief Record given frame number
       */
      void loop() 
      {
        err_t err;
        /* recording end condition */
        if (theAudio->getRecordingSize() > recoding_size)
          {
            theAudio->stopRecorder();
            sleep(1);
            err = theAudio->readFrames(myFile);
      
            goto exitRecording;
          }
      
        /* Read frames to record in file */
        err = theAudio->readFrames(myFile);
      
        if (err != AUDIOLIB_ECODE_OK)
          {
            printf("File End! =%d\n",err);
            theAudio->stopRecorder();
            goto exitRecording;
          }
      
        if (ErrEnd)
          {
            printf("Error End\n");
            theAudio->stopRecorder();
            goto exitRecording;
          }
      
        /* This sleep is adjusted by the time to write the audio stream file.
           Please adjust in according with the processing contents
           being processed at the same time by Application.
        */
      //  usleep(10000);
      
        return;
      
      exitRecording:
      
        theAudio->closeOutputFile(myFile);
        myFile.close();
        
        theAudio->setReadyMode();
        theAudio->end();
        
        puts("End Recording");
        exit(1);
      }
      
      posted in Spresense
      A
      atw72
    • RE: Digital Microphones and Arduino

      @TE-KarlKomierowski I gave this line a try:

      theAudio->setRecorderMode(AS_SETRECDR_STS_INPUTDEVICE_MIC, AS_MICGAIN_HOLD, 68, true);

      I received this error on the serial monitor.

      initialization Audio Library
      Init Recorder!
      Recording Start!
      Attention: module[4][0] attention id[1]/code[6] (objects/media_recorder/audio_recorder_sink.cpp L84)

      Attention: module[4][0] attention id[1]/code[6] (objects/media_recorder/audio_recorder_sink.cpp L84)

      posted in Spresense
      A
      atw72
    • RE: Digital Microphones and Arduino

      Hi there!

      I did see the link above. I made those changes to the Spresense board and now have digital microphones connected to the board. Under the Spresense Arduino IDE development, I was trying to use the recorder sketch that is under the Audio Library at this link: https://developer.sony.com/develop/spresense/developer-tools/get-started-using-arduino-ide/developer-guide#_example_audio_sketches. There is a reference to a link that says setting of "MIC channel select map" for SDK configuration information on how to use digital microphones, however, the link just goes back to the top of the page. Do you know what changes I have to make to the SDK to use the recorder example but with digital microphones?

      Thank you!

      posted in Spresense
      A
      atw72
    • Digital Microphones and Arduino

      I would like to use the record example from Arduino IDE to check the sound on my digital microphones. What changes do I need to make to the sketch to have it work for 2 digital microphones in D01?

      posted in Spresense
      A
      atw72
    Developer World
    Copyright © 2019 Sony Corporation. All rights reserved.
    • Contact us
    • Cookies
    • Legal