commit 5e7efdd7db56fef5ed6c2ff9b416a92a96bde4a3 Author: Matthew Date: Sat Mar 22 10:31:35 2025 -0400 Initial commit diff --git a/concept_fig.png b/concept_fig.png new file mode 100644 index 0000000..1c88203 Binary files /dev/null and b/concept_fig.png differ diff --git a/sound_profile.py b/sound_profile.py new file mode 100644 index 0000000..85cbd36 --- /dev/null +++ b/sound_profile.py @@ -0,0 +1,48 @@ +import matplotlib.pyplot as plt +import numpy as np +import random +import acoustics.decibel as db + + +freq_upper = 1000 #size of the frequency spectrum we want to investigate +freq_div = 10 + +x = np.array(range(freq_upper)) #initialize frequencies (x-axis) +bkgd = np.zeros(freq_upper) +source = np.zeros(freq_upper) + +for i in range(len(bkgd)): + bkgd[i] = np.log((x[i]+1)/freq_div) #input model for background here. each freq is assigned an SNR + +tonals = [20,40,100,500, 800] #build our threat object here +widths = [2,2,2,2,2] #how diffuse is each tonal +decr = [.5,.5,.5,.95,.98] #sound decrement from ambient + + +for i in range(len(source)): + source[i] = random.randint(0,10)/200 + + +for tone,wide,loud in zip(tonals, widths, decr): #right now the source is based on bkgd + freq = tone - wide//2 #strength, but we will need to just + while freq < tone + wide//2: #assign values + source[freq] = bkgd[freq]*(1-loud) # + freq += 1 # + + +received = db.dbadd(bkgd, source) + + +plt.plot(x/freq_div,received, label = "Legacy") +plt.plot(x/freq_div,source, label = "Distilled") +plt.xlabel("freq (Hz)") +plt.ylabel("SNR") +plt.title("Concept") + +plt.legend() +plt.show() + + + + +