You can subscribe to this list here.
2006 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}

_{Aug}

_{Sep}

_{Oct}
(6) 
_{Nov}

_{Dec}


2007 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}
(3) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

2010 
_{Jan}
(2) 
_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}

_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

S  M  T  W  T  F  S 

1

2

3

4

5

6

7
(1) 
8

9

10
(2) 
11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31





From: edu <moguillansky@gm...>  20070710 18:19:53

I cannot reproduce the segfaults with that you report > with the latest Easdif (version 1.3.1) > which you find in cvs and with swig 1.3.31. Both methods work > perfectly for me under linux and the sample script test.py > that you can find in the swig/python directory. > > What os are you working with? > Hi. I'm using linux>debian/sid, Easdif 1.3.0, using SWIG 1.3.31. I will try 1.3.31 and see if I still get the segfaults. I can confirm that the problem is from SWIG because accessing directly the library with python/ctypes works ok. > > > Also, in order to read the matrix more efficiently in python, I > > > implemented small helper functions in sdif_matrix.cpp to read a whole > > > matrix into a python array.. > > what would that look like? If it could be of general use I > could put it into the official source. > Here are the extra functions to access matrices either as a whole or the rows/cols. The caller is responsible for allocating and deallocating the array. On the python side, the arrays are actually numpy arrays of the desired type (no need to deallocate anything). The caller is also responsible for sending an array of the right size. In the SWIG interface file this should be implemented to use numpy arrays (not normal lists, which is what SWIG does by default). I found it a bit troublesome to get the typemaps work correctly in SWIG and on the profiling I did, the ctypes module in python is in fact more efficient than SWIG, but of course it would be more elegant to have all done with SWIG, as it is much easier to maintain. The python module sdiflib is a wrapper on eaSDIF to make it still easier to read / write sdifs. Insbesondere it uses a double implementation which allows to iterate through the data as: import sdiflib entity = sdiflib.Entity('mysdif.sdif' [,selection=':1TRC/1TRC']) for frame in entity: for matrix in frame: data = matrix() # data is now a numpy array holding the whole matrix or for frame in entity: matrix = frame[0] # do something with matrix and also entity(t, y) > returns an interpolation of matrix at y of the frames before and after t This is only useful if wanting to access a specific part of the data. matrices having the same size are buffered on the python side so for sdifs like 1GB0 allocation is done only once. The caller is responsible to copy the data if needed. here are the added functions (only interface code actually): extern "C" void Matrix_GetRow_double(Easdif::SDIFMatrix* matrix, int irow, double* out) { matrix>mInter>GetRow(&(out[0]), irow); } extern "C" void Matrix_GetCol_double(Easdif::SDIFMatrix* matrix, int icol, double* out) { matrix>mInter>GetCol(&(out[0]), icol); } extern "C" void Matrix_GetRows_double(Easdif::SDIFMatrix* matrix, int row0, int row1, double* out) { for (int row = row0; row < row1; row++) { matrix>mInter>GetRow(&(out[row]), row); } } extern "C" void Matrix_GetRow_int(Easdif::SDIFMatrix* matrix, int irow, int* out) { matrix>mInter>GetRow(&(out[0]), irow); } extern "C" void Matrix_GetCol_int(Easdif::SDIFMatrix * matrix, int icol, int * out) { matrix>mInter>GetCol(&(out[0]), icol); } extern "C" void Matrix_GetRows_int(Easdif::SDIFMatrix * matrix, int row0, int row1, int * out) { for (int row = row0; row < row1; row++) { matrix>mInter>GetRow(&(out[row]), row); } } extern "C" void Matrix_GetRow_float(Easdif::SDIFMatrix * matrix, int irow, float * out) { matrix>mInter>GetRow(&(out[0]), irow); } extern "C" void Matrix_GetCol_float(Easdif::SDIFMatrix * matrix, int icol, float * out) { matrix>mInter>GetCol(&(out[0]), icol); } extern "C" void Matrix_GetRows_float(Easdif::SDIFMatrix * matrix, int row0, int row1, float * out) { for (int row = row0; row < row1; row++) { matrix>mInter>GetRow(&(out[row]), row); } } extern "C" int Matrix_GetNbRows(Easdif::SDIFMatrix * matrix) { return matrix>GetNbRows(); } extern "C" int Matrix_GetNbCols(Easdif::SDIFMatrix * matrix) { return matrix>GetNbCols(); } extern "C" void Matrix_SetRows_double(Easdif::SDIFMatrix * matrix, double * in, int nrows) { int num_cols = matrix>GetNbCols(); for (int row = 0; row < nrows; row++) { matrix>mInter>SetRow(&(in[row * num_cols]),row); } } extern "C" void Matrix_SetRows_float(Easdif::SDIFMatrix * matrix, float * in, int nrows) { int num_cols = matrix>GetNbCols(); for (int row = 0; row < nrows; row++) { matrix>mInter>SetRow(&(in[row * num_cols]),row); } } extern "C" void Matrix_SetRows_int(Easdif::SDIFMatrix * matrix, int * in, int nrows) { int num_cols = matrix>GetNbCols(); for (int row = 0; row < nrows; row++) { matrix>mInter>SetRow(&(in[row * num_cols]),row); } } extern "C" void Matrix_SetRow_int(Easdif::SDIFMatrix * matrix, int irow, int * in) { matrix>mInter>SetRow(&(in[0]), irow); } extern "C" void Matrix_SetRow_float(Easdif::SDIFMatrix * matrix, int irow, float * in) { matrix>mInter>SetRow(&(in[0]), irow); } extern "C" void Matrix_SetRow_double(Easdif::SDIFMatrix * matrix, int irow, double * in) { matrix>mInter>SetRow(&(in[0]), irow); } 
From: Axel Roebel <Axel.Roebel@ir...>  20070710 13:53:41

On Saturday 07 July 2007, edu wrote: > hi. > for personal use i implemented a wrapper to wrap the python bindings of > Easdif. While doing that I noticed some problems with the SWIG bindings, > which are independent of the SWIG version (I tried ALL of them): > Matrix.GetNbRows and Matrix.GetNbCols result always in segfaults. Hello Eduardo, I am happy to see that you have been making such nice use of the Easdif library. I cannot reproduce the segfaults with that you report with the latest Easdif (version 1.3.1) which you find in cvs and with swig 1.3.31. Both methods work perfectly for me under linux and the sample script test.py that you can find in the swig/python directory. What os are you working with? > Also, in order to read the matrix more efficiently in python, I > implemented small helper functions in sdif_matrix.cpp to read a whole > matrix into a python array.. what would that look like? If it could be of general use I could put it into the official source. > This changes are not reflected in the SWIG bindings: since these > functions are used for interfacing with numpy arrays (c arrays in > python), I access the shared library directly from python and map the > data to the python arrays. > In this way, you can do, in python: > > from sdiflib import * > entity = Entity('my_sdif_file.sdif', selection=':1GB1/1GB1') # > selection is optional > for frame in entity: > for matrix in frame: > print matrix()[0:100] # will print the first 100 rows in all > the matrices > > given that the sdif has matrices of constant size, the reading is > buffered and you can do interpolation without reading everything first > into memory. (not possible with partial tracking, still) > > entity = Entity('my_very_big_spectral_envelope.sdif', > selection=':1GB1/1GB1') > print entity(10.5, 300) > > will print the value of the spectral envelope at time=10.5 secs at > frequency 300Hz. Values are interpolated linearly by default. > > Based on this library, I made a python module to talk to supervp and > pm2. At the moment some features are still not implemented (gabarit > filter, surface filter) but besides that, everything seems to work quite > good. This library works both in OSX and Linux. It also integrates > audiosculpt's kernels with libraries like Loris and aubio. > > you can do things like: > > from audiosculpt import * > sp = SpectralEnvelope(An('source.aiff', ws=4000), order=30) > sp.plot3d() # will plot a 3d image of sp > print sp(10.5, 300) # print the value at time=10.5sec, freq=300Hz > sp *= 0.5 # scale all the values > sp.write('out.sdif') # write the new results > > > even more, you can do: > > sp0 = SpectralEnvelope(An('source.aiff', ws=4000), order=30) > sp1 =SpectralEnvelope(An('source.aiff', ws=4000), order=2000) > interpolation_bpf = bpf.HalfCos((0,0), (10, 1)) > interpolated_envelope = sp0 * interpolation_bpf + sp1 * (1  > interpolation_bpf) > > out = FilterBreakpnt(An('white_noise.aiff', ws=4000), > interpolated_envelope) # this will call supervp to produce a breakpoint > filter calculated out of the > # interpolation of the two spectral envelopes with the given shape > (halfcos interpolation > # in 10 seconds). This could of course be done > # quite easily with envscal filter, but this is just a very easy > example. Once gabarit > # filter is supported, it will be much more efficient, of course. > > mask = MaskingEffect(An('source.aiff', ws=4000)) > > print mask(1, 300) # print the weight of the spectrum at time=1sec, > freq=300Hz > mask.plot() # plot the results as a surface plot > out = FilterBreakpnt(An('white_noise.aiff', ws=4000), sp * mask) > # will filter the white noise file only at the places where > # the source file has relevant spectral information > # (otherwise weight=0 > result = 0) > > > if someone is interested, I can post the sources. > > cheers, > > Eduardo Moguillansky > > > > >  > This SF.net email is sponsored by DB2 Express > Download DB2 Express C  the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > sdifdevel mailing list > sdifdevel@... > https://lists.sourceforge.net/lists/listinfo/sdifdevel  Axel Roebel IRCAM Analysis/Synthesis Team Phone: ++3314478 4845  Fax: ++3314478 1540 
From: edu <moguillansky@gm...>  20070707 02:27:38

