Audio Recording / Logging to SD card --> microSoundRecorder

testing it for all inputs (ADC, I2S, TDM etc) testing will most likely be lengthy, but if you have a particular input in mind, may it is possible.

My particular interest resides with I2S. I plan to use the audio shield for data logging with .WAV files, which are then saved to the onboard (underside pinout) T4's SD card slot. The audio shield's SD card slot could work too.

I initially had a project with the audio shield and a teensy 3.2...but the issues mentioned in this thread have haunted me.
 
My particular interest resides with I2S. I plan to use the audio shield for data logging with .WAV files, which are then saved to the onboard (underside pinout) T4's SD card slot. The audio shield's SD card slot could work too.

I initially had a project with the audio shield and a teensy 3.2...but the issues mentioned in this thread have haunted me.

You may start withhttps://github.com/WMXZ-EU/record_sgtl5000 and add/merge the functionality (e.g. from microSoundRecorder)
 
Hallo,
we are trying to Teensy Audio shield on a Teensy 3.6, somehow the "standard dafault" with analogue microphone input over I2S.
However when we compile (reinstalled latest Arduino and Teensyduino software and the SdFs library) we get multiple definition errors.
In the header files, we understand that these are not a problem, but when linking, we get (many) errors like this:

/home/tim/software/arduino-1.8.10/hardware/teensy/avr/libraries/Audio/control_tlv320aic3206.cpp:170: multiple definition of `AudioControlTLV320AIC3206::disable()'
/tmp/arduino_build_954548/sketch/src/control_tlv320aic3206.cpp.o:/tmp/arduino_build_954548/sketch/src/control_tlv320aic3206.cpp:170: first defined here
/home/tim/software/arduino-1.8.10/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: Disabling relaxation: it will not work with multiple definitions
/tmp/arduino_build_954548/libraries/Audio/control_tlv320aic3206.cpp.o: In function `AudioControlTLV320AIC3206::disable()':

We see that this file is in the src directory for the MicroSoundRecorder as well as in the Arduino Teensy libraries. Should we be doing something to ensure that only the MicroSoundRecorder version is being used? Or have we overseen some other detail? It seems that the files that are causing the problem should only be in use when using the Tympan microphones; it also looks like the Teensy supplied version is newer.

Best wishes,
Tim and Marc
 
As long you are not using Tympan, I would simply delete the src directory.
BTW are you using Arduino IDE or makefile based compilation?

Edit: sometimes forcing recompilation helps (change something in Tools)
Edit: I will later today change the class name to eliminate this issue
 
As long you are not using Tympan, I would simply delete the src directory.
BTW are you using Arduino IDE or makefile based compilation?

That was it. Thank you!
We are trying to keep it simple and use the Arduino IDE. It seems to work well most of the time.

Looking forward to getting the Recorder running!
Best,
Tim
 
I am experiencing a strange phenomenon with the current microSoundRecorder code (master branch):

* when I try to synchronize the time and date with the micro_SRcontrol.exe program, the date seems to be one day in advance after synchronizing. All recordings have the wrong time stamp with the day+1
* the same happens if I use the serial menu to change the date (it even happens if I only change the time)
* I do not know whether this was present before?
* when I add "tt-=86400" to the code in m_menu.h, the date is OK with both: serial menu or the micro_SRcontrol.exe program

Code:
static void setDate(uint16_t year, uint16_t month, uint16_t day)
{
    uint32_t tt=getRTC();
    struct tm tx=seconds2tm(tt);
    tx.tm_year=year;
    tx.tm_mon=month;
    tx.tm_mday=day;
    tt=tm2seconds(&tx);
[B]    tt-=86400;[/B]
    setRTC(tt);
}

static void setTime(uint16_t hour, uint16_t minutes, uint16_t seconds)
{
    uint32_t tt=getRTC();
    struct tm tx=seconds2tm(tt);
    tx.tm_hour=hour;
    tx.tm_min=minutes;
    tx.tm_sec=seconds;
    tt=tm2seconds(&tx);
[B]    tt-=86400;[/B]
    setRTC(tt);
}

Do you have an idea what could cause this behaviour?
 
@DD4WH, Yes, I experienced it also. The conversion of sec to day is some sort of a mess. Maybe it is correct after 29thFeb? As it created problems everywhere, I tend to convert it back to TD-TimeLib library, or find the bug. It seems that when first setting day and then time, day gets modified.
 
@WMXZ, yes, and the bug is only present in leap years. I could not make it run when first setting day and then time, it is two days in advance in that case.

