Commit 2669bbf9 authored by Axel Roebel's avatar Axel Roebel
Browse files

Version 1.1.0: get_info::optionally return num frames and num channels

parent 7987b45f
Version_1.1.0 (2018-02-13)
---------------------------
* changed sndio.get_info function to be able to return addtional info about number of frames and
number of channels.
Version_1.0.0 (2017-07-26)
---------------------------
2017-07-26 Roebel
......
......@@ -57,6 +57,12 @@ Sndfile.
Changes
-------
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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -26,6 +26,11 @@ The implementation is based on a slightly modified version of the header sndfile
## Changes
### 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:
......
......@@ -31,7 +31,7 @@ import os
cimport numpy as cnp
from libcpp.string cimport string
_pysndfile_version=(1,0,0)
_pysndfile_version=(1,1,0)
def get_pysndfile_version():
"""
return tuple describing the version opf pysndfile
......
......@@ -2218,7 +2218,7 @@ static PyObject *__pyx_codeobj__58;
 
/* "_pysndfile.pyx":35
*
* _pysndfile_version=(1,0,0)
* _pysndfile_version=(1,1,0)
* def get_pysndfile_version(): # <<<<<<<<<<<<<<
* """
* return tuple describing the version opf pysndfile
......@@ -2261,7 +2261,7 @@ static PyObject *__pyx_pf_10_pysndfile_get_pysndfile_version(CYTHON_UNUSED PyObj
 
/* "_pysndfile.pyx":35
*
* _pysndfile_version=(1,0,0)
* _pysndfile_version=(1,1,0)
* def get_pysndfile_version(): # <<<<<<<<<<<<<<
* """
* return tuple describing the version opf pysndfile
......@@ -14170,17 +14170,17 @@ static int __Pyx_InitCachedConstants(void) {
/* "_pysndfile.pyx":34
* from libcpp.string cimport string
*
* _pysndfile_version=(1,0,0) # <<<<<<<<<<<<<<
* _pysndfile_version=(1,1,0) # <<<<<<<<<<<<<<
* def get_pysndfile_version():
* """
*/
__pyx_tuple__47 = PyTuple_Pack(3, __pyx_int_1, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 34, __pyx_L1_error)
__pyx_tuple__47 = PyTuple_Pack(3, __pyx_int_1, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 34, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__47);
__Pyx_GIVEREF(__pyx_tuple__47);
 
/* "_pysndfile.pyx":35
*
* _pysndfile_version=(1,0,0)
* _pysndfile_version=(1,1,0)
* def get_pysndfile_version(): # <<<<<<<<<<<<<<
* """
* return tuple describing the version opf pysndfile
......@@ -14457,7 +14457,7 @@ PyMODINIT_FUNC PyInit__pysndfile(void)
/* "_pysndfile.pyx":34
* from libcpp.string cimport string
*
* _pysndfile_version=(1,0,0) # <<<<<<<<<<<<<<
* _pysndfile_version=(1,1,0) # <<<<<<<<<<<<<<
* def get_pysndfile_version():
* """
*/
......@@ -14465,7 +14465,7 @@ PyMODINIT_FUNC PyInit__pysndfile(void)
 
/* "_pysndfile.pyx":35
*
* _pysndfile_version=(1,0,0)
* _pysndfile_version=(1,1,0)
* def get_pysndfile_version(): # <<<<<<<<<<<<<<
* """
* return tuple describing the version opf pysndfile
......
......@@ -21,11 +21,17 @@
from pysndfile import PySndfile, construct_format
import numpy as np
def get_info(name) :
def get_info(name, extended_info=False) :
"""
retrieve samplerate, encoding (str) and format informationfor sndfile name
return samplerate, encoding (str), format information, for sound file
in case extended_info is set then also the number of frames and number of channels in the sound file
are returned
return samplerate, encoding (str), format information(, number of frames, and number of channels)
"""
sf = PySndfile(name)
if extended_info:
return sf.samplerate(), sf.encoding_str(), sf.major_format_str(), sf.frames(), sf.channels()
return sf.samplerate(), sf.encoding_str(), sf.major_format_str()
def write(name, data, rate=44100, format="aiff", enc='pcm16') :
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment