Ejemplo n.º 1
0
_f1 = Format('wav', 'pcm16')
wavwrite = _writer_factory('wavwrite', _f1, 8000, _f1.file_format)

_f2 = Format('au', 'ulaw')
auwrite = _writer_factory('auwrite', _f2, 8000, _f2.file_format)

_f3 = Format('aiff', 'pcm16')
aiffwrite = _writer_factory('aiffwrite', _f3, 8000, _f3.file_format)

_f4 = Format('ircam', 'pcm16')
sdifwrite = _writer_factory('sdifwrite', _f4, 44100, _f4.file_format)

# Deal with formats which may not be available depending on the sndfile version
# / build options
_AFORMATS = available_file_formats()
_SNDFILE_VER = sndfile_version()


def _missing_function(format):
    def foo(*args, **kw):
        raise NotImplementedError, \
              "Matlab API for %s is disabled: format %s is not supported by "\
              "your version of libsndfile (%s)" % (format,
                                                    format,
                                                    _SNDFILE_VER)
    foo.__doc__ = "This function is not supported with your version " \
                  "of libsndfile."
    return foo


if 'flac' in _AFORMATS:
Ejemplo n.º 2
0
from _sndfile import sndfile_version, Format
from _sndfile import *
import _sndfile

print sndfile_version()

f = Format(type='wav')
print f

majors = available_file_formats()
print available_encoding('wav')

try:
    a = Sndfile('test1.wav')
except IOError, e:
    print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
    print e
    print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"

a = Sndfile('test.wav')
for d in [np.float64, np.float32, np.int, np.short]:
    a.read_frames(1000, dtype=d)
Ejemplo n.º 3
0
_f1          = Format('wav', 'pcm16')
wavwrite    = _writer_factory('wavwrite', _f1, 8000, _f1.file_format)

_f2          = Format('au', 'ulaw')
auwrite     = _writer_factory('auwrite', _f2, 8000, _f2.file_format)

_f3          = Format('aiff', 'pcm16')
aiffwrite   = _writer_factory('aiffwrite', _f3, 8000, _f3.file_format)

_f4          = Format('ircam', 'pcm16')
sdifwrite   = _writer_factory('sdifwrite', _f4, 44100, _f4.file_format)

# Deal with formats which may not be available depending on the sndfile version
# / build options
_AFORMATS = available_file_formats()
_SNDFILE_VER = sndfile_version()
def _missing_function(format):
    def foo(*args, **kw):
        raise NotImplementedError, \
              "Matlab API for %s is disabled: format %s is not supported by "\
              "your version of libsndfile (%s)" % (format, 
                                                    format,
                                                    _SNDFILE_VER)
    foo.__doc__ = "This function is not supported with your version " \
                  "of libsndfile."
    return foo

if 'flac' in _AFORMATS:
    f = Format('flac', 'pcm16')
    flacread = _reader_factory('flacread', 'flac', f.file_format)
    flacwrite = _writer_factory('flacwrite', f, 44100, f.file_format)