I was not able to find the bug in tm2seconds, but I think everything is fixed when that function is being replaced by the Teensy time function in Time.cpp [https://github.com/PaulStoffregen/Time/blob/master/Time.cpp]:

I simply adapted (different use of 1970 offset in years and LEAPYEAR) and exchanged the function tm2seconds in audio_logger_if.h, line 138.

After doing that, time and date setting works fine!

Code:
// adapted from from Time.cpp (https://github.com/PaulStoffregen/Time/blob/master/Time.cpp)
// works now !!! DD4WH, 20/02/2020 -> leap year ;-)
uint32_t tm2seconds (struct tm *tx) 
{
  uint32_t seconds;

  // seconds from 1970 till 1 jan 00:00:00 of the given year
  seconds= (tx->tm_year - 1970) * (86400 * 365);
  for (uint32_t i = 0; i < (tx->tm_year - 1970); i++) 
  {
    if (LEAP_YEAR(i)) {
      seconds += 86400;   // add extra days for leap years
    }
  }
  // add days for this year, months start from 1
  for (uint32_t i = 1; i < tx->tm_mon; i++) 
  {
    if ( (i == 2) && LEAP_YEAR(tx->tm_year - 1970)) 
    { 
      seconds += 86400 * 29;
    } else 
    {
      seconds += 86400 * monthDays[i-1];  //monthDay array starts from 0
    }
  }
  seconds+= (tx->tm_mday-1) * 86400;
  seconds+= tx->tm_hour * 3600;
  seconds+= tx->tm_min * 60;
  seconds+= tx->tm_sec;
  return seconds;
}
 
sorry, my github repo shows strange behaviour, need some more time to repair this, but I have some other work to do at the moment. If you want to include the change without a PR, go ahead.
 
Thanks, Walter, for inserting the date correction into the code!

In the meantime, I managed to repair my github repo and made a PR for two other small mods:

* blink LED when there is no SD card inserted (very helpful in the field ;-))
* change in the calculation of sample rate when F_CPU is 48MHz
 
Not to derail this thread, but has anyone successfully tested TDM modes with higher than 48kHz sample rates? I can get TDM8-48kHz to record, but not TDM4-96kHz or TDM2-192kHz.
 
I am circling back to my microsoundrecorder project that I shelved do to frustration. With the lockdown I am back at trying to get I2S quad channel recording working. My first major mistake was getting the wrong I2S mics. I now have removed those and replaced them with 4 ICS43434 and wired them according to the github wiki with the microphones daisy chained for the I2S lines except the data line which only connects to two mics per data line (pin 13 and 38). I did not daisy chain the 3.3 v and ground lines to the mics but instead made a four way branch (can't see how this would be any different electrically but maybe it is).
I made the fix from post #91 in the code to get quad channel to compile. I changed the acq mode to I2S_QUAD. My issue is when I try to record I get four channels of very loud buzzing. I can confirm the two mics on RXD0 record great sound when I change the acq mode to I2S_32 I get two high quality tracks. I tried to do the same with the mics on RXD1 by changing the code at line 78 in the I2S_32 to be CORE_PIN38_CONFIG ... but this results in two blank tracks being recorded unless I interrupt a recording time by cutting the power off which creates a very large file (longer time than I allowed it to record) with a mix of some good audio from the RXD1 mics and the loud buzzing.
Is there some other code change I need to make to get quad channel to work? Do I need to change the sampling frequency? Am I missing some important hardware aspect? Thanks for any input.
 
I was able to make a bit of progress since my last post. After adding the right resistor (100 ohm in my case) to the BCLK line I got rid of a lot of the background. Here was the original:
4 Chan Buzz image.jpg
Here was after:
4 Chan after resistor.jpg
There is still some sort of cycling noise that puts very even bars in the frequency diagram about 75 bars per second. I am not sure where this could be coming from I have tried low pass and high pass filters in various spots. With the same hardware setup I2S_32 records beautifully on RXD0. Still can not get the same on RXD1 when I change the code as in my previous post.
 
Compiling Errors in Arduino- I am trying to compile the program for using the following settings in config.h. I would like to use audio triggered recording with two I2S mics , which based on my understanding I need to set the MDEL to something above 0. Anytime I do that I get compiling errors in Arduino 1.8.13. Works fine when the MDEL is set to -1 but then it just follows a scheduled recording scheme. Verbose errors shown below settings.
Settings in Config.h:
#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 // 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 10 // 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

#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 = { 120, 60, 100, 0, 12, 12, 24, 0, "WOLF"}; //<<<======>>>

// the following global variable may be set from anywhere
// if one wanted to close file immediately
// mustClose = -1: disable this feature, close on time limit but finish to fill diskBuffer
// mustcClose = 0: flush data and close exactly on time limit
// mustClose = 1: flush data and close immediately (not for user, this will be done by program)

int16_t mustClose = -1;// initial value (can be -1: ignore event trigger or 0: implement event trigger) //<<<======>>>

//---------------------------------- 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)
int32_t ndel; // pre trigger delay (in units of audio blocks)
} SNIP_Parameters_s;

