Beispiel #1
0
def test_forward():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, 40.0)
    tolerance = 2.0**(-15)
    nsteps = 200
    for lib in am.installed_modules('fileio'):
        if lib in ['scipy.io.wavfile', 'pydub']:
            continue
        print('')
        print('forward slice access for module %s' % lib)
        am.select_module(lib)
        full_data, rate = al.load_audio(filename, verbose=4)
        with al.AudioLoader(filename, 5.0, 2.0, verbose=4) as data:
            for time in [0.1, 1.5, 2.0, 5.5, 8.0]:
                nframes = int(time * data.samplerate)
                step = int(len(data) / nsteps)
                failed = -1
                for inx in range(0, len(data) - nframes, step):
                    if np.any(
                            np.abs(full_data[inx:inx + nframes] -
                                   data[inx:inx + nframes]) > tolerance):
                        failed = inx
                        break
                assert_true(
                    failed < 0,
                    'frame slice access forward failed at index %d with nframes=%d and %s module'
                    % (failed, nframes, lib))
    os.remove(filename)
    am.enable_module()
Beispiel #2
0
def test_single_frame():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, 20.0)
    tolerance = 2.0**(-15)
    ntests = 500
    for lib in am.installed_modules('fileio'):
        if lib in ['scipy.io.wavfile', 'pydub']:
            continue
        print('')
        print('check single frame access for module %s ...' % lib)
        am.select_module(lib)
        full_data, rate = al.load_audio(filename, verbose=4)
        with al.AudioLoader(filename, 5.0, 2.0, verbose=4) as data:
            assert_false(np.any(np.abs(full_data[0] - data[0]) > tolerance),
                         'first frame access failed with %s module' % lib)
            assert_false(np.any(np.abs(full_data[-1] - data[-1]) > tolerance),
                         'last frame access failed with %s module' % lib)

            def access_end(n):
                x = data[len(data) + n]

            for n in range(10):
                assert_raises(IndexError, access_end, n)
            failed = -1
            for inx in np.random.randint(-len(data), len(data), ntests):
                if np.any(np.abs(full_data[inx] - data[inx]) > tolerance):
                    failed = inx
                    break
            assert_true(
                failed < 0,
                'single random frame access failed at index %d with %s module'
                % (failed, lib))
    os.remove(filename)
    am.enable_module()
Beispiel #3
0
def test_modules():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, 1.0)
    for lib, load_file in al.audio_loader_funcs:
        print(lib)
        am.disable_module(lib)
        assert_raises(ImportError, load_file, filename)
        data = al.AudioLoader(verbose=4)
        load_funcs = {
            'soundfile': data.open_soundfile,
            'wavefile': data.open_wavefile,
            'audioread': data.open_audioread,
            'wave': data.open_wave,
            'ewave': data.open_ewave,
        }
        if lib not in load_funcs:
            continue
        assert_raises(ImportError, load_funcs[lib], filename, 10.0, 2.0)
        if am.select_module(lib):
            # check double opening:
            load_funcs[lib](filename)
            load_funcs[lib](filename)
            data.close()
    os.remove(filename)
    am.enable_module()
Beispiel #4
0
def test_demo():
    am.enable_module()
    filename = 'test.wav'
    aw.demo(filename)
    aw.demo(filename, channels=1)
    aw.demo(filename, channels=2, encoding='PCM_16')
    os.remove(filename)
Beispiel #5
0
def test_multiple():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, 20.0)
    tolerance = 2.0**(-15)
    ntests = 100
    for lib in am.installed_modules('fileio'):
        if lib in ['scipy.io.wavfile', 'pydub']:
            continue
        print('')
        print('multiple indices access for module %s' % lib)
        am.select_module(lib)
        full_data, rate = al.load_audio(filename, verbose=4)
        with al.AudioLoader(filename, 5.0, 2.0, verbose=4) as data:
            for time in [0.1, 1.5, 2.0, 5.5, 8.0, 20.0]:
                nframes = int(time * data.samplerate)
                if nframes > 0.9 * len(data):
                    nframes = len(data)
                for n in [1, 2, 4, 8, 16]:  # number of indices
                    offs = 0
                    if len(data) > nframes:
                        offs = np.random.randint(len(data) - nframes)
                    failed = -1
                    for k in range(ntests):
                        inx = np.random.randint(0, nframes, n) + offs
                        if np.any(
                                np.abs(full_data[inx] -
                                       data[inx]) > tolerance):
                            failed = 1
                            break
                    assert_equal(failed, -1, (
                        'multiple random frame access failed with %s module at indices '
                        % lib) + str(inx))
    os.remove(filename)
    am.enable_module()
