commit python-sounddevice for openSUSE:Factory
Hello community, here is the log from the commit of package python-sounddevice for openSUSE:Factory checked in at 2019-05-22 11:15:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sounddevice (Old) and /work/SRC/openSUSE:Factory/.python-sounddevice.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-sounddevice" Wed May 22 11:15:20 2019 rev:4 rq:704374 version:0.3.13 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sounddevice/python-sounddevice.changes 2018-12-24 11:44:12.529302295 +0100 +++ /work/SRC/openSUSE:Factory/.python-sounddevice.new.5148/python-sounddevice.changes 2019-05-22 11:15:22.650541026 +0200 @@ -1,0 +2,7 @@ +Tue May 21 07:20:34 UTC 2019 - pgajdos@suse.com + +- version update to 0.3.13 + * Examples asyncio_coroutines.py and asyncio_generators.py +- package examples + +------------------------------------------------------------------- Old: ---- sounddevice-0.3.12.tar.gz New: ---- sounddevice-0.3.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sounddevice.spec ++++++ --- /var/tmp/diff_new_pack.vS1wij/_old 2019-05-22 11:15:24.926540607 +0200 +++ /var/tmp/diff_new_pack.vS1wij/_new 2019-05-22 11:15:24.926540607 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-sounddevice # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-sounddevice -Version: 0.3.12 +Version: 0.3.13 Release: 0 Summary: Play and Record Sound with Python License: MIT @@ -26,6 +26,7 @@ Url: http://python-sounddevice.readthedocs.io/ Source: https://files.pythonhosted.org/packages/source/s/sounddevice/sounddevice-%{version}.tar.gz BuildRequires: %{python_module cffi >= 1.0} +BuildRequires: %{python_module numpy} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: portaudio @@ -46,6 +47,7 @@ %setup -q -n sounddevice-%{version} %build +chmod 644 examples/* %python_build %install @@ -53,8 +55,11 @@ %python_expand fdupes %{buildroot}%{$python_sitelib} %files %{python_files} -%doc NEWS.rst README.rst +%doc NEWS.rst README.rst examples %license LICENSE %{python_sitelib}/* +%check +# no upstream tests, examples needs devices + %changelog ++++++ sounddevice-0.3.12.tar.gz -> sounddevice-0.3.13.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/LICENSE new/sounddevice-0.3.13/LICENSE --- old/sounddevice-0.3.12/LICENSE 2018-05-04 09:43:31.000000000 +0200 +++ new/sounddevice-0.3.13/LICENSE 2019-02-27 10:40:35.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2015-2018 Matthias Geier +Copyright (c) 2015-2019 Matthias Geier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/NEWS.rst new/sounddevice-0.3.13/NEWS.rst --- old/sounddevice-0.3.12/NEWS.rst 2018-09-02 11:05:13.000000000 +0200 +++ new/sounddevice-0.3.13/NEWS.rst 2019-02-27 10:40:35.000000000 +0100 @@ -1,3 +1,6 @@ +0.3.13 (2019-02-27): + * Examples ``asyncio_coroutines.py`` and ``asyncio_generators.py`` + 0.3.12 (2018-09-02): * Support for the dylib from Anaconda diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/PKG-INFO new/sounddevice-0.3.13/PKG-INFO --- old/sounddevice-0.3.12/PKG-INFO 2018-09-02 11:08:24.000000000 +0200 +++ new/sounddevice-0.3.13/PKG-INFO 2019-02-27 10:41:45.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: sounddevice -Version: 0.3.12 +Version: 0.3.13 Summary: Play and Record Sound with Python Home-page: http://python-sounddevice.readthedocs.io/ Author: Matthias Geier diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/doc/conf.py new/sounddevice-0.3.13/doc/conf.py --- old/sounddevice-0.3.12/doc/conf.py 2018-08-22 12:16:04.000000000 +0200 +++ new/sounddevice-0.3.13/doc/conf.py 2019-02-27 10:40:35.000000000 +0100 @@ -75,7 +75,7 @@ # General information about the project. authors = 'Matthias Geier' project = 'python-sounddevice' -copyright = '2018, ' + authors +copyright = '2019, ' + authors # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/doc/examples.rst new/sounddevice-0.3.13/doc/examples.rst --- old/sounddevice-0.3.12/doc/examples.rst 2018-08-22 12:11:03.000000000 +0200 +++ new/sounddevice-0.3.13/doc/examples.rst 2019-02-17 13:52:38.000000000 +0100 @@ -42,3 +42,17 @@ :download:`rec_unlimited.py <../examples/rec_unlimited.py>` .. literalinclude:: ../examples/rec_unlimited.py + +Using a stream in an `asyncio` coroutine +---------------------------------------- + +:download:`asyncio_coroutines.py <../examples/asyncio_coroutines.py>` + +.. literalinclude:: ../examples/asyncio_coroutines.py + +Creating an `asyncio` generator for audio blocks +------------------------------------------------ + +:download:`asyncio_generators.py <../examples/asyncio_generators.py>` + +.. literalinclude:: ../examples/asyncio_generators.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/doc/fake__sounddevice.py new/sounddevice-0.3.13/doc/fake__sounddevice.py --- old/sounddevice-0.3.12/doc/fake__sounddevice.py 2018-08-21 20:10:46.000000000 +0200 +++ new/sounddevice-0.3.13/doc/fake__sounddevice.py 2019-02-14 16:18:43.000000000 +0100 @@ -1,7 +1,7 @@ """Mock module for Sphinx autodoc.""" -import ctypes +import ctypes.util old_find_library = ctypes.util.find_library diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/examples/asyncio_coroutines.py new/sounddevice-0.3.13/examples/asyncio_coroutines.py --- old/sounddevice-0.3.12/examples/asyncio_coroutines.py 1970-01-01 01:00:00.000000000 +0100 +++ new/sounddevice-0.3.13/examples/asyncio_coroutines.py 2019-02-17 13:52:38.000000000 +0100 @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""An example for using a stream in an asyncio coroutine. + +This example shows how to create a stream in a coroutine and how to wait for +the completion of the stream. + +You need Python 3.7 or newer to run this. + +""" +import asyncio + +import numpy as np +import sounddevice as sd + + +async def record_buffer(buffer, **kwargs): + loop = asyncio.get_event_loop() + event = asyncio.Event() + idx = 0 + + def callback(indata, frame_count, time_info, status): + nonlocal idx + if status: + print(status) + remainder = len(buffer) - idx + if remainder == 0: + loop.call_soon_threadsafe(event.set) + raise sd.CallbackStop + indata = indata[:remainder] + buffer[idx:idx + len(indata)] = indata + idx += len(indata) + + stream = sd.InputStream(callback=callback, dtype=buffer.dtype, + channels=buffer.shape[1], **kwargs) + with stream: + await event.wait() + + +async def play_buffer(buffer, **kwargs): + loop = asyncio.get_event_loop() + event = asyncio.Event() + idx = 0 + + def callback(outdata, frame_count, time_info, status): + nonlocal idx + if status: + print(status) + remainder = len(buffer) - idx + if remainder == 0: + loop.call_soon_threadsafe(event.set) + raise sd.CallbackStop + valid_frames = frame_count if remainder >= frame_count else remainder + outdata[:valid_frames] = buffer[idx:idx + valid_frames] + outdata[valid_frames:] = 0 + idx += valid_frames + + stream = sd.OutputStream(callback=callback, dtype=buffer.dtype, + channels=buffer.shape[1], **kwargs) + with stream: + await event.wait() + + +async def main(frames=150_000, channels=1, dtype='float32', **kwargs): + buffer = np.empty((frames, channels), dtype=dtype) + print('recording buffer ...') + await record_buffer(buffer, **kwargs) + print('playing buffer ...') + await play_buffer(buffer, **kwargs) + print('done') + + +if __name__ == "__main__": + asyncio.run(main()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/examples/asyncio_generators.py new/sounddevice-0.3.13/examples/asyncio_generators.py --- old/sounddevice-0.3.12/examples/asyncio_generators.py 1970-01-01 01:00:00.000000000 +0100 +++ new/sounddevice-0.3.13/examples/asyncio_generators.py 2019-02-17 13:52:38.000000000 +0100 @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +"""Creating an asyncio generator for blocks of audio data. + +This example shows how a generator can be used to analyze audio input blocks. +In addition, it shows how a generator can be created that yields not only input +blocks but also output blocks where audio data can be written to. + +You need Python 3.7 or newer to run this. + +""" +import asyncio +import queue + +import numpy as np +import sounddevice as sd + + +async def inputstream_generator(channels=1, **kwargs): + """Generator that yields blocks of input data as NumPy arrays.""" + q_in = asyncio.Queue() + loop = asyncio.get_event_loop() + + def callback(indata, frame_count, time_info, status): + loop.call_soon_threadsafe(q_in.put_nowait, (indata.copy(), status)) + + stream = sd.InputStream(callback=callback, channels=channels, **kwargs) + with stream: + while True: + indata, status = await q_in.get() + yield indata, status + + +async def stream_generator(blocksize, *, channels=1, dtype='float32', + pre_fill_blocks=10, **kwargs): + """Generator that yields blocks of input/output data as NumPy arrays. + + The output blocks are uninitialized and have to be filled with + appropriate audio signals. + + """ + assert blocksize != 0 + q_in = asyncio.Queue() + q_out = queue.Queue() + loop = asyncio.get_event_loop() + + def callback(indata, outdata, frame_count, time_info, status): + loop.call_soon_threadsafe(q_in.put_nowait, (indata.copy(), status)) + outdata[:] = q_out.get_nowait() + + # pre-fill output queue + for _ in range(pre_fill_blocks): + q_out.put(np.zeros((blocksize, channels), dtype=dtype)) + + stream = sd.Stream(blocksize=blocksize, callback=callback, dtype=dtype, + channels=channels, **kwargs) + with stream: + while True: + indata, status = await q_in.get() + outdata = np.empty((blocksize, channels), dtype=dtype) + yield indata, outdata, status + q_out.put_nowait(outdata) + + +async def print_input_infos(**kwargs): + """Show minimum and maximum value of each incoming audio block.""" + async for indata, status in inputstream_generator(**kwargs): + if status: + print(status) + print('min:', indata.min(), '\t', 'max:', indata.max()) + + +async def wire_coro(**kwargs): + """Create a connection between audio inputs and outputs. + + Asynchronously iterates over a stream generator and for each block + simply copies the input data into the output block. + + """ + async for indata, outdata, status in stream_generator(**kwargs): + if status: + print(status) + outdata[:] = indata + + +async def main(**kwargs): + print('Some informations about the input signal:') + try: + await asyncio.wait_for(print_input_infos(), timeout=2) + except asyncio.TimeoutError: + pass + print('\nEnough of that, activating wire ...\n') + audio_task = asyncio.create_task(wire_coro(**kwargs)) + for i in range(10, 0, -1): + print(i) + await asyncio.sleep(1) + audio_task.cancel() + try: + await audio_task + except asyncio.CancelledError: + print('wire was cancelled') + + +if __name__ == "__main__": + asyncio.run(main(blocksize=1024)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/examples/play_long_file.py new/sounddevice-0.3.13/examples/play_long_file.py --- old/sounddevice-0.3.12/examples/play_long_file.py 2017-11-29 11:26:21.000000000 +0100 +++ new/sounddevice-0.3.13/examples/play_long_file.py 2019-02-14 16:18:43.000000000 +0100 @@ -70,7 +70,7 @@ with sf.SoundFile(args.filename) as f: for _ in range(args.buffersize): - data = f.buffer_read(args.blocksize, ctype='float') + data = f.buffer_read(args.blocksize, dtype='float32') if not data: break q.put_nowait(data) # Pre-fill queue @@ -82,7 +82,7 @@ with stream: timeout = args.blocksize * args.buffersize / f.samplerate while data: - data = f.buffer_read(args.blocksize, ctype='float') + data = f.buffer_read(args.blocksize, dtype='float32') q.put(data, timeout=timeout) event.wait() # Wait until playback is finished except KeyboardInterrupt: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/examples/plot_input.py new/sounddevice-0.3.13/examples/plot_input.py --- old/sounddevice-0.3.12/examples/plot_input.py 2017-11-29 11:26:21.000000000 +0100 +++ new/sounddevice-0.3.13/examples/plot_input.py 2019-02-14 16:18:43.000000000 +0100 @@ -100,8 +100,8 @@ ax.axis((0, len(plotdata), -1, 1)) ax.set_yticks([0]) ax.yaxis.grid(True) - ax.tick_params(bottom='off', top='off', labelbottom='off', - right='off', left='off', labelleft='off') + ax.tick_params(bottom=False, top=False, labelbottom=False, + right=False, left=False, labelleft=False) fig.tight_layout(pad=0) stream = sd.InputStream( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/setup.py new/sounddevice-0.3.13/setup.py --- old/sounddevice-0.3.12/setup.py 2018-04-23 12:13:45.000000000 +0200 +++ new/sounddevice-0.3.13/setup.py 2019-02-14 16:18:43.000000000 +0100 @@ -11,7 +11,7 @@ PYTHON_INTERPRETERS = '.'.join([ 'cp26', 'cp27', - 'cp32', 'cp33', 'cp34', 'cp35', 'cp36', 'cp37', + 'cp32', 'cp33', 'cp34', 'cp35', 'cp36', 'cp37', 'cp38', 'pp27', 'pp32', 'pp33', 'pp34', 'pp35', 'pp36', ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/sounddevice.egg-info/PKG-INFO new/sounddevice-0.3.13/sounddevice.egg-info/PKG-INFO --- old/sounddevice-0.3.12/sounddevice.egg-info/PKG-INFO 2018-09-02 11:08:24.000000000 +0200 +++ new/sounddevice-0.3.13/sounddevice.egg-info/PKG-INFO 2019-02-27 10:41:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: sounddevice -Version: 0.3.12 +Version: 0.3.13 Summary: Play and Record Sound with Python Home-page: http://python-sounddevice.readthedocs.io/ Author: Matthias Geier diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/sounddevice.egg-info/SOURCES.txt new/sounddevice-0.3.13/sounddevice.egg-info/SOURCES.txt --- old/sounddevice-0.3.12/sounddevice.egg-info/SOURCES.txt 2018-09-02 11:08:24.000000000 +0200 +++ new/sounddevice-0.3.13/sounddevice.egg-info/SOURCES.txt 2019-02-27 10:41:44.000000000 +0100 @@ -17,6 +17,8 @@ doc/requirements.txt doc/usage.rst doc/version-history.rst +examples/asyncio_coroutines.py +examples/asyncio_generators.py examples/play_file.py examples/play_long_file.py examples/plot_input.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sounddevice-0.3.12/sounddevice.py new/sounddevice-0.3.13/sounddevice.py --- old/sounddevice-0.3.12/sounddevice.py 2018-09-02 11:03:35.000000000 +0200 +++ new/sounddevice-0.3.13/sounddevice.py 2019-02-27 10:40:35.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2018 Matthias Geier +# Copyright (c) 2015-2019 Matthias Geier # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -48,7 +48,7 @@ http://python-sounddevice.readthedocs.io/ """ -__version__ = '0.3.12' +__version__ = '0.3.13' import atexit as _atexit import os as _os
participants (1)
-
root