SNIP_Parameters_s snipParameters = { 0, 2, 1000, 10000, 3750, 375, 0, MDEL}; //<<<======>>>

Errors from Arduino:
In file included from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\stat.h:9:0,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\_default_fcntl.h:188,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\sys\fcntl.h:4,
from c:\program files (x86)\arduino\hardware\tools\arm\arm-none-eabi\include\fcntl.h:1,
from c:\program files (x86)\arduino\libraries\sdfat-beta\src\common\fsapiconstants.h:30,
from C:\Program Files (x86)\Arduino\libraries\SdFat-beta\src/ExFatLib/ExFatFile.h:36,
from C:\Program Files (x86)\Arduino\libraries\SdFat-beta\src/ExFatLib/ExFatVolume.h:28,
from C:\Program Files (x86)\Arduino\libraries\SdFat-beta\src/ExFatLib/ExFatLib.h:27,
from C:\Program Files (x86)\Arduino\libraries\SdFat-beta\src/SdFat-beta.h:33,
from C:\Users\Scott\AppData\Local\Temp\arduino_build_639042\sketch\audio_logger_if.h:33,
from C:\Users\Scott\AppData\Local\Temp\arduino_build_639042\sketch\myAPP.cpp:216:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Time/time.h:1:2: warning: #warning "Please include TimeLib.h, not Time.h. Future versions will remove Time.h" [-Wcpp]
#warning "Please include TimeLib.h, not Time.h. Future versions will remove Time.h"
^
myAPP.cpp:164: error: 'delay1' was not declared in this scope
AudioConnection patchCord3(acq,0, delay1,0);
^
myAPP.cpp:165: error: 'delay1' was not declared in this scope
AudioConnection patchCord4(acq,1, delay1,1);
^
myAPP.cpp:166: error: 'delay1' was not declared in this scope
AudioConnection patchCord5(delay1,0, queue[0],0);
^
myAPP.cpp:167: error: 'delay1' was not declared in this scope
AudioConnection patchCord6(delay1,1, queue[1],0);
^
myAPP.cpp: In function 'void setup()':
myAPP.cpp:364: error: 'delay1' was not declared in this scope
if(mustClose<0) delay1.setDelay(0); else delay1.setDelay(MDEL);
^
myAPP.cpp:364: error: 'delay1' was not declared in this scope
if(mustClose<0) delay1.setDelay(0); else delay1.setDelay(MDEL);
^
myAPP.cpp: In function 'void loop()':
myAPP.cpp:577: error: 'queue1' was not declared in this scope
queue1.dropCount,
^
Multiple libraries were found for "SD.h"
Used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
Not used: C:\Program Files (x86)\Arduino\libraries\SD
Using library Audio at version 1.3 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio
Using library SdFat-beta at version 2.0.0-beta.8 in folder: C:\Program Files (x86)\Arduino\libraries\SdFat-beta
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI
 
Compiling Errors in Arduino- I am trying to compile the program for using the following settings in config.h. I would like to use audio triggered recording with two I2S mics , which based on my understanding I need to set the MDEL to something above 0. Anytime I do that I get compiling errors in Arduino 1.8.13. Works fine when the MDEL is set to -1 but then it just follows a scheduled recording scheme. Verbose errors shown below settings.

I have not worked with this for a while, but it seems that the different mods done since beginning generated some incompatibilities.
In particular, the #defines are corrupting the templates, I was trying to use.
So I modified templates and one define to get compilation to work.
I just updated the github
Caveat: I have not run the program (as I have no HW setup ready). I only made it to compile.
 
Wow thanks! I was totally stumped how to fix those. I was able to get it to compile without an issue now. Appreciate you coming back and looking at this old project. I am still fighting to get it to actually do event triggered recording. I ran the HW with the above settings and it just recorded a file every minute the entire time. I did not see this in the Wiki but I think the setting "int16_t mustClose = -1;// initial value (can be -1: ignore event trigger or 0: implement event trigger) //<<<======>>>" must also be changed to be 0 instead of -1? I am waiting for night to test that as the acquire settings are set for that which leads to my other question. Is it new that you can not change the settings in the "ACQ_Parameters_s acqParameters" area by changing them in the config.h file and then re-uploading it? I am only able to change them by grounding pin three and then entering menu mode which works fine if it is during the acquire period but won't enter menu mode if it is in hibernation.
 