Beispiel #6
0
def test_play():
    am.enable_module()
    print()
    # sine wave:
    rate = 44100.0
    t = np.arange(0.0, 0.5, 1.0/rate)
    mono_data = np.sin(2.0*np.pi*800.0*t)
    stereo_data = np.tile(mono_data, (2, 1)).T
    # fade in and out:
    ap.fade(mono_data, rate, 0.1)
    ap.fade(stereo_data, rate, 0.1)
    print('default module mono...')
    ap.play(mono_data, rate, blocking=True)
    ap.play(mono_data, rate, blocking=False)
    time.sleep(2.0)
    print('default module stereo...')
    ap.play(stereo_data, rate, blocking=True)
    ap.play(stereo_data, rate, blocking=False)
    time.sleep(2.0)
    ap.handle.close()
    for lib in am.installed_modules('device'):
        print('%s module mono...' % lib)
        am.select_module(lib)
        ap.play(mono_data, rate, blocking=True, verbose=2)
        ap.play(mono_data, rate, blocking=False, verbose=2)
        time.sleep(2.0)
        print('%s module stereo...' % lib)
        ap.play(stereo_data, rate, blocking=True)
        ap.play(stereo_data, rate, blocking=False)
        time.sleep(2.0)
        ap.handle.close()
        am.enable_module()
Beispiel #7
0
def test_blocks():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename)
    full_data, rate = al.load_audio(filename)
    tolerance = 2.0**(-15)
    for n in [5000, len(full_data) + 100]:
        read_data = []
        with al.AudioLoader(filename) as data:
            for x in al.blocks(data, n, 10):
                read_data.append(x[:-10].copy())
        read_data = np.vstack(read_data)
        assert_equal(full_data.shape[0] - 10, read_data.shape[0],
                     'len of blocked data differ from input data')
        assert_equal(full_data.shape[1], read_data.shape[1],
                     'columns of blocked data differ from input data')
        assert_false(np.any(np.abs(full_data[:-10] - read_data) > tolerance),
                     'blocks() failed')
        read_data = []
        with al.AudioLoader(filename) as data:
            for x in data.blocks(n, 10):
                read_data.append(x[:-10].copy())
        read_data = np.vstack(read_data)
        assert_equal(full_data.shape[0] - 10, read_data.shape[0],
                     'len of blocked data differ from input data')
        assert_equal(full_data.shape[1], read_data.shape[1],
                     'columns of blocked data differ from input data')
        assert_false(np.any(np.abs(full_data[:-10] - read_data) > tolerance),
                     'blocks() failed')

    def wrong_blocks(data):
        for x in al.blocks(data, 10, 20):
            pass

    assert_raises(ValueError, wrong_blocks, full_data)
Beispiel #8
0
def test_main():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, duration=5.0)
    al.main(['prog', '-h'])
    al.main(['prog', filename])
    al.main(['prog', '-m', 'wave', filename])
    os.remove(filename)
Beispiel #9
0
def test_main():
    am.enable_module()
    assert_raises(SystemExit, am.main, ['prog', '-h'])
    assert_raises(SystemExit, am.main, ['prog', '--help'])
    assert_raises(SystemExit, am.main, ['prog', '--version'])
    am.main(['prog'])
    am.main()
    for module in am.audio_modules.keys():
        am.main(['prog', module])
Beispiel #10
0
def test_main():
    am.enable_module()
    filename = 'test.wav'
    aw.main(['prog', '-h'])
    aw.main(['prog', filename])
    aw.main(['prog', '-m', 'wave', filename])
    aw.main(['prog', '-m', 'wave', '-n', '1', filename])
    aw.main(['prog', '-m', 'wave', filename, 'PCM_16'])
    os.remove(filename)
Beispiel #11
0
def test_iter():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, 1.0)
    full_data, rate = al.load_audio(filename)
    tolerance = 2.0**(-15)
    with al.AudioLoader(filename, 0.2) as data:
        for k, x in enumerate(data):
            assert_false(np.any(np.abs(x - full_data[k]) > tolerance),
                         'iteration %d does not match' % k)
