python/demos/demo_filter.py: moved from _a_weighting, clean-up
authorPaul Brossier <piem@piem.org>
Tue, 10 May 2016 16:45:58 +0000 (18:45 +0200)
committerPaul Brossier <piem@piem.org>
Tue, 10 May 2016 16:45:58 +0000 (18:45 +0200)
python/demos/demo_a_weighting.py [deleted file]
python/demos/demo_filter.py [new file with mode: 0755]

diff --git a/python/demos/demo_a_weighting.py b/python/demos/demo_a_weighting.py
deleted file mode 100755 (executable)
index 345e651..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /usr/bin/env python
-
-
-def apply_filter(path, params = {}):
-    from aubio import source, sink, digital_filter
-    from os.path import basename, splitex, splitextt
-    s = source(path)
-    f = digital_filter(7)
-    f.set_a_weighting(s.samplerate)
-    #f = digital_filter(3)
-    #f.set_biquad(...)
-    o = sink("filtered_" + splitext(basename(path))[0] + ".wav")
-    # Total number of frames read
-    total_frames = 0
-
-    while True:
-        samples, read = s()
-        filtered_samples = f(samples)
-        o(samples, read)
-        total_frames += read
-        if read < s.hop_size: break
-    print "filtered", s.uri, "to", o.uri, "using an A-weighting filter"
-
-if __name__ == '__main__':
-    import sys
-    for f in sys.argv[1:]:
-        apply_filter(f)
diff --git a/python/demos/demo_filter.py b/python/demos/demo_filter.py
new file mode 100755 (executable)
index 0000000..345e651
--- /dev/null
@@ -0,0 +1,27 @@
+#! /usr/bin/env python
+
+
+def apply_filter(path, params = {}):
+    from aubio import source, sink, digital_filter
+    from os.path import basename, splitex, splitextt
+    s = source(path)
+    f = digital_filter(7)
+    f.set_a_weighting(s.samplerate)
+    #f = digital_filter(3)
+    #f.set_biquad(...)
+    o = sink("filtered_" + splitext(basename(path))[0] + ".wav")
+    # Total number of frames read
+    total_frames = 0
+
+    while True:
+        samples, read = s()
+        filtered_samples = f(samples)
+        o(samples, read)
+        total_frames += read
+        if read < s.hop_size: break
+    print "filtered", s.uri, "to", o.uri, "using an A-weighting filter"
+
+if __name__ == '__main__':
+    import sys
+    for f in sys.argv[1:]:
+        apply_filter(f)