Changing the parameters required some design decision.
For rebooting from hibernate, parameters need to be read from permanent storage. It was decided from disk.

This is valid also for start after download of new code. Teensy cannot differentiate why it is booting (after reprogramming or after hibernation)
In case there is no parameter file on disk, program uses predefined default values (that are coming from config.h and main program file)
Grounding pin 3 allows you to interrupt boot process and enter menu.

So if you wanted to start with the parameters in config.h file, simply remove the Config.txt file from SD card. program will not find the file and use preset default parameters (code is in loadConfig(...) in audio_logger_if.h).
to have Config.txt written/updated to disk, you have to enter menu. Config.txt will be written on exit of menu.

You cannot enter Teensy, while it is in hibernate state. All is switched off, only RTC is running and will trigger a complete reboot of program. In order to enter menu also during hibernating, toggle the power or pull down the reset line. Teensy will restart and, if Pin 3 grounded then program will enter menu.
 
For rebooting from hibernate, parameters need to be read from permanent storage. It was decided from disk.
Very smart! Don't know why I did not think to delete the config file...duh. Don't mean to be using your time but I'm rather invested in this. I still can't get it to stop recording a file every minute. I did discover after watching the debugging data that the signal to noise ratio was far higher than I expected. So I have been playing around with much higher threshold values. I discovered around 250 it would start to not record continuously and would take a few second break every once in a while. I tried bringing it up even higher and it did not seem to change the result (1000 for the data below). A file always gets recorded on minute intervals but occasionally files are shorter than a minute. I assume I am just misunderstanding the settings but any help would be appreciated. I included the settings from the config file, the debugging data for a quiet room (just a computer fan running) and some debugging data from when it made shorter files.
Settings from Config File
120
60
100
0
12
12
24
1601581649
0
1000
1000
10000
3750
22500
0
5
WOLF