Beispiel #12
0
def test_beep():
    am.enable_module()
    print()
    print('default module...')
    ap.beep(blocking=True)
    ap.beep(0.5, 'a4', blocking=True)
    ap.beep(blocking=False)
    time.sleep(2.0)
    ap.handle.close()
    for lib in am.installed_modules('device'):
        print('%s module...' % lib)
        am.select_module(lib)
        ap.beep(blocking=True, verbose=2)
        ap.beep(blocking=False, verbose=2)
        time.sleep(2.0)
        ap.handle.close()
        am.enable_module()
Beispiel #13
0
def test_formats_encodings():
    am.enable_module()
    min_formats = {
        'wave': 1,
        'ewave': 2,
        'scipy.io.wavfile': 1,
        'soundfile': 23,
        'wavefile': 23,
        'pydub': 10
    }
    for (module,
         formats_func), (m, encodings_func) in zip(aw.audio_formats_funcs,
                                                   aw.audio_encodings_funcs):
        if aw.audio_modules[module]:
            min_f = min_formats[module]
            formats = formats_func()
            assert_greater_equal(
                len(formats), min_f,
                'formats_%s() did not return enough formats' %
                module.split('.')[-1])
            for f in formats:
                encodings = encodings_func(f)
                assert_greater_equal(
                    len(encodings), 1,
                    'encodings_%s() did not return enough encodings for format %s'
                    % (module.split('.')[-1], f))
            encodings = encodings_func('xxx')
            assert_equal(
                len(encodings), 0,
                'encodings_%s() returned encodings for invalid format xxx' %
                module.split('.')[-1])
            encodings = encodings_func('')
            assert_equal(
                len(encodings), 0,
                'encodings_%s() returned encodings for empty format xxx' %
                module.split('.')[-1])

    formats = aw.available_formats()
    assert_greater_equal(len(formats), 1,
                         'available_formats() did not return enough formats')
    for f in formats:
        encodings = aw.available_encodings(f)
        assert_greater_equal(
            len(encodings), 1,
            'available_encodings() did not return enough encodings for format %s'
            % f)
Beispiel #14
0
def test_audio_files():
    am.enable_module()
    assert_raises(ValueError, al.load_audio, '')
    assert_raises(FileNotFoundError, al.load_audio, 'xxx.wav')
    assert_raises(ValueError, al.AudioLoader, '')
    assert_raises(FileNotFoundError, al.AudioLoader, 'xxx.wav')
    filename = 'test.wav'
    df = open(filename, 'w')
    df.close()
    assert_raises(EOFError, al.load_audio, filename)
    assert_raises(EOFError, al.AudioLoader, filename)
    os.remove(filename)
    write_audio_file(filename)
    am.disable_module()
    assert_raises(IOError, al.load_audio, filename)
    assert_raises(IOError, al.AudioLoader, filename)
    os.remove(filename)
    am.enable_module()
Beispiel #15
0
def test_downsample():
    def sinewave(rate):
        t = np.arange(0.0, 0.5, 1.0/rate)
        mono_data = np.sin(2.0*np.pi*800.0*t)
        stereo_data = np.tile(mono_data, (2, 1)).T
        # fade in and out:
        ap.fade(mono_data, rate, 0.1)
        ap.fade(stereo_data, rate, 0.1)
        return mono_data, stereo_data
        
    am.enable_module()
    print()
    for lib in am.installed_modules('device'):
        am.select_module(lib)
        print('%s module ...' % lib)
        for rate in [45555.0, 100000.0, 600000.0]:
            print(' rate %.0f Hz ...' % rate)
            mono_data, stereo_data = sinewave(rate)
            ap.play(mono_data, rate, verbose=2)
            ap.play(stereo_data, rate, verbose=2)
        ap.handle.close()
        am.enable_module()
