-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLONG_DESCR
473 lines (357 loc) · 16.2 KB
/
LONG_DESCR
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
pysndfile
=========
pysndfile is a python package providing *PySndfile*, a
`Cython <http://cython.org/>`__ wrapper class around
`libsndfile <http://www.mega-nerd.com/libsndfile/>`__. PySndfile
provides methods for reading and writing a large variety of soundfile
formats on a variety of plattforms. PySndfile provides a rather complete
access to the different sound file manipulation options that are
available in libsndfile.
Due to the use of libsndfile nearly all sound file formats, (besides mp3
and derived formats) can be read and written with PySndfile.
The interface has been designed such that a rather large subset of the
functionality of libsndfile can be used, notably the reading and writing
of strings into soundfile formats that support these, and a number of
sf_commands that allow to control the way libsndfile reads and writes
the samples. One of the most important ones is the use of the clipping
command.
Transparent soundfile io with libsndfile
----------------------------------------
PySndfile has been developed in the `analysis synthesis team at
IRCAM <http://anasynth.ircam.fr/home/english>`__ mainly for research on
sound analysis and sound transformation. In this context it is essential
that the reading and writing of soundfile data is transparent.
The use of the clipping mode of libsndfile is important here because
reading and writing sound data should not change the audio samples. By
default, when clipping is off, libsndfile uses slightly different
scaling factors when reading pcm format into float samples, or when
writing float samples into pcm format. Therefore whenever a complete
read/write cycle is applied to a sound file then the audio samples may
be modified even when no processing is applied.
More precisely this will happen if
- the sound files contains pcm format,
- *and* the data is read into float or double,
- *and* the audio data comes close to the maximum range such that the
difference in scaling leads to modification.
To avoid this problem PySndfile sets clipping by default to on. If you
don't like this you can set it to off individually using the PySndfile
method set_auto_clipping(False).
Implementation
--------------
The implementation is based on a slightly modified version of the header
sndfile.hh that is distributed with libsndfile. The only modification is
the addition of a methode querying the seekable state of the open
Sndfile.
Installation
------------
via Anaconda channel roebel
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Precompiled packages are available for `Anaconda
python3 <https://anaconda.org/roebel/pysndfile>`__ under Linux (x86_64)
and Mac OS X (> 10.9). For these systems you can install pysndfile
simply by means of
.. code:: bash
conda install -c roebel pysndfile
Unfortunately, I don't have a windows machine and therefore I cannot
provide any packages for Windows.
compile with conda build recipe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can use the conda recipe
`here <https://github.com/roebel/conda_packages>`__. This build recipe
wil automatically download and compile libsndfile building pysndfile.
via pypi
~~~~~~~~
::
pip install pysndfile
should install pysndfile and python dependencies. Note, that pip cannot
install libsndfile for you as it is not provided via pypi. To install
libsndfile you should be able to use the software manager of your
system. This will however only work if your software manager installs
libsndfile such that the compiler used by the setup.py script will find
it. The setup.py script will search for the dynamic library libsndfile,
as well as the include file sndfile.h, in a few standard locations,
(/usr, /usr/local, and for anaconda envrinments as well in the
exec_prefix directory of the python executable you are using). If
libsndfile is not found you may either adapt the setup.cfg file or set
the environment variable SNDFILE_INSTALL_DIR, to inform the build_ext
sub command about the location to use.
compile from sources
~~~~~~~~~~~~~~~~~~~~
Note that for compiling from sources you need to install requirements
listed in requirements.txt file before starting the compilation.
Moreover you need to install libsndfile as described in the previous
section.
If the libsndfile (header and library) is not installed in the default
compiler search path you have to specify the library and include
directories to be added to this search paths. For this you can either
set the environment variable SNDFILE_INSTALL_DIR to the installation
path or specify sndfile_libdir and sndfile_incdir in the setup.cfg file.
self-contained extension
~~~~~~~~~~~~~~~~~~~~~~~~
Both when installing from pypi or building a wheel from source (or
sdist) the extension will need the libsndfile shared library, which must
be available at runtime.
Since version 1.4.7, it is possible to integrate libsndfile into the
extension, removing this requirement. This will greatly increase the
size of the extension, but can be useful to avoid conflicts between
different libsndfile versions or to build a self-contained wheel.
To do this, the installed libsndfile must include static libraries for
itself and its dependencies. Then define the PYSNDFILE_USE_STATIC
environment variable (either without a value or to anything except 0)
before installing or building as usual. The dependencies will be
searched using pkg-config if available, or by looking for possible
dependencies in the same directory as libsndfile itself.
In some installations of libsndfile though, the pkg-config information
is incorrect (usually a missing or misspelled dependency), which will
lead to an error when building/installing or importing. In this case,
also define the PYSNDFILE_IGNORE_PKG_CONFIG environment variable and
build/install again.
Windows
^^^^^^^
An experimental support for using pysndfile under windows has been added
since version 1.3.4. For further comments see
`here <https://github.com/roebel/pysndfile/issues/3>`__ as well as
`build
scripts <https://gist.github.com/sveinse/97411b95d36a6b8c430d4d381b620ecb>`__
provided by sveinse. Note, that I do not have any windows machine and
cannot provide any help in making this work.
Documentation
-------------
Please see the developer documentation
`here <https://pysndfile.readthedocs.io/en/latest/modules.html>`__.
Changes
-------
Version_1.4.7 (2024-12-31)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix: Remove deprecated IF conditions in Cython code
- Remove tests directory from sdist because the test is not a standard
unittest and led to confusion
- Extension (build): Optionally use static libraries for libsndfile to
build a self-contained wheel or avoid runtime requirements/conflicts.
This is done by defining the environment variable
PYSNDFILE_USE_STATIC (and optionally PYSNDFILE_IGNORE_PKG_CONFIG)
- Fix (build): Fixed build and installation on Windows
- Fix (documentation): Generate ChangeLog from README.md and have
INSTALL.txt refer to it
- Fix (build): avoid depreciation message when using setup.cfg for
selecting libsndfile installation to be used.
- Extension (build): build_ext.finalize_options now communicates the
sndfile library and include dirs that are used.
Version_1.4.6 (2024-10-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix: Fixed setup.py to find libsndfile in standard locations such
that pip install can be used more easily. Provide proper warning in
case libsndfile is not found. Support using non-standard installation
directories by means of environment variable SOUNDFILE_INSTALL_DIR.
- Removed the requirement for --no-build-isolation in the check target
of the Makefile
Version_1.4.5 (2024-10-10)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Extension: support Path for filename arguments in sndio.
- Fix: Avoid crash in sndio.write when a zero-sized array is stored
(thanks to Frederic Cornu).
- Fix: Makefile rule for check command, did not find the "tests"
directory on all OS.
- Update: setup.py now uses packaging instead of pkg_resources.
Version_1.4.4 (2022-03-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix for win32: improved error handling for PyUnicode_AsWideCharString
(thanks to Andrey Bienkowski)
Version_1.4.3 (2020-01-20)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- changed sndio functions to all use PySndfile as context manager. This
fixes the problem that the sndfile remains open when an error occurs
which may in turn lead to inconsistencies if the sndfile is tried to
be rewritten in an exception handler.
Version_1.4.2 (2019-12-18)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed PySndfile.read_frames method to properly handle reading frames
in parts (previous fix was incomplete)
Version_1.4.1 (2019-12-18)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- extended supported commands to change compression level when writing
flac and ogg files
- fixed PySndfile.read_frames and sndio.read method to properly handle
reading frames from the middle of a file
Version_1.4.0 (2019-12-17)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Extended PySndfile class:
- support use as context manager
- added support for wve, ogg, MPC2000 sampler and RF64 wav files
- added support for forcing to return 2D arrays even for mono files
- added method to close the file and release all resources.
- support reading more frames than present in the file using the
fill_value for all values positioned after the end of the file
Version_1.3.8 (2019-10-22)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- (no changes in functionality)
- added documentation to distributed files
- added missing licence file to distribution
- thanks @toddrme2178 for patches.
Version_1.3.7 (2019-08-01)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- removed cython (a build requirement) from requirements.txt
- avoid cython warning and fix language_level in the .pyx source code
- add and support pre-release tags in the version number
- use hashlib to calculate the README checksum.
- fixed support for use with python 2.7 that was broken since 1.3.4
Version_1.3.6 (2019-07-27)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed potential but undesired build dependency of pandoc
- added link to explanation for using pysndfile under windows
- fixed pandoc problem that does produce non ASCII chars in rst output.
Version_1.3.5 (2019-07-27)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed two copy paste bug introduced in 1.3.4 1.3.4 did in fact not
work at all :-(
- added a check target to the makefile that performs a complete
built/install/test cycle to avoid problems as in 1.3.4
Version_1.3.4 (2019-07-23)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- added support for automatic installation of requirements
- remove precompiled cython source file and rely on pip requirements to
provide cython so that cython compilation will always be possible.
- added experimental support for installation on win32 (thanks to Svein
Seldal for the contributions).
- use expanduser for replacing ~ in filenames
- adapted cython source code to avoid all compiler warnings due to
deprecated numpy api
- removed use of ez_setup.py that is no longer required.
Version_1.3.3 (2019-06-01)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed missing command C_SFC_SET_SCALE_INT_FLOAT_WRITE (thanks to
Svein Seldal for the bug report and fix)
- better documentation of sf_string-io in sndio.read and sndio.write
- limit size of strings to be written such that the written file can
always be read back with libsndfile 1.0.28 (which imposes different
constraints for different formats)
- better error handling when number of channels exceeds channel limit
imposed by libsndfile.
- sndio module now exposes the dicts: fileformat_name_to_id and
fileformat_id_to_name
- extended sndio.read with force_2d argument that can be used to force
the returned data array to always have 2 dimensions even for mono
files.
Version_1.3.2 (2018-07-04)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed documentation of sndio module.
Version_1.3.1 (2018-07-04)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Extended sndio by means of adding a enw function that allows
retrieving embed markers from sound files. Names marker labels will
be retrieved only for aiff files.
- removed print out in pysndfile.get_cue_mrks(self) function.
- fixed version number in documentation.
Version_1.3.0 (2018-07-04)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Added support for retrieving cue points from aiff and wav files.
Version_1.2.2 (2018-06-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed c++-include file that was inadvertently scrambled.
Version_1.2.1 (2018-06-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed formatting error in long description and README.
- setup.py to explicitly select formatting of the long description.
Version_1.2.0 (2018-06-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- support reading and writing sound file strings in sndio module
- Improved documentation of module constant mappings and PySndfile
methods.
- Added a new method supporting to write all strings in a dictionary to
the sound file.
Version_1.1.1 (2018-06-10)
~~~~~~~~~~~~~~~~~~~~~~~~~~
this update is purely administrative, no code changes
- moved project to IRCAM GitLab
- moved doc to ReadTheDoc
- fixed documentation.
Version_1.1.0 (2018-02-13)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- support returning extended sndfile info covering number of frames and
number of channels from function sndio.get_info.
Version_1.0.0 (2017-07-26)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Updated version number to 1.0.0:
- pysndfile has now been used for quiet a while under python 3 and most
problems seem to be fixed.
- changed setup.py to avoid uploading outdated LONG_DESC file.
Version_0.2.15 (2017-07-26)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed get_sndfile_version function and tests script: adapted char
handling to be compatible with python 3.
Version 0.2.14 (2017-07-26)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed filename display in warning messages due to invalid pointer:
replaced char\* by std::string
Version 0.2.13 (2017-06-03)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed using "~" for representing $HOME in filenames:
- \_pysndfile.pyx: replaced using cython getenv by os.environ to avoid
type incompatibilities in python3
Version 0.2.12 (2017-05-11)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed problem in sndio.read: Optionally return full information
required to store the file using the corresponding write function
- \_pysndfile.pyx: add constants SF_FORMAT_TYPEMASK and
SF_FORMAT_SUBMASK, SF_FORMAT_ENDMASK to python interface Added new
function for getting internal sf log in case of errors. Improved
consistency of variable definitions by means of retrieving them
automatically from sndfile.h
Version 0.2.11 (2015-05-17)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- setup.py: fixed problem with compilers not providing the compiler
attribute (MSVC) (Thanks to Felix Hanke for reporting the problem)
- \_pysndfile.pyx: fixed problem when deriving from PySndfile using a
modified list of **init** parameters in the derived class (Thanks to
Sam Perry for the suggestion).
Version 0.2.10
~~~~~~~~~~~~~~
- setup.py: rebuild LONG_DESC only if sdist method is used.
Version 0.2.9
~~~~~~~~~~~~~
- Added missing files to distribution.
- force current cythonized version to be distributed.
Version 0.2.7
~~~~~~~~~~~~~
- Fixed typo in include directive in MANIFEST.in.
Version 0.2.5
~~~~~~~~~~~~~
- Added missing file \_pysndfile.pyx.
Version 0.2.4
~~~~~~~~~~~~~
- Compatibility with python 3 (thanks to Eduardo Moguillansky)
- bug fix: ensure that vectors returned by read_frames function own
their data.
Version 0.2.3
~~~~~~~~~~~~~
- Use print function syntax for a print statement that was not yet
using it.
- Avoid newline in compiler detection message.
- import print_function for compatibility with 2.6
- python 3 compatibility
- Generate error message for too high dimensional input.
Version 0.2.2
~~~~~~~~~~~~~
- don't use SF_STR_ALBUM and SF_STR_LICENSE from sndfile.h because this
breaks compilation for older versions.
- don't use SF_STR_TRACKNUMBER and SF_STR_GENRE from sndfile.h because
this breaks compilation for older versions.
- Fixed documentation for write function.
- Fixed typo in accessing function argument
Version 0.2.1
~~~~~~~~~~~~~
- Initial release
Copyright
---------
Copyright (C) 2014-2024 IRCAM
Author
------
Axel Roebel
Credits
-------
- Erik de Castro Lopo: for
`libsndfile <http://www.mega-nerd.com/libsndfile/>`__
- David Cournapeau: for a few ideas I gathered from
`scikits.audiolab <http://cournape.github.io/audiolab/>`__.
- The `Cython <http://cython.org>`__ maintainers for the efficient
means to write interface definitions in Cython.