Debugging Data from Quiet Room - Spaces Removed to Save Space
WOLF_2020_10_01_19_48_29.wav
loop: 1818 8; 834 116643; 158; 0; 217156 1456 149; -22500 0 0;
loop: 2486 20; 835 837; 30; 0; 197136 1462 134; -22500 0 0;
loop: 2487 32; 835 836; 30; 0; 195364 1454 134; -22500 0 0;
loop: 2487 44; 835 836; 30; 0; 260100 1453 179; -22500 0 0;
loop: 2478 55; 835 3473; 30; 0; 339889 1451 234; -22500 0 0;
loop: 2486 67; 835 836; 30; 0; 194481 1451 134; -22500 0 0;
loop: 2487 79; 835 837; 30; 0; 131044 1455 90; -22500 0 0;
loop: 2487 91; 835 837; 30; 0; 207936 1456 142; -22500 0 0;
loop: 2478 102; 835 3266; 30; 0; 164836 1456 113; -22500 0 0;
loop: 2486 114; 835 836; 30; 0; 193600 1464 132; -22500 0 0;
loop: 2487 126; 835 837; 30; 0; 164025 1465 111; -22500 0 0;
loop: 2489 137; 835 836; 30; 0; 164025 1464 112; -22500 0 0;
loop: 2476 149; 835 3477; 30; 0; 272484 1455 187; -22500 0 0;
loop: 2487 161; 835 836; 30; 0; 214369 1465 146; -22500 0 0;
loop: 2488 173; 835 836; 30; 0; 132496 1468 90; -22500 0 0;
loop: 2490 184; 835 837; 30; 0; 194481 1467 132; -22500 0 0;
loop: 2479 196; 835 3264; 30; 0; 208849 1460 143; -22500 0 0;
loop: 2487 208; 835 837; 30; 0; 233289 1467 159; -22500 0 0;
loop: 2488 220; 835 837; 30; 0; 177241 1471 120; -22500 0 0;
loop: 2488 231; 835 837; 30; 0; 355216 1476 240; -22500 0 0;
loop: 2478 243; 835 3263; 30; 0; 279841 1475 189; -22500 0 0;
loop: 2487 255; 835 836; 30; 0; 219961 1470 149; -22500 0 0;
loop: 2490 266; 835 836; 30; 0; 182329 1451 125; -22500 0 0;
loop: 2488 278; 835 837; 30; 0; 273529 1460 187; -22500 0 0;
loop: 2479 290; 835 3267; 30; 0; 189225 1458 129; -22500 0 0;
loop: 2487 302; 835 837; 30; 0; 185761 1471 126; -22500 0 0;
loop: 2490 313; 835 837; 30; 0; 216225 1469 147; -22500 0 0;
loop: 2488 325; 835 837; 30; 0; 234256 1452 161; -22500 0 0;
loop: 2478 337; 835 3265; 30; 0; 189225 1451 130; -22500 0 0;
loop: 2487 349; 835 837; 30; 0; 293764 1457 201; -22500 0 0;
loop: 2488 360; 835 836; 30; 0; 173056 1453 119; -22500 0 0;
loop: 2468 372; 835 8154; 34; 0; 166464 1455 114; -22500 0 0;
loop: 2488 384; 835 837; 30; 0; 212521 1460 145; -22500 0 0;
loop: 2487 396; 835 836; 30; 0; 217156 1450 149; -22500 0 0;
loop: 2490 407; 835 836; 30; 0; 190096 1444 131; -22500 0 0;
loop: 2475 419; 835 5928; 32; 0; 255025 1447 176; -22500 0 0;
loop: 2487 431; 835 836; 30; 0; 166464 1446 115; -22500 0 0;
loop: 2489 442; 835 837; 30; 0; 252004 1442 174; -22500 0 0;
loop: 2487 454; 835 836; 30; 0; 204304 1429 142; -22500 0 0;
loop: 2475 466; 835 5941; 32; 0; 270400 1429 189; -22500 0 0;
loop: 2488 478; 835 837; 30; 0; 145161 1420 102; -22500 0 0;
loop: 2487 489; 835 836; 30; 0; 190969 1431 133; -22500 0 0;
loop: 2488 501; 835 836; 30; 0; 294849 1430 206; -22500 0 0;
loop: 2476 513; 835 6069; 32; 0; 218089 1437 151; -22500 0 0;
loop: 2487 525; 835 836; 30; 0; 180625 1454 124; -22500 0 0;
loop: 2489 536; 835 837; 30; 0; 221841 1454 152; -22500 0 0;
loop: 2488 548; 835 836; 30; 0; 156025 1460 106; -22500 0 0;
loop: 2476 560; 835 5778; 32; 0; 223729 1469 152; -22500 0 0;
loop: 2490 571; 835 993; 30; 0; 186624 1466 127; -22500 0 0;
loop: 2487 583; 835 836; 30; 0; 219024 1445 151; -22500 0 0;
loop: 2488 595; 835 836; 30; 0; 246016 1447 170; -22500 0 0;
loop: 2488 607; 835 836; 30; 0; 172225 1448 118; -22500 0 0;
loop: 2475 618; 835 5783; 32; 0; 198025 1449 136; -22500 0 0;
loop: 2487 630; 835 837; 30; 0; 241081 1458 165; -22500 0 0;
loop: 2488 642; 835 836; 30; 0; 288369 1459 197; -22500 0 0;
loop: 2488 654; 835 837; 30; 0; 181476 1472 123; -22500 0 0;
loop: 2478 665; 835 5966; 32; 0; 167281 1472 113; -22500 0 0;
loop: 2487 677; 835 837; 30; 0; 241081 1475 163; -22500 0 0;
loop: 2488 689; 834 837; 30; 0; 197136 1462 134; -22500 0 0;
loop: 2488 701; 835 837; 30; 0; 161604 1460 110; -22500 0 0;
close acquisition
QUEUE Empty
file Closed
file closed

WOLF_2020_10_01_19_49_29.wav
loop: 1862 9; 834 121702; 156; 0; 195364 1461 133; -22500 0 0;
loop: 2487 21; 835 837; 30; 0; 236196 1456 162; -22500 0 0;
loop: 2488 33; 835 837; 30; 0; 163216 1464 111; -22500 0 0;
loop: 2490 44; 835 836; 30; 0; 189225 1475 128; -22500 0 0;
loop: 2466 56; 835 8761; 34; 0; 183184 1465 125; -22500 0 0;
loop: 2487 68; 834 836; 30; 0; 170569 1458 116; -22500 0 0;
loop: 2489 80; 835 836; 30; 0; 139129 1453 95; -22500 0 0;
loop: 2490 91; 835 836; 30; 0; 168100 1619 103; -22500 0 0;
loop: 2474 103; 835 5898; 32; 0; 2256004 2023 1115; 3509 247 0;
loop: 2487 115; 835 836; 30; 0; 156025 2005 77; 3134 375 0;
loop: 2488 126; 835 836; 30; 0; 234256 1945 120; 2759 375 0;
loop: 2488 138; 834 836; 30; 0; 164025 1875 87; 2383 376 0;
loop: 2475 150; 835 5903; 32; 0; 237169 1718 138; 2008 375 0;
loop: 2487 162; 835 836; 30; 0; 280900 1590 176; 1633 375 0;
loop: 2490 173; 835 836; 30; 0; 149769 1456 102; 1257 376 0;
loop: 2488 185; 835 836; 30; 0; 164836 1421 116; 882 375 0;
loop: 2474 197; 835 6108; 32; 0; 258064 1390 185; 506 376 0;
loop: 2487 209; 835 836; 30; 0; 259081 1360 190; 131 375 0;
mustClose
QUEUE Empty
file Closed
file closed