Beispiel #16
0
def test_slice():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, 20.0)
    tolerance = 2.0**(-15)
    ntests = 100
    for lib in am.installed_modules('fileio'):
        if lib in ['scipy.io.wavfile', 'pydub']:
            continue
        print('')
        print('random frame slice access for module %s' % lib)
        am.select_module(lib)
        full_data, rate = al.load_audio(filename, verbose=4)
        with al.AudioLoader(filename, 5.0, 2.0, verbose=4) as data:
            for n in range(5):
                assert_false(
                    np.any(np.abs(data[:n] - full_data[:n]) > tolerance),
                    'zero slice up to %d does not match' % n)
            for n in range(1, 5):
                assert_false(
                    np.any(np.abs(data[:50:n] - full_data[:50:n]) > tolerance),
                    'step slice with step=%d does not match' % n)
            for time in [0.1, 1.5, 2.0, 5.5, 8.0]:
                nframes = int(time * data.samplerate)
                failed = -1
                for inx in np.random.randint(0, len(data) - nframes, ntests):
                    if np.any(
                            np.abs(full_data[inx:inx + nframes] -
                                   data[inx:inx + nframes]) > tolerance):
                        failed = inx
                        break
                assert_true(
                    failed < 0,
                    'random frame slice access failed at index %d with nframes=%d and %s module'
                    % (failed, nframes, lib))
    os.remove(filename)
    am.enable_module()
Beispiel #17
0
def test_audiomodules():
    am.enable_module()
    funcs = ['all', 'fileio', 'device']
    for func in funcs:
        am.enable_module()
        print('')
        print('module lists for %s:' % func)
        inst_mods = am.installed_modules(func)
        print('installed:', len(inst_mods), inst_mods)
        assert_greater(len(inst_mods), 0, 'no installed modules for %s' % func)
        avail_mods = am.available_modules(func)
        print('available:', len(avail_mods), avail_mods)
        assert_equal(
            len(avail_mods), len(inst_mods),
            'less available modules than installed modules for %s' % func)
        unavail_mods = am.unavailable_modules(func)
        print('unavailable:', len(unavail_mods), unavail_mods)
        assert_greater_equal(
            len(unavail_mods), 0,
            'wrong number of unavailable modules for %s' % func)
        missing_mods = am.missing_modules(func)
        print('missing:', len(missing_mods), missing_mods)
        assert_greater_equal(len(missing_mods), 0,
                             'wrong number of missing modules for %s' % func)
        am.missing_modules_instructions(func)
        am.list_modules(func, False)
        am.list_modules(func, True)

    print()
    print('single module functions:')
    for module in am.audio_modules.keys():
        am.disable_module(module)
        am.enable_module(module)
        am.select_module(module)
        am.enable_module()
        inst = am.installation_instruction(module)
        assert_greater(len(inst), 0,
                       'no installation instructions for module %s' % module)
        am.list_modules(module, False)
        am.list_modules(module, True)
Beispiel #18
0
def test_dimensions():
    am.enable_module()
    print('1-D data')
    filename = 'test.wav'
    samplerate = 44100.0
    duration = 10.0
    t = np.arange(0.0, duration, 1.0 / samplerate)
    data = np.sin(2.0 * np.pi * 880.0 * t) * t / duration
    for lib in am.installed_modules('fileio'):
        if lib == 'audioread' or (lib == 'pydub' and 'audioread'
                                  not in am.installed_modules('fileio')):
            continue
        print('%s module...' % lib)
        am.select_module(lib)
        aw.write_audio(filename, data, samplerate)
        if lib == 'pydub':
            am.select_module('audioread')
        data_read, samplerate_read = al.load_audio(filename)
        assert_equal(len(data_read.shape), 2,
                     'read in data must be a 2-D array')
        assert_equal(data_read.shape[1], 1,
                     'read in data must be a 2-D array with one column')

    print('2-D data one channel')
    filename = 'test.wav'
    samplerate = 44100.0
    duration = 10.0
    t = np.arange(0.0, duration, 1.0 / samplerate)
    data = np.sin(2.0 * np.pi * 880.0 * t) * t / duration
    data = data.reshape((-1, 1))
    for lib in am.installed_modules('fileio'):
        if lib == 'audioread' or (lib == 'pydub' and 'audioread'
                                  not in am.installed_modules('fileio')):
            continue
        print('%s module...' % lib)
        am.select_module(lib)
        aw.write_audio(filename, data, samplerate)
        if lib == 'pydub':
            am.select_module('audioread')
        data_read, samplerate_read = al.load_audio(filename)
        assert_equal(len(data_read.shape), 2,
                     'read in data must be a 2-D array')
        assert_equal(data_read.shape[1], 1,
                     'read in data must be a 2-D array with one column')
        assert_equal(data_read.shape, data.shape,
                     'input and output data must have same shape')

    print('2-D data two channel')
    filename = 'test.wav'
    samplerate = 44100.0
    duration = 10.0
    t = np.arange(0.0, duration, 1.0 / samplerate)
    data = np.sin(2.0 * np.pi * 880.0 * t) * t / duration
    data = data.reshape((-1, 2))
    for lib in am.installed_modules('fileio'):
        if lib == 'audioread' or (lib == 'pydub' and 'audioread'
                                  not in am.installed_modules('fileio')):
            continue
        print('%s module...' % lib)
        am.select_module(lib)
        aw.write_audio(filename, data, samplerate)
        if lib == 'pydub':
            am.select_module('audioread')
        data_read, samplerate_read = al.load_audio(filename)
        assert_equal(len(data_read.shape), 2,
                     'read in data must be a 2-D array')
        assert_equal(data_read.shape[1], 2,
                     'read in data must be a 2-D array with two columns')
        assert_equal(data_read.shape, data.shape,
                     'input and output data must have same shape')
    am.enable_module()