hi. for personal use i implemented a wrapper to wrap the python bindings of Easdif. While doing that I noticed some problems with the SWIG bindings, which are independent of the SWIG version (I tried ALL of them): Matrix.GetNbRows and Matrix.GetNbCols result always in segfaults. Also, in order to read the matrix more efficiently in python, I implemented small helper functions in sdif_matrix.cpp to read a whole matrix into a python array.. This changes are not reflected in the SWIG bindings: since these functions are used for interfacing with numpy arrays (c arrays in python), I access the shared library directly from python and map the data to the python arrays. In this way, you can do, in python: from sdiflib import * entity = Entity('my_sdif_file.sdif', selection=':1GB1/1GB1') # selection is optional for frame in entity: for matrix in frame: print matrix()[0:100] # will print the first 100 rows in all the matrices given that the sdif has matrices of constant size, the reading is buffered and you can do interpolation without reading everything first into memory. (not possible with partial tracking, still) entity = Entity('my_very_big_spectral_envelope.sdif', selection=':1GB1/1GB1') print entity(10.5, 300) will print the value of the spectral envelope at time=10.5 secs at frequency 300Hz. Values are interpolated linearly by default. Based on this library, I made a python module to talk to supervp and pm2. At the moment some features are still not implemented (gabarit filter, surface filter) but besides that, everything seems to work quite good. This library works both in OSX and Linux. It also integrates audiosculpt's kernels with libraries like Loris and aubio. you can do things like: from audiosculpt import * sp = SpectralEnvelope(An('source.aiff', ws=4000), order=30) sp.plot3d() # will plot a 3d image of sp print sp(10.5, 300) # print the value at time=10.5sec, freq=300Hz sp *= 0.5 # scale all the values sp.write('out.sdif') # write the new results even more, you can do: sp0 = SpectralEnvelope(An('source.aiff', ws=4000), order=30) sp1 =SpectralEnvelope(An('source.aiff', ws=4000), order=2000) interpolation_bpf = bpf.HalfCos((0,0), (10, 1)) interpolated_envelope = sp0 * interpolation_bpf + sp1 * (1  interpolation_bpf) out = FilterBreakpnt(An('white_noise.aiff', ws=4000), interpolated_envelope) # this will call supervp to produce a breakpoint filter calculated out of the # interpolation of the two spectral envelopes with the given shape (halfcos interpolation # in 10 seconds). This could of course be done # quite easily with envscal filter, but this is just a very easy example. Once gabarit # filter is supported, it will be much more efficient, of course. mask = MaskingEffect(An('source.aiff', ws=4000)) print mask(1, 300) # print the weight of the spectrum at time=1sec, freq=300Hz mask.plot() # plot the results as a surface plot out = FilterBreakpnt(An('white_noise.aiff', ws=4000), sp * mask) # will filter the white noise file only at the places where # the source file has relevant spectral information # (otherwise weight=0 > result = 0) if someone is interested, I can post the sources. cheers, Eduardo Moguillansky 