Some Data Deleted Here
Debugging Data When I was Occasionally Making Noise
WOLF_2020_10_01_19_50_29.wav
loop: 1889 10; 835 116097; 152; 0; 1778140224 178451 9964; -16010 0 0;
loop: 2487 22; 835 836; 30; 0; 729378049 332579 2193; -16385 0 0;
loop: 2488 33; 835 836; 30; 0; 1534758976 546480 2808; -16761 0 0;
loop: 2488 45; 835 836; 30; 0; 339886096 539723 629; -17136 0 0;
loop: 2483 57; 835 1979; 30; 0; 7022500 431748 16; -17512 0 0;
loop: 2489 68; 834 836; 30; 0; 1188100 298796 3; -17887 0 0;
loop: 2488 80; 835 836; 30; 0; 3984016 208807 19; -18262 0 0;
loop: 2488 92; 835 836; 30; 0; 186841561 152186 1227; -18638 0 0;
loop: 2484 104; 835 1913; 30; 0; 2049010756 432794 4734; -19013 0 0;
loop: 2469 115; 835 8332; 34; 0; 193265604 354411 545; -19388 0 0;
loop: 2488 127; 835 836; 30; 0; 47348161 244783 193; -19764 0 0;
loop: 2488 139; 835 836; 30; 0; 236196 169124 1; -20139 0 0;
loop: 2487 151; 835 836; 30; 0; 3003289 116761 25; -20515 0 0;
loop: 2473 162; 835 5956; 32; 0; 2343961 80915 28; -20890 0 0;
loop: 2488 174; 835 837; 30; 0; 142850304 56219 2540; -21265 0 0;
loop: 2488 186; 835 837; 30; 0; 5239521 46369 112; -21641 0 0;
loop: 2488 198; 835 837; 30; 0; 5740816 33168 173; -22016 0 0;
loop: 2475 209; 835 5959; 32; 0; 115541001 24317 4751; -22391 0 0;
loop: 2488 221; 835 837; 30; 0; 243049 20550 11; -22500 0 0;
loop: 2488 233; 834 836; 30; 0; 434281 14770 29; -22500 0 0;
loop: 2489 244; 835 836; 30; 0; 345744 10601 32; -22500 0 0;
loop: 2471 256; 835 6089; 32; 0; 609961 7654 79; -22500 0 0;
loop: 2488 268; 835 994; 30; 0; 106584976 5702 18692; 3704 186 0;
loop: 2488 280; 835 837; 30; 0; 4116841 5110 805; 3328 376 0;
loop: 2488 291; 835 836; 30; 0; 2039184 4736 430; 2953 375 0;
loop: 2487 303; 835 836; 30; 0; 11826721 4376 2702; 3471 375 0;
loop: 2474 315; 835 5735; 32; 0; 3218436 4005 803; 3095 376 0;
loop: 2488 327; 835 836; 30; 0; 1144900 3647 313; 2720 375 0;
loop: 2489 338; 835 836; 30; 0; 257634601 5620 45842; 3445 376 0;
loop: 2487 350; 835 836; 30; 0; 336318921 7885 42653; 3517 375 0;
loop: 2474 362; 835 5903; 32; 0; 179776 7658 23; 3142 375 0;
loop: 2490 373; 835 836; 30; 0; 274576 7284 37; 2766 376 0;
loop: 2488 385; 835 836; 30; 0; 43586404 6913 6304; 3666 375 0;
loop: 2487 397; 835 836; 30; 0; 43375396 7023 6176; 3402 375 0;
loop: 2472 409; 835 6025; 32; 0; 207936 6693 31; 3026 376 0;
loop: 2488 420; 834 837; 30; 0; 409600 6317 64; 2651 375 0;
loop: 2487 432; 835 836; 30; 0; 210681 5943 35; 2275 376 0;
loop: 2487 444; 834 836; 30; 0; 205209 5567 36; 1900 375 0;
loop: 2473 456; 835 5793; 32; 0; 180625 5192 34; 1525 375 0;
loop: 2490 467; 835 836; 30; 0; 169744 4817 35; 1149 376 0;
loop: 2488 479; 835 836; 30; 0; 311364 4441 70; 774 375 0;
loop: 2487 491; 835 836; 30; 0; 223729 4066 55; 399 375 0;
loop: 2469 503; 834 7182; 34; 0; 49885969 3988 12509; 3517 376 0;
loop: 2490 514; 834 836; 30; 0; 192721 3797 50; 3142 375 0;
loop: 2487 526; 835 836; 30; 0; 246016 3422 71; 2766 376 0;
loop: 2487 538; 835 837; 30; 0; 687241 3152 218; 2391 375 0;
loop: 2471 549; 835 6157; 32; 0; 6275025 2934 2138; 3726 375 0;
loop: 2488 561; 834 837; 30; 0; 487204 2706 180; 3350 376 0;
loop: 2488 573; 834 836; 30; 0; 21003889 2467 8513; 3520 375 0;
loop: 2487 585; 834 836; 30; 0; 25725184 2950 8720; 3641 375 0;
loop: 2473 596; 835 6150; 32; 0; 30063289 3172 9477; 3452 376 0;
loop: 2488 608; 835 837; 30; 0; 6365529 2949 2158; 3628 375 0;
loop: 2487 620; 835 836; 30; 0; 109662784 5615 19530; 3596 376 0;
loop: 2487 632; 835 836; 30; 0; 32239684 5690 5666; 3740 375 0;
loop: 2473 643; 834 6371; 32; 0; 1587703716 37413 42437; 3734 375 0;
loop: 2488 655; 835 837; 30; 0; 2250000 37531 59; 3358 376 0;
loop: 2488 667; 834 837; 30; 0; 7667361 36732 208; 2983 375 0;
loop: 2487 678; 834 836; 30; 0; 6651241 37350 178; 2608 375 0;
loop: 2471 690; 835 6055; 32; 0; 648025 37137 17; 2232 376 0;
loop: 2488 702; 835 837; 30; 0; 2663424 35841 74; 1857 375 0;
close acquisition
QUEUE Empty
file Closed
file closed
 