Beispiel #19
0
def test_write_read():
    def check(samplerate_write, data_write, samplerate_read, data_read, lib,
              encoding):
        assert_almost_equal(
            samplerate_write, samplerate_read,
            'samplerates differ for module %s with encoding %s' %
            (lib, encoding))
        assert_equal(
            len(data_write), len(data_read),
            'frames %d %d differ for module %s with encoding %s' %
            (len(data_write), len(data_read), lib, encoding))
        assert_equal(
            len(data_write.shape), len(data_read.shape),
            'shape len differs for module %s with encoding %s' %
            (lib, encoding))
        assert_equal(
            len(data_read.shape), 2,
            'shape differs from 2 for module %s with encoding %s' %
            (lib, encoding))
        assert_equal(
            data_write.shape[0], data_read.shape[0],
            'shape[0] differs for module %s with encoding %s' %
            (lib, encoding))
        assert_equal(
            data_write.shape[1], data_read.shape[1],
            'shape[1] differs for module %s with encoding %s' %
            (lib, encoding))
        assert_equal(
            data_read.dtype, np.float64,
            'read in data are not doubles for module %s with encoding %s' %
            (lib, encoding))
        n = min([len(data_write), len(data_read)])
        max_error = np.max(np.abs(data_write[:n] - data_read[:n]))
        print('maximum error = %g' % max_error)
        assert_less(
            max_error, 0.05,
            'values differ for module %s with encoding %s by up to %g' %
            (lib, encoding, max_error))

    am.enable_module()
    # generate data:
    samplerate = 44100.0
    duration = 10.0
    t = np.arange(0.0, duration, 1.0 / samplerate)
    data = np.sin(2.0 * np.pi * 880.0 * t) * t / duration
    data = data.reshape((-1, 1))

    # parameter for wav file:
    filename = 'test.wav'
    format = 'wav'
    encodings = [
        'PCM_16', 'PCM_24', 'PCM_32', 'PCM_64', 'FLOAT', 'DOUBLE', 'PCM_U8',
        'ALAW', 'ULAW', ''
    ]
    encodings_with_read_error = [
        'G721_32', 'GSM610', ''
    ]  # soundfile: raise ValueError("frames must be specified for non-seekable files") in sf.read()
    encodings_with_seek_error = [
        'IMA_ADPCM', 'MS_ADPCM', ''
    ]  # soundfile: RuntimeError: Internal psf_fseek() failed.

    # parameter for ogg file:
    ## filename = 'test.ogg'
    ## format = 'OGG'
    ## encodings = ['VORBIS']

    mpeg_filename = 'test.mp3'

    # fix parameter:
    format = format.upper()

    for channels in [1, 2, 4, 8, 16]:

        # generate data:
        if channels > 1:
            for k in range(data.shape[1], channels):
                data = np.hstack((data, data[:, 0].reshape((-1, 1)) / k))
        print('channels = %d' % channels)

        # write, read, and check:
        for lib in am.installed_modules('fileio'):
            if lib in ['audioread', 'pydub']:
                continue
            print('')
            print('%s module:' % lib)
            am.select_module(lib)
            for encoding in encodings:
                encoding = encoding.upper()
                if encoding == '' or encoding in aw.available_encodings(
                        format):
                    print(encoding)
                    aw.write_audio(filename,
                                   data,
                                   samplerate,
                                   format=format,
                                   encoding=encoding,
                                   verbose=2)
                    data_read, samplerate_read = al.load_audio(filename,
                                                               verbose=2)
                    check(samplerate, data, samplerate_read, data_read, lib,
                          encoding)
        """
        if 'audioread' in am.installed_modules('fileio') and 'pydub' in am.installed_modules('fileio'):
            am.select_module('pydub')
            aw.write_audio(mpeg_filename, data, samplerate)
            am.select_module('audioread')
            data_read, samplerate_read = al.load_audio(mpeg_filename, verbose=2)
            check(samplerate, data, samplerate_read, data_read, 'pydub', '')
        """

        am.enable_module()
        print('')
        print('audioio')
        for encoding in encodings:
            encoding = encoding.upper()
            if encoding == '' or encoding in aw.available_encodings(format):
                print(encoding)
                aw.write_audio(filename,
                               data,
                               samplerate,
                               format=format,
                               encoding=encoding)
                data_read, samplerate_read = al.load_audio(filename, verbose=0)
                check(samplerate, data, samplerate_read, data_read, 'audioio',
                      encoding)
    if os.path.isfile(filename):
        os.remove(filename)
    if os.path.isfile(mpeg_filename):
        os.remove(mpeg_filename)
