Unlocking the Secrets of Bee Audio: Analyzing Hive Sounds
Written on
Chapter 1: Introduction to Bee Audio Frequency Analysis
Recently, I engaged in a project that required an extensive analysis of audio recordings from beehives. With my background in frequency analysis, I was excited to explore this essential technique further.
Investigating the sounds produced by bee colonies provides a novel method for monitoring their behavior and overall health. Bees communicate through a complex combination of vibrations and sound waves, which can indicate various activities such as foraging, mating, and the location of the queen. By documenting and analyzing these audio frequencies, researchers and beekeepers can detect subtle changes within the hive that may suggest stress, disease, or other problems.
This method not only enhances our understanding of bee behavior but also serves as a non-invasive way to assess the well-being of these vital pollinators, whose survival is crucial for maintaining biodiversity and food production.
In this article, I will explore the basics of analyzing bee audio frequencies, the techniques and tools employed, and the significant insights this emerging field can provide.
Data Collection
The audio data I utilized is freely available online on Kaggle, which categorizes four types of recordings, though we focused on just one category for our analysis.
This dataset contains a comprehensive collection of honeybee sounds, offering a valuable resource for researchers in the field.
Frequency Analysis
After importing the audio file with the Librosa library at a sampling rate of 22,050 Hz, I processed the recording to extract energy levels across various frequency ranges.
# Load the audio file
data, sample_rate = librosa.load(file, sr=22050)
To visualize the data's strength and vitality, I created a graph depicting the power over time.
def plot_power_vs_time(data, sample_rate, output_dir, title='Power vs Time'):
time = np.arange(len(data)) / sample_rate
power = np.square(data)
fig = plt.figure(figsize=(10, 4))
plt.plot(time, power)
plt.title(title)
plt.xlabel('Time (s)')
plt.ylabel('Power')
plt.show()
Next, I computed the Short-Time Fourier Transform (STFT) of the audio to analyze the power spectrum, which was then aggregated along the frequency axis to produce energy versus frequency plots.
The objective of frequency analysis is to identify the dominant frequencies within a category. Thus, determining the frequency ranges present in the audio signal is essential.
In this instance, the plot depicts the audio category where the queen is absent, displaying the entire frequency spectrum. Through analysis, we discovered that the primary frequencies fell within the range of approximately 10 Hz to 750 Hz.
Utilizing a bandpass filter allowed for capturing both high and low frequencies, enhancing the accuracy of our method. We established the lower and upper limits of our signal to be 10 Hz and 750 Hz, respectively, enabling only relevant frequency components to pass through.
To assess the energy contained within this frequency range, we calculated the overall power and energy of the signal using the following equations:
# Calculate the power & energy of the complete signal.
complete_signal_power = np.mean(np.square(data))
complete_signal_energy = np.sum(np.square(data))
This gives us insights into the power and energy derived from the entire signal spectrum. The results indicate the total power and energy of the audio signal, along with a plot of power versus frequency produced through the STFT.
# Calculate power & energy for the filtered signal.
filtered_signal_power = np.mean(np.square(filtered_data))
filtered_signal_energy = np.sum(np.square(filtered_data))
Our analysis yielded remarkable results:
- Power of the full signal: 0.006128916
- Energy of the full signal: 8108.5557
- Power of the filtered signal (10.0 to 750.0 Hz): 0.00509482615149576
- Energy of the filtered signal (10.0 to 750.0 Hz): 6740.45499842889
The results demonstrated an 83.13% contribution in both power and energy from the specified frequency range, reinforcing the significance of this range for further analysis.
Chapter 2: Conclusion
In this study, we conducted a comprehensive analysis of the frequency of bee audio signals between 10 Hz and 750 Hz, focusing on the distribution of power and energy utilizing Short-Time Fourier Transform (STFT) and bandpass filtering techniques. Our findings revealed specific frequency bands that are particularly pronounced, shedding light on the acoustic characteristics associated with various hive activities.
By isolating and scrutinizing these frequency ranges, we gained deeper insights into bee communication and the dynamics of hive behavior. The calculations of power and energy across different frequency bands provided a detailed overview of the hive's acoustic environment, illustrating how bees utilize sound for interaction and coordination.
These discoveries not only enhance our understanding of bee acoustics but also pave the way for future research into the relationship between these signals and distinct behaviors or environmental factors. Future studies could explore higher frequency ranges, integrate machine learning models for hive state classification, and correlate audio data with other environmental variables. Such advancements could lead to more effective monitoring of hive health and contribute to the conservation of these essential pollinators.
In summary, this frequency analysis marks a significant step toward decoding the intricate acoustic landscape of bees, offering valuable insights that can benefit both scientific research and practical applications in beekeeping.
Happy coding!