Hellow, i'm poor grad studend majoring in entomology...
I have to make cricket sound detection system in which record whether cricket make sounds (yes or no, i don't have to record real audio).
64 cricket will be recorded simultaneously, but i have to record each cricket's song record separately .
Thus, i made prototype code and hardware to record sounds from two channel simultaneously and separately.
however, this code has problem. when the two channel receives sounds at the same time, only one of two channel record the sound...
How can i make the recording system to record simultaneously??
clap_4 is sound recording in channel 4, clap_5 is sound recording in channel 5
int clap_4;
int clap_5;
void setup(){
Serial.begin(9600);
}
void loop() {
int Sound_4 = digitalRead(4);
int Sound_5 = digitalRead(5);
if(Sound_4<=0){
clap_4++;
Serial.print(clap_4); Serial.println("four");
delay(1000);
}
if(Sound_5<=0){
clap_5++;
Serial.print(clap_5); Serial.println("five");
delay(1000);
}
}
You deliberately go deaf here for 1000 milliseconds.
Remove the calls to delay() and say what happens.
Next, we'll start telling you things like this must be coded without the use of delay(), and evyone will have advice for that.
You can get a head start by coming to an understanding of "blink without delay". There is example code in the IDE and of course google is your friend
Pro tip: spaces are allowed and they can help:
Serial.print(clap_5); Serial.println(" five");
Along with eliminating the delays, you'll need to count not that the sound trigger is active, but that it went from inactive to active. This is called variously statechangedetection or edgedetection and is a hole thing you can google and read about, this isn't the best but should give you ideas
This comes up all the time. Here's a recent post on a recent thread you might get something out of:
in a room, there are several cricket cage containing a cricket making sound.
i want to know how much time the crickets make sound.
so i put a mic into each cricket cage, and detect whether they make sound.
each mic in each cage detect each cricket's sound.
The two of these will always prevent your program for continuing for one second, each. Replace the serial.Print() with turning a RED LED on and then next time you get a signal, turn the LED OFF!
in a room, there are several cricket cage containing a cricket making sound.
i want to know how much time the crickets make sound.
so i put a mic into each cricket cage, and detect whether they make sound.
each mic in each cage detect each cricket's sound.
Thank you for kind and meaningful advise!!
I delete delay(1000), but i have another problem.
Too much counts are detected...
I want to know time length of cricket sound...
Thank you for kind and meaningful advise!!
I delete delay(1000), but i have another problem.
Too much counts are detected...
I want to know time length of cricket sound...