Code Monkey home page Code Monkey logo

sms-tools's Introduction

sms-tools

Sound analysis/synthesis tools for music applications written in python (with a bit of C) plus complementary teaching materials.

How to use

In order to use these tools you have to install python 3.* (recommended 3.10) and the following modules: ipython, numpy, matplotlib, scipy, and cython.

In Ubuntu you can install these modules by typing in the Terminal:

$ sudo apt-get install python-dev ipython python-numpy python-matplotlib python-scipy cython

In OSX you can install these modules by typing in the Terminal:

$ pip install ipython numpy matplotlib scipy cython

then, to use the tools, after downloading the whole package, you need to compile some C functions. For that you should go to the directory software/models/utilFunctions_C and type:

$ python compileModule.py build_ext --inplace

The basic sound analysis/synthesis functions, or models, are in the directory software/models and there is a graphical interface and individual example functions in software/models_interface. To execute the models GUI you have to go to the directory software/models_interface and type:

$ python models_GUI.py

To execute the transformations GUI that calls various sound transformation functions go to the directory software/transformations_interface and type:

$ python transformations_GUI.py

To modify the existing code, or to create your own using some of the functions, we recommend to use the workspace directory. Typically you would copy a file from software/models_interface or from software/transformations_interface to that directory, modify the code, and execute it from there (you will have to change some of the paths inside the files).

Jupyter Notebooks

A number of teaching exercises are available as jupyter notebooks in the notebook directory. To do them you need to install Jupyter Notebook according to its instructions https://jupyter.org/install

Start up jupyter notebook by typing in the Terminal.

$ jupyter notebook

It will open a web browser, from which you can open the notebook directory.

Content

All the code is in the software directory, with subdirectories for the models, the transformations, and the interfaces. The lecture materials are in the lectures directory, the exercises related to the lectures are in the notebook directory, and the sounds used for the examples and coming from http://freesound.org are in the sounds directory.

License

