Forum Rule: Always post complete source code & details to reproduce any issue!
Page 10 of 11 FirstFirst ... 8 9 10 11 LastLast
Results 226 to 250 of 252

Thread: Audio Recording / Logging to SD card --> microSoundRecorder

  1. #226
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Here it compiles without issue A 1.8.15 TD 1.54
    best:
    exit and re-enter Arduino IDE

  2. #227
    Hm. I have updated to A 1.8.15 and TD 1.54, but this is still what happens when I try to compile...
    Click image for larger version. 

Name:	Screen Shot 2021-07-21 at 10.21.52 AM.jpg 
Views:	29 
Size:	68.7 KB 
ID:	25316

  3. #228
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by ethanshoemaker View Post
    Hm. I have updated to A 1.8.15 and TD 1.54, but this is still what happens when I try to compile...
    Click image for larger version. 

Name:	Screen Shot 2021-07-21 at 10.21.52 AM.jpg 
Views:	29 
Size:	68.7 KB 
ID:	25316
    Is that Linux?
    did you do what I said, exiting Arduino IDE?

    I know it compiles here on Win10. The two functions setup() and loop() exist in myApp.cpp as you can see.

    As a test you could remove the extern "C" in front of setup() and loop()

  4. #229
    I figured it out! Thanks for your help!

  5. #230
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by ethanshoemaker View Post
    I figured it out! Thanks for your help!
    can you please give your solution, so other with similar issues get help.

  6. #231
    Yes of course, I just didn't understand that the entire git repository needed to be downloaded and run from Arduino IDE. I am very new to this kind of project.
    However, I am having a new issue now... I have successfully recorded on my desired time schedule, however, I have T1,T2,T3,T4 set to 0,12,12,24. This allows me to record on the correct time-schedule, but it only does it for one day. How can I record on desired time schedule for multiple days at a time? Here is my code...

    Code:
    /* Sound Recorder for Teensy 3.6
     * Copyright (c) 2018, Walter Zimmer
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice, development funding notice, and this permission
     * notice shall be included in all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    
     /*********************** Begin possible User Modifications ********************************/
    // possible modifications are marked with //<<<======>>>
    //
    //----------------------------------------------------------------------------------------
    #define DO_DEBUG 1 // print debug info over usb-serial line  //<<<======>>>
    
    #define F_SAMP 48000 // desired sampling frequency  //<<<======>>>
    /*
     * NOTE: changing frequency impacts the macros 
     *      AudioProcessorUsage and AudioProcessorUsageMax
     * defined in stock AudioStream.h
     */
    
    ////////////////////////////////////////////////////////////
    // ------------------------- Acquisition interface control ----------------------------
    // possible ACQ interfaces
    #define _ADC_0          0 // single ended ADC0
    #define _ADC_D          1 // differential ADC0
    #define _ADC_S          2 // stereo ADC0 and ADC1
    #define _I2S            3 // I2S (16 bit stereo audio)
    #define _I2S_32         4 // I2S (32 bit stereo audio), eg. two ICS43434 mics
    #define _I2S_QUAD       5 // I2S (16 bit quad audio)
    #define _I2S_32_MONO    6 // I2S (32 bit mono audio), eg. one ICS43434 mic
    #define _I2S_TYMPAN     7 // I2S (16 bit tympan stereo audio audio) for use the tympan board
    #define _I2S_TDM        8 // I2S (8 channel TDM) // only first 5 channels are used (modify myAcq.h if less or more channels)
    
    #define ACQ   _I2S_32_MONO // selected acquisition interface  //<<<======>>>
    
    // For ADC SE pins can be changed
    #if ACQ == _ADC_0
      #define ADC_PIN A2 // can be changed  //<<<======>>>
      #define DIFF 0
    #elif ACQ == _ADC_D
      #define ADC_PIN A10 //fixed analog pin
      #define DIFF 1
    #elif ACQ == _ADC_S
      #define ADC_PIN1 A2 // can be changed //<<<======>>>
      #define ADC_PIN2 A3 // can be changed //<<<======>>>
      #define DIFF 0
    #elif (ACQ == _I2S_32) || (ACQ == _I2S_32_MONO) || (ACQ == _I2S_TDM) 
      #define NSHIFT 12 // number of bits to shift data to the right before extracting 16 bits //<<<======>>>
    #endif
    
    #define MDEL -1     // maximal delay in buffer counts (128/fs each; for fs= 48 kHz: 128/48 = 2.5 ms each) //<<<======>>>
                        // MDEL == -1 connects ACQ interface directly to mux and queue
                        // MDEL >= 0 switches on event detector
                        // MDEL > 0 delays detector by MDEL buffers 
    #define MDET (MDEL>=0)
    
    #define GEN_WAV_FILE  // generate wave files, if undefined generate raw data (with 512 byte header) //<<<======>>>
    
    /****************************************************************************************/
    // some structures to be used for controlling acquisition
    // -----------------------scheduled acquisition------------------------------------------
    typedef struct
    { uint32_t on;  // acquisition on time in seconds
      uint32_t ad;  // acquisition file size in seconds
      uint32_t ar;  // acquisition rate, i.e. every ar seconds (if < on then continuous acquisition)
      uint32_t T1,T2; // first acquisition window (from T1 to T2) in Hours of day
      uint32_t T3,T4; // second acquisition window (from T1 to T2) in Hours of day
      uint32_t rec;  // time when recording started
      char name[8];   // prefix for recorder file names
    } ACQ_Parameters_s;
    
    // T1 to T3 are increasing hours, T4 can be before or after midnight
    // choose for continuous recording {0,12,12,24}
    // if "ar" > "on" the do dutycycle, i.e.sleep between on and ar seconds
    //
    // Example
    // ACQ_Parameters_s acqParameters = {120, 60, 180, 0, 12, 12, 24, 0, "WMXZ"};
    //  acquire 2 files each 60 s long (totaling 120 s)
    //  sleep for 60 s (to reach 180 s acquisition interval)
    //  acquire whole day (from midnight to noon and noot to midnight)
    //
    
    ACQ_Parameters_s acqParameters = { 300, 300, 3600, 0, 12, 12, 24, 0, "MERP"}; //<<<======>>>
    
    
    //---------------------------------- snippet extraction module ---------------------------------------------
    typedef struct
    {  int32_t iproc;      // type of detection processor (0: high-pass-threshold; 1: Taeger-Kaiser-Operator)
       int32_t thresh;     // power SNR for snippet detection (-1: disable snippet extraction)
       int32_t win0;       // noise estimation window (in units of audio blocks)
       int32_t win1;       // detection watchdog window (in units of audio blocks typically 10x win0)
       int32_t extr;       // min extraction window
       int32_t inhib;      // guard window (inhibit follow-on secondary detections)
       int32_t nrep;       // noise only interval (nrep =0  indicates no noise archiving, TBD)
       int32_t ndel;       // pre trigger delay (in units of audio blocks)
    } SNIP_Parameters_s; 
    // Note: 375 blocks is 1s for 48 kHz sampling
    
    #if MDEL<0
      // continuous acquisition; disable detector
      #define THR -1
    #else
      #define THR 100 // detection threshold (on power: 100 == 20 dB) //<<<======>>>
    #endif
    
    SNIP_Parameters_s snipParameters = { 0, THR, 1000, 10000, 38, 375, 0, MDEL}; //<<<======>>>
    
    
    //-------------------------- hibernate control---------------------------------------------------------------
    // The following two lines control the maximal hibernate (sleep) duration
    // this may be useful when using a powerbank, or other cases where frequent booting is desired
    // is used in audio_hibernate.h
    //#define SLEEP_SHORT             // comment when sleep duration is not limited   //<<<======>>>
    #define ShortSleepDuration 60   // value in seconds     //<<<======>>>
    
    //------------------------- Additional sensors ---------------------------------------------------------------
    #define USE_ENVIRONMENTAL_SENSORS 0 // to use environmental sensors set to 1 otherwise set to 0  //<<<======>>>
    
    //------------------------- special Hardware configuration ----------------------------------------------------
    #if ACQ == _I2S_TYMPAN
      #undef USE_ENVIRONMENTAL_SENSORS
      #define USE_ENVIRONMENTAL_SENSORS 0 // for tympan switch off environmental sensors
      #define TYMPAN_REVISION         TYMPAN_REV_C         //TYMPAN_REV_C or TYMPAN_REV_D   //<<<======>>>
      #define TYMPAN_INPUT_DEVICE     TYMPAN_INPUT_ON_BOARD_MIC // use the on-board microphones   //<<<======>>>
                                      //TYMPAN_INPUT_JACK_AS_MIC // use the microphone jack - defaults to mic bias 2.5V
                                      //TYMPAN_INPUT_JACK_AS_LINEIN // use the microphone jack - defaults to mic bias OFF
      #define input_gain_dB   10.5f   //<<<======>>>
    #endif
    
    //
    /*********************** End possible User Modifications ********************************/

  7. #232
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by ethanshoemaker View Post
    I have successfully recorded on my desired time schedule, however, I have T1,T2,T3,T4 set to 0,12,12,24. This allows me to record on the correct time-schedule, but it only does it for one day. How can I record on desired time schedule for multiple days at a time? Here is my code...
    The default Tx settings (same as in quoted file) are for continuous recordings 0 to 24.
    recording is always between T1 and T2 and between T3 an T4.

    in addition to this you can schedule a duty cycle e.g: 1 min recording every 5 min.

    If you wanted to record only, say morning (6 to 10 am) and evening (6 to 8 pm) , then you would put T1=6, T2=8, T3=18,T4=20;
    If you wanted to record only, say lover midnight (10 pm to 2 am) and over noon (10 am to 2 pm) , then you would put T1=10, T2=14, T3=20,T4=2;

    different schedules for different days are not possible with actual version.

    You usually change parameters with menu.
    Parameters are stored on disk to survive hibernation.
    consequently, if you delete config.txt on disk, or use a disk without this file, the default parameters from config.h are used.

    hope this helps, or what exactly would you like to do?

  8. #233
    Hi Walter,
    Recording 24 hours per day is my goal (5 minutes every hour, all day) so I have T1,T2,T3,T4 set to 0,12,12,24. My problem is that I left my setup plugged in for several days and the device only did what I wanted it to for the first day it was plugged in. No audio files from the following few days. Important to note that uSD card is not full, so this isnít the issue

  9. #234
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    There is nothing in the program that limits the acquisition to one day.
    Before I go into source code, can you confirm that pin3 is NOT connected to ground?

  10. #235
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    and what is the timestamp of the last file?

  11. #236
    That is correct, pin 3 is not connected to GND. The time stamp of the last file is 11:18 pm. So I would expect the next recording to begin at 12:18 am, but it seems that something happened at midnight which terminated the functionality of the device

  12. #237
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    I will look into this, but can report only tomorrow (system must run over midnight!)

  13. #238
    Ok thank you, another issue I have run into with the menu is when I enter 'x1' I believe this should save my changes and delay for 1 minute... However, no matter what value I enter after 'x' my device immediately starts recording. Maybe you can help me with this.

  14. #239
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by ethanshoemaker View Post
    The time stamp of the last file is 11:18 pm. So I would expect the next recording to begin at 12:18 am, but it seems that something happened at midnight which terminated the functionality of the device
    cannot confirm this. here what I got
    Click image for larger version. 

