As a child, I was always fascinated by animals! They had a form of communication that was not understood by humans. Some believed them to be drastically inferior to humanity, but I was not yet convinced. Admittedly, that may have had something to do with the many animated movies I had grown up watching, rather than any scientific basis.
Nevertheless, this project is my homage to the childhood dream I had. It's an attempt to decipher whether animal communication is complex enough to have correlations to movement. The project itself will not work on any deciphering – the point of the project is to build a dataset. Later on, a professional would be able to look for correlations between communication between the animal’s sounds, the GPS data, and the time.
First, this document will discuss how it would be attached to the animal. Next, we will review the program itself (more detail can be obtained by looking at the actual code). Lastly, we will discuss two methods to extract the data.
This system would be attached as a collar to an animal. I have not provided a design for the attachment mechanism, but a simple collar with a box should be enough. See the image below for an example.
The core of this project is deciding which data to transmit back and making the most efficient usage of data transmission and storage limits.
But first, how does it work? There are two main functions (there’s another one which is more of a helper function). recording() and checkRecording() are the two functions, and understanding their slightly complicated dynamic will make the project easier to understand.
The first function that will be called in the program will be recording(). recording() will record a.wav file for 0.1 seconds in the first run called recording1.wav. This sets up the dynamic that starts after the first run and stays for the rest of the program.
In the second run, recording() and checkRecording() will be called. The reason checkRecording() couldn’t be called in the first run is that there is no recording to check then! But now, checkRecording() will check the last recording of 0.1 seconds (recording1.wav) while the function recording() will save recording2.wav. checkRecording() will check if the audio should be saved or discarded – if saved, it will call storeRecording(). Say storeRecording() is not called because checkRecording() thinks no animals have talked in the last 0.5 seconds.
Then comes the third run. checkRecording() will check recording2.wav, while recording() works on making recording3.wav. Remember that recording() will always be one recording ahead of the file that checkRecording() will analyze.
This continues until checkRecording() thinks an animal did speak! But how does that happen? There are a few steps. First, we need to find a way to check whether or not it should be saved. A good way we found would be to find an average amplitude. If the average amplitude is high enough, checkRecording() calls storeRecording().
But the averages would occasionally be too low, or negative! So we had to do some preprocessing first. First, we make everything positive, and set values under 0.2 to 0.0001. All values below 0.0001 would be discarded in the average, and we would calculate the arithmetic mean over the remaining samples. If it’s above the minimum loudness threshold (we set it to be 0.4), then the program would know to record the next few seconds and store the data.
Because we want the process to run as quickly as possible (in 0.1 seconds), we vectorized the methods using NumPy as much as possible.
Next, what happens when the function calls storeRecording()?
Calling storeRecording() will pause recording() until completion. storeRecording() will record the next 7 seconds of audio and store it in a text file. Accompanying the audio will be GPS data and time data. This will allow the researchers to utilize this data to look for correlations between the audio and the movement of animals. For example, every time a cat makes a specific sound, the cat moves forward. This tells the researchers to investigate whether or not the specific sound can actually mean “move forward”, giving us a very useful tool to move forward in deciphering animal communication.
If words aren’t your thing, here’s a diagram!
Now the data we need is on the board. How do we get access to it though?
There are two simple ways to do so. The first is to use SCP. SCP is a file transfer system built on the SSH protocol and works over WiFi. The issue with this is that you would have to manually deal with downloading the files. On your local machine, run “scp board_name@ip_addr:location/of/file location/to/store” and input your password. A quick tip would be to cd into the directory you wish to save files in and replace location/to/store with a simple period (current directory)! (Look into bash’s wildcard system to streamline your file retrieval if this is the way you choose to go!)
The other system is using an IoT service such as IoTFlows. IoTFlows can be set up through a quick and fairly simple process and will allow users to view the full directories of the board itself. Below is an example of the user view. This is a much simpler process, and can actually be very helpful if your goal is to display your data on a website!
Again, if words aren’t your thing, take a look at the simple diagram below.
For the audio itself, there were two systems to choose from. Realistically, a simple USB microphone would work, but we also have a PCB Board from Seeed’s Fusion service (https://www.seeedstudio.com/pcb-assembly.html) that has multiple microphones and would work just as well! I would suggest using a USB microphone if it’s already around – if not, the PCB service would work just fine. The gerber file (for the PCB) created by Mario De Los Santos is attached. Below is an image of how the project looks with the USB microphone.
And lastly, the internet. The system would do well with an LTE module, or simply being attached to someone’s pets! I wholeheartedly recommend this for any pet owners who wish to have an insight on the things their pets are saying all day long! Because the pets would primarily stay indoors, the system would work just off of the wifi connection that can be established.
That just about concludes the summary! Thank you for reading this far. I wish you the best of luck if you wish to make this project yourself, or improve it as well!
Comments