Ejemplo n.º 1
0
from numpy.testing import *
import numpy as N

from audiolab import wavread, auread, aiffread, sdifread, flacread, \
                             oggread
from audiolab import wavwrite, auwrite, aiffwrite, sdifwrite, flacwrite, \
                             oggwrite
from audiolab import PyaudioException
from audiolab import Sndfile, Format as audio_format
from audiolab import available_file_formats

from testcommon import open_tmp_file, close_tmp_file


AVAILABLE_FORMATS = available_file_formats()

class test_audiolab(TestCase):
    def _test_read(self, func, format, filext):
        # Create a tmp audio file, write some random data into it, and check it
        # is the expected data when read from a function from the matapi.
        rfd, fd, cfilename   = open_tmp_file('pySndfiletest.' + filext)
        try:
            nbuff = 22050
            noise = 0.1 * N.random.randn(nbuff)

            # Open the copy file for writing
            b = Sndfile(cfilename, 'w', format, 1, nbuff)
            b.write_frames(noise)
            b.close()
Ejemplo n.º 2
0
from audiolab import available_file_formats, available_encodings

for format in available_file_formats():
    print "File format %s is supported; available encodings are:" % format
    for enc in available_encodings(format):
        print "\t%s" % enc
    print ""
Ejemplo n.º 3
0
from tempfile import mkstemp

from numpy.testing import *
import numpy as N

from audiolab import wavread, auread, aiffread, sdifread, flacread, \
                             oggread
from audiolab import wavwrite, auwrite, aiffwrite, sdifwrite, flacwrite, \
                             oggwrite
from audiolab import PyaudioException
from audiolab import Sndfile, Format as audio_format
from audiolab import available_file_formats

from testcommon import open_tmp_file, close_tmp_file

AVAILABLE_FORMATS = available_file_formats()

class test_audiolab(TestCase):
    def _test_read(self, func, format, filext):
        # Create a tmp audio file, write some random data into it, and check it
        # is the expected data when read from a function from the matapi.
        rfd, fd, cfilename   = open_tmp_file('pySndfiletest.' + filext)
        try:
            nbuff = 22050
            noise = 0.1 * N.random.randn(nbuff)

            # Open the copy file for writing
            b = Sndfile(cfilename, 'w', format, 1, nbuff)
            b.write_frames(noise)
            b.close()