Name:	dirList.png 
Views:	17 
Size:	124.8 KB 
ID:	25384

  15. #240
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by ethanshoemaker View Post
    Ok thank you, another issue I have run into with the menu is when I enter 'x1' I believe this should save my changes and delay for 1 minute... However, no matter what value I enter after 'x' my device immediately starts recording. Maybe you can help me with this.
    Delayed start was not implemented yet (Wiki was more complete)
    you can simply replace in myApp.cpp
    Code:
      // if pin3 is connected to GND enter menu mode
      int ret;
      if(!digitalReadFast(3))
      { ret=doMenu();
        if(ret<0) ;  // should shutdown now (not implemented) // keep compiler happy
          
        // should here save parameters to disk if modified
        uSD.storeConfig((uint32_t *)&acqParameters, 8, (int32_t *)&snipParameters, 8);
      }
    by
    Code:
      // if pin3 is connected to GND enter menu mode
      int ret;
      if(!digitalReadFast(3))
      { ret=doMenu();
          
        // should here save parameters to disk if modified
        uSD.storeConfig((uint32_t *)&acqParameters, 8, (int32_t *)&snipParameters, 8);
    
        if(ret>0) 
        setWakeupCallandSleep(ret*60);  // should shutdown now and wait for start
      }

  16. #241
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    660
    Ethan, I have a suspicion regarding your problem of the recorder not starting after having gone into deep sleep:

    * does the Teensy LED blink when the recorder has stopped recording ?

  17. #242
    Yes, it does

  18. #243
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    660
    OK. This probably means that after the deep sleep of the recorder, the SD card is not successfully mounted again (fast blinking indicates a problem with the SD card mounting: intended to indicate that the user forgot to insert an SD card ;-)).

    I had this problem when I purchased new SD cards a few months ago: the old cards worked perfectly, with the new SD cards the recorder sporadically did not successfully wake up from deep sleep and blinked forever.

    Please try to alter the file audio_logger_if.h and replace the code for the function "void c_uSD" [lines 161 - 175] with the code in this message:

    https://forum.pjrc.com/threads/52175...l=1#post277487

    This does the following:
    * after waking up from deep sleep, the Teensy trys to mount the SD card
    * if not successful, it counts the number of attempts and after successful SD card mounting writes the number of attempts into a text file (just for the log) and waits for 1 second
    * then it trys again to mount the SD card, until it is successful

    Please try that and I am very curious whether this cures your problem. Please also post the content of the produced txt-file. If it contains at least one value above 0, the SD card mounting was indeed the problem.

    Best regards,
    Frank

  19. #244
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by DD4WH View Post
    Please try to alter the file audio_logger_if.h and replace the code for the function "void c_uSD" [lines 161 - 175] with the code in this message:
    I modified the code on Github accordingly

  20. #245
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    660
    Perfect, thanks Walter!

  21. #246
    Hi Walter,
    I downloaded the entire updated git repository, but now all I am getting on .wav files is a bunch of static. I downloaded and compiled the repository to the teensy as is. Can you confirm that you are not having this issue as well?
    Thanks,
    Ethan

  22. #247
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,316
    Quote Originally Posted by ethanshoemaker View Post
    Hi Walter,
    I downloaded the entire updated git repository, but now all I am getting on .wav files is a bunch of static. I downloaded and compiled the repository to the teensy as is. Can you confirm that you are not having this issue as well?
    Thanks,
    Ethan
    Ops, I got the ACQ selection wrong in config.h
    it should read
    Code:
    #define ACQ  _I2S_32_MONO
    note the leading underscore

  23. #248
    Got it, thank you for all your help. This project is very impressive and useful

  24. #249
    Quote Originally Posted by DD4WH View Post
    OK. This probably means that after the deep sleep of the recorder, the SD card is not successfully mounted again (fast blinking indicates a problem with the SD card mounting: intended to indicate that the user forgot to insert an SD card ;-)).

    I had this problem when I purchased new SD cards a few months ago: the old cards worked perfectly, with the new SD cards the recorder sporadically did not successfully wake up from deep sleep and blinked forever.

    Please try to alter the file audio_logger_if.h and replace the code for the function "void c_uSD" [lines 161 - 175] with the code in this message:

    https://forum.pjrc.com/threads/52175...l=1#post277487

    This does the following:
    * after waking up from deep sleep, the Teensy trys to mount the SD card
    * if not successful, it counts the number of attempts and after successful SD card mounting writes the number of attempts into a text file (just for the log) and waits for 1 second
    * then it trys again to mount the SD card, until it is successful

    Please try that and I am very curious whether this cures your problem. Please also post the content of the produced txt-file. If it contains at least one value above 0, the SD card mounting was indeed the problem.

    Best regards,
    Frank
    Hi Frank,
    I attempted again to get my device recording day after day on my desired interval. I have implemented the updated code, but still my device has eventually stopped recording (uSD is not anywhere near full). The text file SD_s_MERP reads as follows...

    2021_07_29,13_06_31, 0
    2021_07_29,14_06_32, 0
    2021_07_29,15_06_33, 0
    2021_07_29,16_06_34, 0
    2021_07_29,17_06_35, 0
    2021_07_29,18_06_36, 0
    2021_07_29,19_06_37, 0
    2021_07_29,20_06_38, 0
    2021_07_29,21_06_39, 0
    2021_07_29,22_06_40, 0
    2021_07_29,23_06_41, 0
    2021_07_30,00_06_42, 0

    The last recording was at 00:06 and I checked the device today at 15:09 and found it repeatedly doing the following LED pattern as seen in the attached video. Any help would be appreciated.

    Thanks,
    Ethan


  25. #250
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    660
    Ethan,

    what was your Timed Recording pattern?

    That LED pattern in your video indicates that the Teensy is not able to mount your SD card. That explains why there is no value above 0 in the txt-file, because if it cannot mount the SD card, writing to it is also not possible . . .

    So, what does this mean; how can we explain this (I have three ideas about that):
    * maybe your SD card is not suited for the Teensy microSoundRecorder (where did you buy your SD card?) --> try another SD card brand, I have good experience with SanDisk Ultra SDHC A1 16Gb and 64Gb (but beware of fake SanDisk SD cards which have been reported in various threads on this forum)
    * how do you power the Teensy? (it is not visible in your video) An SD card can easily use as much as 400mA or even more when mounting/writing: If you use a cheap USB cable (with thin wires) in combination with a non-sufficient 5V-USB-power supply (regularly they are limited to 500mA or even less), strange effects can occur: Try to power the Teensy by a USB power bank able to deliver more than 500mA and with a reliable cable
    * maybe the newly implemented SDFat lib in Teensyduino 1.54 is doing something differently than the old SD lib implementation: no idea what or why, just pure speculation here

    If you continue to have problems when using another SD card brand and a strong power supply, I have no more ideas about the cause of this problem . . .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •