bregmanstudio / bregmantoolkit Goto Github PK
View Code? Open in Web Editor NEWAudio and Music Analysis and Synthesis in Python
License: MIT License
Audio and Music Analysis and Synthesis in Python
License: MIT License
I am using the Toolkit in a clustering algorithm with Tensorflow (see https://github.com/BinRoot/TensorFlow-Book/blob/master/ch05_clustering/Concept01_clustering.ipynb).
When the last cell runs, I get this error :
Loading ./audio_dataset/cough_1.wav
INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.CancelledError'>, Enqueue operation was cancelled
[[Node: input_producer/input_producer_EnqueueMany = QueueEnqueueManyV2[Tcomponents=[DT_STRING], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](input_producer, input_producer/RandomShuffle)]]
TypeError Traceback (most recent call last)
in ()
1 with tf.Session() as sess:
2 sess.run((tf.global_variables_initializer(),tf.local_variables_initializer()))
----> 3 X, names = get_dataset(sess)
4 centroids = initial_cluster_centroids(X, k)
5 i, converged = 0, Falsein get_dataset(sess)
8 for _ in range(num_files):
9 plt.figure()
---> 10 chromo_data, filename = get_next_chromogram(sess)
11
12 plt.subplot(1, 2, 1)in get_next_chromogram(sess)
2 audio_file = sess.run(filename)
3 print('Loading {}'.format(audio_file))
----> 4 F = Chromagram(audio_file, nfft=16384, wfft=8192, nhop=2205)
5 return F.X, audio_file/usr/local/lib/python2.7/dist-packages/bregman/features.pyc in init(self, arg, **feature_params)
141 def init(self, arg=None, **feature_params):
142 feature_params['feature']='chroma'
--> 143 Features.init(self, arg, feature_params)
144
145 class HighQuefrencyChromagram(Features):/usr/local/lib/python2.7/dist-packages/bregman/features_base.pyc in init(self, arg, feature_params)
68 if arg:
69 self.load_audio(arg) # open file as MONO signal
---> 70 self.extract()
71
72 def _initialize(self, feature_params):/usr/local/lib/python2.7/dist-packages/bregman/features_base.pyc in extract(self, feature_params)
211 """
212 f = self._check_feature_params(feature_params)['feature']
--> 213 self.extract_funs.get(f, self._extract_error)()
214 if self.onsets: self._extract_onsets()
215/usr/local/lib/python2.7/dist-packages/bregman/features_base.pyc in _chroma(self)
709 lo = self.lo
710 self.lo = 63.5444 # set to quarter tone below C
--> 711 if not self._cqft():
712 return False
713 self.lo = lo # restore original lo edge/usr/local/lib/python2.7/dist-packages/bregman/features_base.pyc in _cqft(self)
586 self._cqft_intensified()
587 else:
--> 588 self._make_log_freq_map()
589 self.CQFT=P.sqrt(P.array(P.mat(self.Q)*P.mat(P.absolute(self.STFT)**2)))
590 self._is_intensified=False/usr/local/lib/python2.7/dist-packages/bregman/features_base.pyc in _make_log_freq_map(self)
351 self._outN = float(self.nfft/2+1)
352 if self._cqtN<1: print "warning: cqtN not positive definite"
--> 353 mxnorm = P.empty(self._cqtN) # Normalization coefficients
354 fftfrqs = self._fftfrqs #P.array([i * self.sample_rate / float(self._fftN) for i in P.arange(self._outN)])
355 logfrqs=P.array([lo_edge * P.exp(P.log(2.0)*i/bpo) for i in P.arange(self._cqtN)])TypeError: 'float' object cannot be interpreted as an index
<matplotlib.figure.Figure at 0x7fc25ed7dfd0>
I've checked and I am using the last update of the BregmanToolkit. Does anybody know how to fix that ?
The tutorials need some updating. Keyword arguments for features are now expanded python dicts, using the **kwargs syntax.
E.g. the following feature instances are equivalent:
LinearFrequencySpectrum(audio_dir+'fastcar.wav', nfft=2048, wfft=1024, nhop=512)
LinearFrequencySpectrum(audio_dir+'fastcar.wav', **{'nfft':2048, 'wfft':1024,'nhop':512})
Any chance support for python3 is in the works? When I try to install I get the following:
sudo python3 setup.py install
Password:
running install
running build
running build_py
running install_lib
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/audiodb.py to audiodb.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/audiodb.py", line 47
print "IOError: Cannot open %s for reading." %(fname)
^
SyntaxError: invalid syntax
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/classifier.py to classifier.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/classifier.py", line 180
print "sse = ", sse
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/error.py to error.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/error.py", line 12
print "Bregman error:", msg
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/features.py to features.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/features.py", line 419
print num_frames, num_hop
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/features_base.py to features_base.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/features_base.py", line 240
print "Error: must extract STFT first"
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/features_mmap.py to features_mmap.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/features_mmap.py", line 22
print fp[m:m+mem_rows,:]
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/segment.py to segment.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/segment.py", line 149
print self.segmentation[seg]
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/sound.py to sound.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/sound.py", line 49
print 'sample_rate=%i' %self.sample_rate
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling /usr/local/lib/python3.6/site-packages/bregman/testsignal.py to testsignal.cpython-36.pyc
File "/usr/local/lib/python3.6/site-packages/bregman/testsignal.py", line 29
print "TestSignal: " + msg
^
SyntaxError: Missing parentheses in call to 'print'
running install_data
running install_egg_info
Removing /usr/local/lib/python3.6/site-packages/Bregman-0.11_11.14-py3.6.egg-info
Writing /usr/local/lib/python3.6/site-packages/Bregman-0.11_11.14-py3.6.egg-info
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.