I will have a look into this

I still need to spin-up my memories.
the snippet detection mode was not really tested widely.

But, what I would try is two things.
-make sure that mustClose=0; in config file
- snipParameters = { 0, 1000, 1000, 10000, 3, 3000, 0, MDEL};
i.e. shorten the extraction window to 3 blocks and setting the blanking window to 3000
recall all window sizes are in audio block counts.

according to the data log the SNR is <250 so there should be no detection. so 1000 should not really trigger the archiving.
 
Thanks I will give those settings a try tomorrow on the HW. My C++ is very rusty but I am suspicious of the area in myAPP (about line 317 and 402) and audio_hibernate (line 163) code as it almost looks like each time through a loop it is being reset to the aquire parameters to start a recording according to time and not to an audio detection.
 
Thanks I will give those settings a try tomorrow on the HW. My C++ is very rusty but I am suspicious of the area in myAPP (about line 317 and 402) and audio_hibernate (line 163) code as it almost looks like each time through a loop it is being reset to the aquire parameters to start a recording according to time and not to an audio detection.

It is intended that program continuously checks if should close a file or hibernate. This is to allow files that are opened and closed on the second, and to have duty cycles that are on nice numbers.
If you activate mustClose (by changing it from -1 to 0) files will be closed after event.
But if event is so long that it crosses the nice file boundaries, file will be closed and reopened. that may not be ideal, but that is how it is setup. reason: if you have very long events and wanted to have small files, then you get the event in multiple chunks.

which data are written to file is controlled by detection module.
As soon data are on queue file is opened, if must_close is set to 0 and extraction window is terminated and all data are retrieved from queue, file is closed.
This does not mean event is a single file, but if event is longer than file duration multiple files are generated.
At least that was the intention.

Please note that due to gitbub the config file you download is not the suggested configuration, but reflects the actual testing state.
So all parameters must be controlled to be consistent and modified if necessary.
 
But, what I would try is two things.
-make sure that mustClose=0; in config file
- snipParameters = { 0, 1000, 1000, 10000, 3, 3000, 0, MDEL};
i.e. shorten the extraction window to 3 blocks and setting the blanking window to 3000
I ran these settings on the hardware yesterday and today. Although it changed the file size (smaller/shorter files) it is still recording more or less continuously. I am intentionally trying to get it to not record during quiet times with setting the threshold so high...hoping to work it down from there. Even though the SNR is in the hundreds or less when it is quiet it is still making files. In fact I noticed a strange phenomenon where if would immediately stop recording when I made a loud sound... could be just by chance though.
Some debugging with the above settings during quiet in my office:
WOLF_2020_10_08_18_05_50.wav

