This commit is contained in:
billypom on debian 2024-08-03 10:45:11 -04:00
parent 97918aeaf5
commit 4accd6609c
3 changed files with 8 additions and 7 deletions

View File

View File

@ -65,11 +65,11 @@ class MainWindow(QMainWindow):
# Graphics plot # Graphics plot
self.PlotWidget.setXRange(0, 100, padding=0) # x axis range self.PlotWidget.setXRange(0, 100, padding=0) # x axis range
self.PlotWidget.setYRange(0, 0.3, padding=0) # y axis range self.PlotWidget.setYRange(0, 0.8, padding=0) # y axis range
# Remove axis labels and decorations
# self.PlotWidget.setLogMode(False, False)
self.PlotWidget.getAxis("bottom").setTicks([]) # Remove x-axis ticks self.PlotWidget.getAxis("bottom").setTicks([]) # Remove x-axis ticks
self.PlotWidget.getAxis("bottom").setLabel("") # Remove x-axis label self.PlotWidget.getAxis("bottom").setLabel("") # Remove x-axis label
self.PlotWidget.setLogMode(False, False)
# Remove y-axis labels and decorations
self.PlotWidget.getAxis("left").setTicks([]) # Remove y-axis ticks self.PlotWidget.getAxis("left").setTicks([]) # Remove y-axis ticks
self.PlotWidget.getAxis("left").setLabel("") # Remove y-axis label self.PlotWidget.getAxis("left").setLabel("") # Remove y-axis label

View File

@ -22,13 +22,13 @@ class FFTAnalyser(QtCore.QThread):
self.resolution = 100 self.resolution = 100
self.visual_delta_threshold = 1000 self.visual_delta_threshold = 1000
self.sensitivity = 5 self.sensitivity = 10
def reset_media(self): def reset_media(self):
"""Resets the media to the currently playing song.""" """Resets the media to the currently playing song."""
audio_file = self.player.currentMedia().canonicalUrl().path() audio_file = self.player.currentMedia().canonicalUrl().path()
if os.name == "nt" and audio_file.startswith("/"): # if os.name == "nt" and audio_file.startswith("/"):
audio_file = audio_file[1:] # audio_file = audio_file[1:]
if audio_file: if audio_file:
try: try:
self.song = AudioSegment.from_file(audio_file).set_channels(1) self.song = AudioSegment.from_file(audio_file).set_channels(1)
@ -57,6 +57,7 @@ class FFTAnalyser(QtCore.QThread):
freq = np.fft.fftfreq(fourier.size, d=0.05) freq = np.fft.fftfreq(fourier.size, d=0.05)
amps = 2 / v_sample.size * np.abs(fourier) amps = 2 / v_sample.size * np.abs(fourier)
data = np.array([freq, amps]).T data = np.array([freq, amps]).T
print(data)
point_range = 1 / self.resolution point_range = 1 / self.resolution
point_samples = [] point_samples = []
@ -97,7 +98,7 @@ class FFTAnalyser(QtCore.QThread):
self.points[n] = 1e-5 self.points[n] = 1e-5
# interpolate points # interpolate points
rs = gaussian_filter1d(self.points, sigma=2) rs = gaussian_filter1d(self.points, sigma=1)
# Mirror the amplitudes, these are renamed to 'rs' because we are using them # Mirror the amplitudes, these are renamed to 'rs' because we are using them
# for polar plotting, which is plotted in terms of r and theta # for polar plotting, which is plotted in terms of r and theta