summarylogtreecommitdiffstats
path: root/numpy.patch
blob: ffd90e7b3cbe61dc2c7d652605493ff323988488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From e5c945a13d6f1d9de1cbb88c2b916fdb0401a5be Mon Sep 17 00:00:00 2001
From: Joost Timmerman <joost@tmmrman.nl>
Date: Sat, 1 Feb 2020 22:52:53 +0100
Subject: [PATCH] Use floor division to get integer values

This resolves an error

  File "/usr/bin/friture", line 10, in <module>
    main()
  ...
  File "/usr/lib/python3.8/site-packages/friture/audioproc.py", line 109, in update_freq_cache
    self.freq = linspace(0, SAMPLING_RATE / (2 * self.decimation), self.fft_size / (2 * self.decimation) + 1)
  ...
TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
---
 friture/audioproc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/friture/audioproc.py b/friture/audioproc.py
index dfce022..da36006 100644
--- a/friture/audioproc.py
+++ b/friture/audioproc.py
@@ -106,7 +106,7 @@ def update_window(self):
     def update_freq_cache(self):
         if len(self.freq) != self.fft_size / (2 * self.decimation) + 1:
             self.logger.info("audioproc: updating self.freq cache")
-            self.freq = linspace(0, SAMPLING_RATE / (2 * self.decimation), self.fft_size / (2 * self.decimation) + 1)
+            self.freq = linspace(0, SAMPLING_RATE // (2 * self.decimation), self.fft_size // (2 * self.decimation) + 1)
 
             # compute psychoacoustic weighting. See http://en.wikipedia.org/wiki/A-weighting
             f = self.freq