loop: 1936 10; 835 124267; 162; 0; 29192409 32251 905; -347 3 0;
loop: 2610 22; 835 837; 30; 0; 165649 26865 6; -722 0 0;
loop: 2612 33; 834 836; 30; 0; 2062096 18964 108; -1098 0 0;
loop: 2610 45; 835 837; 30; 0; 146689 13928 10; -1473 0 0;
loop: 2600 57; 835 3288; 30; 0; 167281 10079 16; -1848 0 0;
loop: 2610 69; 835 837; 30; 0; 254016 7439 34; -2224 0 0;
loop: 2611 80; 835 836; 30; 0; 198025 5613 35; -2599 0 0;
loop: 2609 92; 835 836; 30; 0; 287296 4351 66; -2975 0 0;
loop: 2600 104; 835 3265; 30; 0; 190096 3490 54; -3000 0 0;
loop: 2610 116; 835 836; 30; 0; 196249 2900 67; -3000 0 0;
loop: 2612 127; 835 836; 30; 0; 257049 2508 102; -3000 0 0;
loop: 2610 139; 835 836; 30; 0; 558009 2244 248; -3000 0 0;
loop: 2600 151; 834 3456; 30; 0; 188356 2094 89; -3000 0 0;
loop: 2611 163; 835 837; 30; 0; 166464 1952 85; -3000 0 0;
loop: 2611 174; 835 836; 30; 0; 213444 1867 114; -3000 0 0;
loop: 2609 186; 835 836; 30; 0; 190969 1851 103; -3000 0 0;
loop: 2600 198; 835 3266; 30; 0; 190969 1871 102; -3000 0 0;
loop: 2611 209; 835 837; 30; 0; 206116 1817 113; -3000 0 0;
loop: 2610 221; 834 836; 30; 0; 160000 1779 89; -3000 0 0;

mustClose
QUEUE Empty
file Closed
file closed

WOLF_2020_10_08_18_06_09.wav

loop: 1904 6; 835 123273; 172; 0; 2768896 1817 1523; -213 3 0;
loop: 2609 18; 835 837; 30; 0; 176400 1799 98; -588 0 0;
loop: 2611 29; 835 837; 30; 0; 171396 1760 97; -964 0 0;
loop: 2610 41; 834 836; 30; 0; 180625 1738 103; -1339 0 0;
loop: 2600 53; 835 3456; 30; 0; 217156 1726 125; -1715 0 0;
loop: 2611 64; 834 836; 30; 0; 384400 1788 214; -2090 0 0;
loop: 2610 76; 835 837; 30; 0; 565504 2102 269; -2465 0 0;
loop: 2610 88; 835 837; 30; 0; 355216 2647 134; -2841 0 0;

mustClose
QUEUE Empty
file Closed
file closed

WOLF_2020_10_08_18_06_17.wav
close acquisition

Debugging when I whistled next to the mic:
WOLF_2020_10_08_18_17_22.wav

loop: 357 2; 0 149419; 140; 0; 877969 1310 670; -119 0 0;
loop: 2728 15; 835 837; 112; 0; 414736 2605 159; -494 0 0;
loop: 2732 26; 834 836; 30; 0; 251001 2670 94; -869 0 0;
loop: 2731 38; 835 837; 30; 0; 198025 2383 83; -1245 0 0;
loop: 2480 50; 835 90361; 96; 0; 238144 2077 114; -1620 0 0;
loop: 2732 62; 835 837; 30; 0; 54243225 63822 849; -1996 0 0;
loop: 2731 73; 835 837; 30; 0; 28933641 108863 265; -2371 0 0;
loop: 2731 85; 834 837; 30; 0; 361608256 142309 2541; -2746 0 0;
loop: 2685 97; 835 81700; 88; 0; 188485441 262930 716; -3000 0 0;
loop: 2728 109; 835 1052; 86; 0; 15288100 232519 65; -3000 0 0;
mustClose
QUEUE Empty
file Closed
file closed

loop: 2251 120; 835 836; 284; 0; 215884249 460633 468; -139 3 0;

WOLF_2020_10_08_18_17_32.wav

loop: 2389 15; 835 121314; 320; 0; 189502756 641399 295; -514 0 0;
loop: 2731 27; 835 836; 30; 0; 43283241 538305 80; -890 0 0;
loop: 2731 39; 835 836; 30; 0; 1089936 392806 2; -1265 0 0;
loop: 2491 50; 835 82224; 88; 0; 101545929 346197 293; -1641 0 0;
loop: 2730 62; 835 836; 30; 0; 305410576 1196177 255; -2016 0 0;
loop: 2731 74; 835 836; 30; 0; 37933281 1103198 34; -2391 0 0;
loop: 2731 86; 835 836; 30; 0; 474673369 811600 584; -2767 0 0;
mustClose
QUEUE Empty
file Closed
file closed
 
Back
Top