All the software is distributed with the Affero GPL license (http://www.gnu.org/licenses/agpl-3.0.en.html), the lecture slides are distributed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 (CC BY-NC-SA 4.0) license (http://creativecommons.org/licenses/by-nc-sa/4.0/) and the sounds in this repository are released under Creative Commons Attribution 4.0 (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/)

sms-tools's People

Contributors

ajaysmurthy avatar benjaminolsen avatar blazejkotowski avatar dhunstack avatar dwsdolce avatar eagomez2 avatar edufonseca avatar fabiaserra avatar felixonmars avatar gentlecat avatar i026e avatar jeffhoek avatar jiemojiemo avatar jyotinarang2 avatar kokimame avatar leafac avatar manwithacat avatar melkyades avatar migperfer avatar pelinski avatar qrqiuren avatar sankalpg avatar seeker-liu avatar shtan avatar sugu14 avatar tychobrailleur avatar vsergeev avatar xavierfav avatar xserra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sms-tools's Issues

Timbre preserve

Hi Xavier,

In pitch shift while preserving timbre, the new frequency values outside the old spectrum (range) do not get 0 mag, instead below F0 and above the highest harmonic the spectrum is made constant. This is the way its done in old matlab code. Do we want to do it the same way?

Also there is probably a bug in old matlab code. Instead of Ns in the interp function it should be hNs.

Matplotlib crashing on Mac OS X with solution

I read you do not officially support OS X, but since it is mentioned in the Readme, maybe someone finds it useful or I can make a pull request.

OS X is crashing because of matplotlib, which can be avoided by setting the TkAgg backend explicitly according to http://stackoverflow.com/a/34109240/965686

import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as pet

I do not know if this changes the behaviour of other systems, but I can confirm that it is working on OS X with a Homebrew Python installation.

SMS Tools

Hey guys,

I'm just now starting the course, and I finally was able to run Ubuntu through Virtual Box. But the instructions on the websites have me confused. I entered:

$ sudo apt-get install python-dev ipython python-numpy python-matplotlib python-scipy python-pygame cython

(note, for some reason I was not able to even copy or paste that line of code into the module).

Am I doing something wrong? The SMS Tools Master folder is already downloaded.

Best,
Carl

numpy booleans are not JSON serializable

If a numpy function that returns a numpy boolean such as np.all() is used, such as in A3Part3 where isRealEven is calculated and returned, the JSON serialization in submit.py will fail with the error:

Traceback (most recent call last):
  File "submitA3.py", line 309, in <module>
    submit()
  File "submitA3.py", line 56, in submit
    rep = submitSolution(email, password, output(partIdx), partIdx)
  File "submitA3.py", line 274, in output
    outputString += convertNpObjToStr(ans) + '\n'
  File "submitA3.py", line 209, in convertNpObjToStr
    return json.dumps(obj)
  File "/home/.../.pyenv/versions/2.7.13/lib/python2.7/json/__init__.py", line 244, in dumps
    return _default_encoder.encode(obj)
  File "/home/.../.pyenv/versions/2.7.13/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/home/.../.pyenv/versions/2.7.13/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/home/.../.pyenv/versions/2.7.13/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: True is not JSON serializable

One workaround seems to be to convert isRealEven to a Python bool with isRealEven = bool(np.all(...)).

dft-real-sine.py

import numpy as np
import matplotlib.pyplot as plt
tol = 1e-5

plt.figure(1, figsize=(9.5, 7))
N = 64
k0 = 7.5
X = np.array([])
nv = np.arange(-N/2, N/2)
kv = np.arange(-N/2, N/2)
x = np.cos(2*np.pi*k0/N*nv)
print "x:", x

plt.subplot(311)
plt.title('x; k_0 = 7.5, N = 64')
#plt.plot(nv, np.real(x),'b', lw=1.5)
plt.plot(nv, x,'b', lw=1.5)
plt.axis([-N/2,N/2-1,-1,1])
for k in kv:
        s = np.exp(-1j*2*np.pi*k/N*nv)
        X = np.append(X, sum(x * s))

X.real[np.abs(X.real) < tol] = 0.0
X.imag[np.abs(X.imag) < tol] = 0.0

plt.subplot(312)
plt.title('magnitude spectrum: abs(X)')
plt.plot(kv, abs(X), 'r', lw=1.5)
plt.axis([-N/2,N/2-1,0,N])

plt.subplot(313)
plt.title('phase spectrum: angle(X)')
plt.plot(kv, np.angle(X),'c', lw=1.5)
plt.axis([-N/2,N/2-1,-np.pi,np.pi])

plt.tight_layout()
plt.savefig('dft-real-sine.png')
plt.show()

i removed two functions(real and conjugate) which are not needed

Floating point rounding off bug

software/models/dftModel.py

line 37:
pX = np.unwrap(np.angle(X[:hN])) # unwrapped phase spectrum of positive frequencies

This is a bug because the fft function might return really small values (close to 0) that can be either positive or negative. For example you might get

-0.000000000007 + -.000000000001 j
or
-0.000000000007 + .000000000001 j
or
0.000000000007 + .000000000001 j

but really this is meant to be
0+0j

Those negative or positive signs makes a big difference for what the angle is.

exception for "$python models_GUI.py" step

Mac OS X 10.11.6 El Capitan, XCode 8 installed.

$ python models_GUI.py

2016-09-30 16:32:15.073 python[8744:452491] -[NSApplication _setup:]: unrecognized selector sent to instance 0x107ac9430

2016-09-30 16:32:15.075 python[8744:452491] An uncaught exception was raised

2016-09-30 16:32:15.075 python[8744:452491] -[NSApplication _setup:]: unrecognized selector sent to instance 0x107ac9430

2016-09-30 16:32:15.075 python[8744:452491] (

0 CoreFoundation 0x00007fff908564f2 __exceptionPreprocess + 178

1 libobjc.A.dylib 0x00007fff8bd7973c objc_exception_throw + 48

2 CoreFoundation 0x00007fff908c01ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205

3 CoreFoundation 0x00007fff907c6571 _forwarding_ + 1009

4 CoreFoundation 0x00007fff907c60f8 _CF_forwarding_prep_0 + 120

5 Tk 0x0000000101a52948 TkpInit + 476

6 Tk 0x00000001019cda6e Tk_Init + 1799

7 _tkinter.so 0x00000001002e6a26 Tcl_AppInit + 86

8 _tkinter.so 0x00000001002e43f1 Tkinter_Create + 1185

9 libpython2.7.dylib 0x00000001000a3302 PyEval_EvalFrameEx + 3730

10 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092

11 libpython2.7.dylib 0x0000000100035c1b function_call + 347

12 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97

13 libpython2.7.dylib 0x000000010001e7d7 instancemethod_call + 503

14 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97

15 libpython2.7.dylib 0x00000001000a1874 PyEval_CallObjectWithKeywords + 180

16 libpython2.7.dylib 0x000000010001a771 PyInstance_New + 273

17 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97

18 libpython2.7.dylib 0x00000001000a35a5 PyEval_EvalFrameEx + 4405

19 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092

20 libpython2.7.dylib 0x00000001000ac856 PyEval_EvalCode + 54

21 libpython2.7.dylib 0x00000001000cb3d4 PyRun_FileExFlags + 164

22 libpython2.7.dylib 0x00000001000cc709 PyRun_SimpleFileExFlags + 409

23 libpython2.7.dylib 0x00000001000e01ca Py_Main + 2938

24 python 0x0000000100000f14 start + 52

)

2016-09-30 16:32:15.076 python[8744:452491] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x107ac9430'

*** First throw call stack:

(

0 CoreFoundation 0x00007fff908564f2 __exceptionPreprocess + 178

1 libobjc.A.dylib 0x00007fff8bd7973c objc_exception_throw + 48

2 CoreFoundation 0x00007fff908c01ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205

3 CoreFoundation 0x00007fff907c6571 _forwarding_ + 1009

4 CoreFoundation 0x00007fff907c60f8 _CF_forwarding_prep_0 + 120

5 Tk 0x0000000101a52948 TkpInit + 476

6 Tk 0x00000001019cda6e Tk_Init + 1799

7 _tkinter.so 0x00000001002e6a26 Tcl_AppInit + 86

8 _tkinter.so 0x00000001002e43f1 Tkinter_Create + 1185

9 libpython2.7.dylib 0x00000001000a3302 PyEval_EvalFrameEx + 3730

10 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092

11 libpython2.7.dylib 0x0000000100035c1b function_call + 347

12 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97

13 libpython2.7.dylib 0x000000010001e7d7 instancemethod_call + 503

14 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97

15 libpython2.7.dylib 0x00000001000a1874 PyEval_CallObjectWithKeywords + 180

16 libpython2.7.dylib 0x000000010001a771 PyInstance_New + 273

17 libpython2.7.dylib 0x000000010000c761 PyObject_Call + 97

18 libpython2.7.dylib 0x00000001000a35a5 PyEval_EvalFrameEx + 4405

19 libpython2.7.dylib 0x00000001000ac7dc PyEval_EvalCodeEx + 2092

20 libpython2.7.dylib 0x00000001000ac856 PyEval_EvalCode + 54

21 libpython2.7.dylib 0x00000001000cb3d4 PyRun_FileExFlags + 164

22 libpython2.7.dylib 0x00000001000cc709 PyRun_SimpleFileExFlags + 409

23 libpython2.7.dylib 0x00000001000e01ca Py_Main + 2938

24 python 0x0000000100000f14 start + 52

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Abort trap: 6

$

Compiled and deprecated package warning encountered (might have no prob running it )

thanks for your helpful work.
when compiling I got deprecation warning for numpy.

warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \

my condaenv yml

name: py27
channels:
- conda-forge
- defaults
dependencies:
- backports=1.0=py27_1
- backports.shutil_get_terminal_size=1.0.0=py_3
- backports_abc=0.5=py27_0
- blas=1.1=openblas
- bleach=2.0.0=py27_0
- ca-certificates=2017.11.5=0
- certifi=2017.11.5=py27_0
- configparser=3.5.0=py27_0
- cython=0.27.3=py27_0
- dbus=1.10.22=0
- decorator=4.1.2=py27_0
- entrypoints=0.2.3=py27_1
- enum34=1.1.6=py27_1
- expat=2.2.5=0
- fontconfig=2.12.6=0
- freetype=2.8.1=0
- functools32=3.2.3.2=py27_1
- gettext=0.19.7=1
- glib=2.55.0=0
- gmp=6.1.2=0
- gst-plugins-base=1.8.0=0
- gstreamer=1.8.0=1
- html5lib=1.0.1=py_0
- icu=58.2=0
- ipykernel=4.7.0=py27_0
- ipython=5.5.0=py27_0
- ipython_genutils=0.2.0=py27_0
- ipywidgets=7.1.0=py27_0
- jinja2=2.10=py27_0
- jpeg=9b=2
- jsonschema=2.6.0=py27_0
- jupyter=1.0.0=py27_0
- jupyter_client=5.2.1=py27_0
- jupyter_console=5.2.0=py27_0
- jupyter_core=4.4.0=py_0
- libffi=3.2.1=3
- libiconv=1.15=0
- libpng=1.6.34=0
- libsodium=1.0.15=1
- libxcb=1.12=1
- libxml2=2.9.7=0
- markupsafe=1.0=py27_0
- mistune=0.8.3=py_0
- nbconvert=5.3.1=py_1
- nbformat=4.4.0=py27_0
- ncurses=5.9=10
- notebook=5.2.2=py27_1
- numpy=1.14.0=py27_blas_openblas_200
- openblas=0.2.20=7
- openssl=1.0.2n=0
- pandas=0.22.0=py27_0
- pandoc=2.1=0
- pandocfilters=1.4.1=py27_0
- pathlib2=2.3.0=py27_0
- pcre=8.39=0
- pexpect=4.3.1=py27_0
- pickleshare=0.7.4=py27_0
- pip=9.0.1=py27_1
- prompt_toolkit=1.0.15=py27_0
- ptyprocess=0.5.2=py27_0
- pygments=2.2.0=py27_0
- pyqt=5.6.0=py27_4
- python=2.7.14=4
- python-dateutil=2.6.1=py27_0
- pytz=2017.3=py_2
- pyzmq=16.0.2=py27_3
- qt=5.6.2=7
- qtconsole=4.3.1=py27_0
- readline=7.0=0
- scandir=1.6=py27_0
- scipy=1.0.0=py27_blas_openblas_201
- setuptools=38.4.0=py27_0
- simplegeneric=0.8.1=py27_0
- singledispatch=3.4.0.3=py27_0
- sip=4.18=py27_1
- six=1.11.0=py27_1
- sqlite=3.20.1=2
- ssl_match_hostname=3.5.0.1=py27_1
- terminado=0.8.1=py27_0
- testpath=0.3.1=py27_0
- tk=8.6.7=0
- tornado=4.5.3=py27_0
- traitlets=4.3.2=py27_0
- wcwidth=0.1.7=py27_0
- webencodings=0.5=py27_0
- wheel=0.30.0=py27_2
- widgetsnbextension=3.1.0=py27_0
- xorg-libxau=1.0.8=3
- xorg-libxdmcp=1.1.2=3
- xz=5.2.3=0
- zeromq=4.2.1=1
- zlib=1.2.11=0
- libgfortran=3.0.0=1
- pip:
  - backports-abc==0.5
  - backports.shutil-get-terminal-size==1.0.0
  - backports.ssl-match-hostname==3.5.0.1
  - ipython-genutils==0.2.0
  - jupyter-client==5.2.1
  - jupyter-console==5.2.0
  - jupyter-core==4.4.0
  - prompt-toolkit==1.0.15
prefix: /home/seonils/anaconda3/envs/py27

I think it would be better to use up-to-date packages (e.g. numpy)
thanks

Complie C - OS X ImportError: No module named Cython.Distutils

When trying to run python compileModule.py build_ext --inplace I'm getting the error:

File "compileModule.py", line 4, in <module> from Cython.Distutils import build_ext ImportError: No module named Cython.Distutils

Can anyone help to solve this?

I'm on Mac OS X - Cython installed via pip:
pip install Cython Requirement already satisfied: Cython in /usr/local/lib/python2.7/site-packages

But no modules are found...

Problem running models_GUI.py

I already compiled the Cython files but I can't run models_GUI.py

I'm using OS X 10.12.5 and Python 2.7.13 through terminal. I want to avoid installing Anaconda as another user suggested if possible. Any help is appreciated, thanks!

> MacBook-Pro-de-Esteban:models_interface eagomez$ python models_GUI.py
>   File "models_GUI.py", line 9
>     except ImportError
>                      ^
> SyntaxError: invalid syntax
> MacBook-Pro-de-Esteban:models_interface eagomez$ 

OS X 10.6.8 - Tkinter crashing _GUI scripts

Hi, after spending a lot of time configuring to successfully install Essentia for the ASPMA course, I now find that python is crashing when running the _GUI scripts. I believe it has something to do with Tkinter, but I'm pretty much at sea here. I brew installed python 2.7.10 for the Essentia install, and it was running fine until I managed to get Essentia working (also brewed).

It's a bit aggravating.

Oh, I also have RStudio installed, which I believe may affect the Tk/Tcl libraries. But not quite sure how to proceed. Thanks.


In [3]: run models_GUI.py
2015-11-19 17:13:49.671 Python[12806:60f] -[NSApplication _setup:]: unrecognized selector sent to instance 0x103256090
2015-11-19 17:13:49.673 Python[12806:60f] An uncaught exception was raised
2015-11-19 17:13:49.673 Python[12806:60f] -[NSApplication _setup:]: unrecognized selector sent to instance 0x103256090
2015-11-19 17:13:49.723 Python[12806:60f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x103256090'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff8a469784 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff86a0ef03 objc_exception_throw + 45
2 CoreFoundation 0x00007fff8a4c3110 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
3 CoreFoundation 0x00007fff8a43b8ef forwarding + 751
4 CoreFoundation 0x00007fff8a437a38 _CF_forwarding_prep_0 + 232
5 Tk 0x0000000105d54bee TkpInit + 545
6 Tk 0x0000000105ccae09 Initialize + 1645
7 _tkinter.so 0x0000000105b8b881 Tcl_AppInit + 75
8 _tkinter.so 0x0000000105b8b7ca Tkinter_Create + 1171
9 Python 0x0000000100092717 PyEval_EvalFrameEx + 16462
10 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
11 Python 0x000000010002ee20 function_call + 345
12 Python 0x000000010000b9a6 PyObject_Call + 112
13 Python 0x000000010001bbd3 instancemethod_call + 389
14 Python 0x000000010000b9a6 PyObject_Call + 112
15 Python 0x000000010008d95d PyEval_CallObjectWithKeywords + 175
16 Python 0x000000010001b4f7 PyInstance_New + 309
17 Python 0x000000010000b9a6 PyObject_Call + 112
18 Python 0x0000000100092a6e PyEval_EvalFrameEx + 17317
19 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
20 Python 0x000000010009465c PyEval_EvalCode + 54
21 Python 0x00000001000ac632 run_mod + 66
22 Python 0x00000001000ac6fb PyRun_FileExFlags + 150
23 Python 0x000000010008c0de builtin_execfile + 434
24 Python 0x0000000100092fb7 PyEval_EvalFrameEx + 18670
25 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
26 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
27 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
28 Python 0x000000010002ee20 function_call + 345
29 Python 0x000000010000b9a6 PyObject_Call + 112
30 Python 0x0000000100092fcf PyEval_EvalFrameEx + 18694
31 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
32 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
33 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
34 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
35 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
36 Python 0x000000010002ee20 function_call + 345
37 Python 0x000000010000b9a6 PyObject_Call + 112
38 Python 0x0000000100092fcf PyEval_EvalFrameEx + 18694
39 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
40 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
41 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
42 Python 0x000000010002ee20 function_call + 345
43 Python 0x000000010000b9a6 PyObject_Call + 112
44 Python 0x0000000100092fcf PyEval_EvalFrameEx + 18694
45 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
46 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
47 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
48 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
49 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
50 Python 0x0000000100090478 PyEval_EvalFrameEx + 7599
51 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
52 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
53 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
54 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
55 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
56 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
57 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
58 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
59 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
60 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
61 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
62 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
63 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
64 Python 0x000000010002ee20 function_call + 345
65 Python 0x000000010000b9a6 PyObject_Call + 112
66 Python 0x0000000100092fcf PyEval_EvalFrameEx + 18694
67 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
68 Python 0x0000000100092904 PyEval_EvalFrameEx + 16955
69 Python 0x00000001000945c9 PyEval_EvalCodeEx + 1890
70 Python 0x000000010009465c PyEval_EvalCode + 54
71 Python 0x00000001000ac632 run_mod + 66
72 Python 0x00000001000ac6fb PyRun_FileExFlags + 150
73 Python 0x00000001000ada57 PyRun_SimpleFileExFlags + 735
74 Python 0x00000001000bf869 Py_Main + 3060
75 Python 0x0000000100001f1c 0x0 + 4294975260
76 ??? 0x0000000000000002 0x0 + 2
)
terminate called after throwing an instance of 'NSException'
Abort trap

Suggestion: use conda manage packages and environment

I got some errors where i use this tool and mostly due to the environment or some package version, such as #49

So i wander if this project can use conda which is a good package management system and environment management system to manage these kind of scientific packages.

This would be a friendly feature to our beginners who are troubling with debugging on how-to-get-it -work questions

Fix test function

Function to test whether all imports are done fine and the functions are running file is broken because of lots of changes.

Once the code is stable this function should be fixed.

Issue launching models_GUI.py on raspberry pi

Hi,

I'm using my raspberry pi with the raspbian os to run those examples. All the installations went fine.
But I've got the following error when launching models_GUI.py :
Traceback (most recent call last):
File "models_GUI.py", line 14, in
root = Tk( )
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

python-tk is installed with its last version.

Any help more than welcome :)

Thanks

spyder(python 2.7) instead of linux

Hello,
I have been using spyder(python 2.7) in windows instead of using ubuntu.
I have been facing a problem with importing utilFunction.py as shown in your programming lecture:Fourier properties(week 3).

Tests for Week 4 give different answers on current versions of numpy and scipy.

I had failures for all of my tests in part 3 of the week 4 assignment because apparently there is some difference in the versions of scipy/numpy provided through the Ubuntu repositories and the latest versions you can get through pip or conda that gives different results.

I think you need to specify the versions of numpy and scipy (1.11.0 and 0.17.0) to be used. I'm not sure which result is correct but there's definitely been a change in the calculations between this version and the current one.

GUI crashing on Ubuntu 16 LTS (Miniconda, python 2/3) - FIX

Not sure if anyone else has this problem, but none of the windows with plots would render at all. Simple solution was to put

import matplotlib
matplotlib.use('TkAgg')

out of if statement (it didn't execute, but seems it should have)

so my final models_GUI.py looks like

import sys
if sys.platform == 'darwin':
    print("True")
import matplotlib
matplotlib.use('TkAgg')

try:
#rest of code

Now it works with both python 2 and 3

Cannot compile C functions

On running the build command: python compileModule.py build_ext --inplace, I get the following:

running build_ext
skipping 'cutilFunctions.c' Cython extension (up-to-date)
building 'utilFunctions_C' extension
error: Unable to find vcvarsall.bat

I am using Windows 10 and Python 2.7.10.

SSL Handshake issue on submit

OS X Homebrew Python 2.7 , get the following issue when running python submitA2.py.

requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

Maybe an issue on my end or maybe a bad certificate?

Convert assignments to Python Notebook?

Would the course proctors and repo owner be open if I created a PR with the assignments converted into a python notebook? Seems it would be a good idea for the plotting components later in the class, bring everything into the modern workflow so to speak..

thoughts?

yhlocs

We generate all harmonic locations in genSpecSines at each frame, whereas some of them are always not valid or are zero valued. Such peaks shouldn't be passed to genSpecSines.

Can't run models_interface.py on OSX 10.11

I was able to compile with python compileModule.py build_ext --inplace.

I get this error:

2016-05-01 12:09:49.067 Python[39914:2885834] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7f9d2307e870'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff900bf4f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff8d432f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff901291ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff9002f571 ___forwarding___ + 1009
    4   CoreFoundation                      0x00007fff9002f0f8 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x0000000102c69948 TkpInit + 476
    6   Tk                                  0x0000000102be4a6e Tk_Init + 1799
    7   _tkinter.so                         0x0000000102ac4ced Tcl_AppInit + 82
    8   _tkinter.so                         0x0000000102ac04b8 Tkinter_Create + 1084
    9   Python                              0x00000001025369af PyEval_EvalFrameEx + 14722
    10  Python                              0x0000000102532df9 PyEval_EvalCodeEx + 1412
    11  Python                              0x00000001024d731c function_call + 350
    12  Python                              0x00000001024b93b6 PyObject_Call + 99
    13  Python                              0x00000001024c41a5 instancemethod_call + 174
    14  Python                              0x00000001024b93b6 PyObject_Call + 99
    15  Python                              0x0000000102538d9b PyEval_CallObjectWithKeywords + 93
    16  Python                              0x00000001024c241f PyInstance_New + 126
    17  Python                              0x00000001024b93b6 PyObject_Call + 99
    18  Python                              0x0000000102535e8c PyEval_EvalFrameEx + 11871
    19  Python                              0x0000000102532df9 PyEval_EvalCodeEx + 1412
    20  Python                              0x000000010253286f PyEval_EvalCode + 54
    21  Python                              0x0000000102552a2a run_mod + 53
    22  Python                              0x0000000102552acd PyRun_FileExFlags + 133
    23  Python                              0x000000010255266a PyRun_SimpleFileExFlags + 769
    24  Python                              0x0000000102563d6f Py_Main + 3051
    25  libdyld.dylib                       0x00007fff9c17b5ad start + 1
    26  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
zsh: abort      python models_GUI.py

Cannot compile functions in C

Hi everyone,
I am trying to install and use the sms-tools on Mac OS X 10.6.8. I previously had installed Anaconda on my computer, to get all necessary modules for the sms-tools. I get stuck at the compilation of the functions in C, after which I get this error:

MacBook-Pro-de-Julie-Delisle:utilFunctions_C juliedelisle$ python compileModule.py build_ext --inplace
Traceback (most recent call last):
File "compileModule.py", line 5, in
import numpy
File "/Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/init.py", line 184, in
from . import add_newdocs
File "/Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/core/init.py", line 14, in
from . import multiarray
ImportError: dlopen(/Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/core/multiarray.so, 10): Symbol not found: _strnlen
Referenced from: /Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/core/../../../..//libmkl_intel_lp64.dylib
Expected in: flat namespace
in /Users/juliedelisle/anaconda/lib/python2.7/site-packages/numpy/core/../../../..//libmkl_intel_lp64.dylib

Have anyone experienced this? How can I fix this?
Thanks!

Copyright issues, users constantly ignore copyright

Hello, I'm a volunteer moderator at freesound.org

A lot of users are uploading their sounds to freesound using the sounds in this package as sources.

Most provide info about the sounds being related to the course and some link to this repository or the collection on freesound but rarely people attribute the original copyright holders, which is required by ccby and ccbync licenses.

In this repository, no attribution is given to the copyright holders of the sounds.This ignores the requirement for attribution.

In the readme it is stated that the sounds are cc-by-sa-nc licensed, which one may not do, if they only redistribute (rather than remix) a cc-by or cc-by-nc licensed sound ( https://creativecommons.org/licenses/by/3.0/legalcode 4.a "You may not sublicense the Work." )

If the sounds really were cc-by-sa-nc, remixes could also not be uploaded to freesound, as such a license is incompatible to the ones available there (probably due to its impracticability).

As a result I keep writing the following message to them.

Hello,

Your course material doesn't explain the importance of copyright when using 3rd party works.

The sounds you use most likely require attribution. Some might prohibit commercial use.

When you upload sounds to freesound, you pick one of 3 licenses, one of which prohibits commercial use and requires attribution, one only requires attribution and one requires nothing.

You need to check what the original sound requires and possibly change the license of you upload accordingly. Double-check the changes.

If the original sound requires attribution, you need to put a link in the description of your upload to the original.

Find the link to the sound you used in
http://freesound.org/home/attribution/ and put it in your description. Do not just link to a user or collection.

Double-check after editing.

Thanks!

All this wastes time of moderators and of course participants.

Please

  1. follow the license attribution requirements to set a good example to your course participants
  2. make an effort to teach course participants that they have to give attribution to the original sound copyright holders if the license requires it.

alternatively you could switch to using cc0 sounds only.

Removing redundant lines from code

Maybe remove the lines you added for energy normalization, just to have a cleanand nice looking code. I don't think we will use it anyway.

BTW, I wrote this just to check how does this issue tracker work. Don't get surprised. Just want to know how to use this in a good way :)

virtualenv procedure in Readme file

Hello,

Perhaps using virtualenv for the installation would be better since it creates an environment that is segregated from the system wide installations. It would also be the same procedure for Mac OS X.

I can gladly work on a PR to update the README file, would that be of interest?

module import error not clear

When the cython modules have not been compiled, the exception raised is 'module cannot be imported', which is not clear and does not say what exactly has happened. The message can be made more clear to indicate that.

Plotting the spectrum in stft model does not work. (with fix)

When I try to plot the result of stft, the spectrum is missing, and in
software/models_interface/stft_function.py
in lines 59 and 70 I got the error 'TypeError: slice indices must be integers or None or have an index method'
I could fix it by casting the index to int, and now the plot works again
l. 59 plt.pcolormesh(frmTime, binFreq, np.transpose(mX[:,:int(Nmaxplotfreq/fs+1)]))
l. 70 plt.pcolormesh(frmTime, binFreq, np.transpose(np.diff(pX[:,:int(N
maxplotfreq/fs+1)],axis=1)))

Cannot compile C functions

karthik@kaka:~/learning/audio_signal_processing/sms-tools-master/software/models/utilFunctions_C$ python compileModule.py build_ext --inplace
Traceback (most recent call last):
File "compileModule.py", line 5, in
import numpy
File "/home/karthik/.local/lib/python2.7/site-packages/numpy/init.py", line 180, in
from . import add_newdocs
File "/home/karthik/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/home/karthik/.local/lib/python2.7/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/home/karthik/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/home/karthik/.local/lib/python2.7/site-packages/numpy/core/init.py", line 14, in
from . import multiarray
ImportError: /home/karthik/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: _PyUnicodeUCS4_IsWhitespace

Can someone help me to fix this issue?

Suggestion: submitAX.py command line option support

It would be helpful to support the specification of a student's email address and assignment token on the command line, to help reduce needless retyping and support integration with IDEs (for configuring submit macros).

E.g.

python submitA1.py ---email [email protected] --token ABCDEF12345678

If omitted, the program would prompt as it does now.

Also, consider allowing specification of the parts to submit:

python submitA1.py --part 1
python submitA1.py --part 1 --part 2
python submitA1.py --part all

Easily implemented with argparse and I can submit a PR on A1's script if it will be considered - please advise.

Extended support might include lists and ranges, but this is less important:

python submitA1.py --part 1,2,3   # list
python submitA1.py --part 1-3     # range

A3Part4 ValueError "numpy.dtype has the wrong size"

I get this error when trying to run an unedited version of A3Part4.py:

../../software/models/utilFunctions.py:10: RuntimeWarning: compiletime version 2.7 of module 'utilFunctions_C' does not match runtime version 2.6
import utilFunctions_C as UF_C
Traceback (most recent call last):
File "...sms-tools-master/workspace/A3/A3Part4.py", line 3, in
from dftModel import dftAnal, dftSynth
File "../../software/models/dftModel.py", line 7, in
import utilFunctions as UF
File "../../software/models/utilFunctions.py", line 10, in
import utilFunctions_C as UF_C
File "numpy.pxd", line 155, in init utilFunctions_C (cutilFunctions.c:4785)
ValueError: numpy.dtype has the wrong size, try recompiling
[Finished in 0.6s with exit code 1]

...

I have tried updating and recompiling utilFunctions to no avail

issue opening stft file

Mandars-MacBook-Pro:models_interface Mandar$ python models_gui.py
Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1542, in call
return self.func(args)
File "/Users/Mandar/Downloads/Downloads/ASP/sms-tools-master/software/models_interface/stft_GUI_frame.py", line 108, in compute_model
stft_function.main(inputFile, window, M, N, H)
File "/Users/Mandar/Downloads/Downloads/ASP/sms-tools-master/software/models_interface/stft_function.py", line 59, in main
plt.pcolormesh(frmTime, binFreq, np.transpose(mX[:,:N
maxplotfreq/fs+1]))
TypeError: slice indices must be integers or None or have an index method

submit scripts don't work well with older Python 2.7

An attempt to submit a result to coursera (at least in A1, using submitA1.py) results in:

urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

or with requests:

requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

This is caused by lack of SNI (https://en.wikipedia.org/wiki/Server_Name_Indication) support in python ssl libraries up to and including python 2.7.8. SNI support is required for HTTPS access to www.coursera.org.

Python 2.7.9 has a backported ssl module from Python 3.4, I think it should work fine. For Python <2.7.9, as a workaround one can install packages "pyopenssl", "pyasn1" and "ndg-httpsclient". This is an alternative to built-in ssl/urllib package that will be used by "requests" if present.

It would be useful to check the Python version in submission scripts and print the warning about pyopenssl/pyasn1/ndg-httpsclient if SSL exception is raised from requests.post().

Reconstructing spectrum using only positive half

For reconstructing a spectrum using only the positive half of it, for a even sized window (N) we need to store N/2 +1 number of samples (mX). Currently we store only N/2 number of samples which leaves one sample to have a value zero. Edit this in all the files concerning this concept.

Compilation issues on linux/ubuntu (12.04 LTS)

So I set up a virtual machine with the above linux and install all the dependencies mentioned (seems to have installed fine - can import all of them in an interactive session)

I run

$ python compileModule.py build_ext --inplace
I get:
running build_ext
skipping 'cutilFunctions.c' Cython extension (up-to-date)

Then when I do
$ python models_GUI.py

I get the following warning and nothing happens:

Warning:
Cython modules for some of the core functions were not imported.
Please refer to the README file for the instructions to compile the cython modules

Exiting the code!!

Any help is appreciated. Thanks.

Unit tests

Since now we are making lots of changes in many basic functions which are imported in many other functions, we need a function to run all unit tests for all the models.

Not a urgency but we need it soon. Before we commit big changes in our code , we need to make sure we get through these tests.

Misleading Error Message within the submit.py "file output data type of your function doesn't match..."

This error message "Type error in Part ... - The output data type of your function doesn't match the expected data type: (<type 'numpy.ndarray'>)" is very misleading.

That error message is generated when ever a response doesn't match the expected data type. But what happens when there is NO RESPONSE ? That error message doesn't help the user in the least.

Based on the testing actually performed within submitA2.py, the error message should probably say "Error in Part x.. Either the return response from your function call is missing (e.g. None), or the output data type of your function doesn't match the expected data type..."

Actually its probably better to just add another test for the presence of an answer, with an accurate error message, before testing for return type. (proposed error message: Oops.. no data received from your function call ! )

use testing? what if the user forgot to return x or in my case I did all of my original work in a copied file A2Part1_my_initials.py . It's not a surprise that the submit wasn't finding anything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.