Beispiel #20
0
def test_write_read_modules():
    am.enable_module()
    # generate data:
    filename = 'test.wav'
    format = 'wav'
    samplerate = 44100.0
    duration = 10.0
    t = np.arange(int(duration * samplerate)) / samplerate
    data = np.sin(2.0 * np.pi * 880.0 * t) * t / duration
    # test for wrong formats:
    for lib, write_func in aw.audio_writer_funcs:
        if not am.select_module(lib):
            continue
        assert_raises(ValueError, write_func, '', data, samplerate)
        assert_raises(ValueError,
                      write_func,
                      filename,
                      data,
                      samplerate,
                      format='xxx')
        write_func(filename, data, samplerate, format='')
        os.remove(filename)
        assert_raises(ValueError,
                      write_func,
                      filename,
                      data,
                      samplerate,
                      encoding='xxx')
        write_func(filename, data, samplerate, encoding='')
        os.remove(filename)
        am.enable_module()
    assert_raises(ValueError, aw.write_audio, '', data, samplerate)
    assert_raises(IOError,
                  aw.write_audio,
                  filename,
                  data,
                  samplerate,
                  format='xxx')
    aw.write_audio(filename, data, samplerate, format='')
    os.remove(filename)
    assert_raises(IOError,
                  aw.write_audio,
                  filename,
                  data,
                  samplerate,
                  encoding='xxx')
    aw.write_audio(filename, data, samplerate, encoding='')
    os.remove(filename)
    # test for not available modules:
    for lib, write_func in aw.audio_writer_funcs:
        am.disable_module(lib)
        assert_raises(ImportError, write_func, filename, data, samplerate)
        am.enable_module(lib)
    for lib, encodings_func in aw.audio_encodings_funcs:
        am.disable_module(lib)
        enc = encodings_func(format)
        assert_equal(
            len(enc), 0,
            'no encoding should be returned for disabled module %s' % lib)
        am.enable_module(lib)
    for lib, formats_func in aw.audio_formats_funcs:
        am.disable_module(lib)
        formats = formats_func()
        assert_equal(
            len(formats), 0,
            'no format should be returned for disabled module %s' % lib)
        am.enable_module(lib)
Beispiel #21
0
def test_demo():
    am.enable_module()
    filename = 'test.wav'
    write_audio_file(filename, duration=5.0)
    al.demo(filename, False)
    os.remove(filename)
Beispiel #22
0
def test_demo():
    am.enable_module()
    ap.demo()
Beispiel #23
0
def test_main():
    am.enable_module()
    ap.main(['prog', '-h'])
    ap.main(['prog'])
    ap.main(['prog', '-m', 'sounddevice'])
    ap.main(['prog', 'x'])