diff --git a/.travis.yml b/.travis.yml index ee5a765..3145019 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,10 @@ +dist: xenial language: python python: - "2.7" - "3.4" - "3.5" - - "3.5-dev" # 3.5 development branch - "3.6" - - "3.6-dev" # 3.6 development branch -# scipy is not supported -# - "3.7-dev" # 3.7 development branch -# - "nightly" before_install: - sudo apt-get -qq update @@ -16,7 +12,16 @@ before_install: install: - pip install -r requirements.txt - - python setup.py develop + - pip install . script: - python setup.py test + +deploy: + provider: pypi + user: yuma-m + password: + secure: qjpVeA6X06tcuOtaFqoVD9fnbxRW4OGRrP/0bIqCdxj9HoDBPCJkgvcxVSrAzB+4ejsPPvIuqBdtnbcCkYmq+tpsK2Gh8HVU/XBSE0jF4luwKgMvHIh0WxsxgtWjft0tlD14kfGES5zIOyd3Jqz7f7BA+tg+jIn16eysEjysphM2rzlorQdiDfvtvILJZ7NvuCPvV4XD+vVdzzJll5f8Ps9F/Y/F9/nvFjXK1c5+OOrc47o3i/0fA711dcw9h4oho9CNcp904gaEiwtOxTGkAAuxlHSqiD1/aZ3XHKnmEyV00UZlndZXNFjhEqXoGi7QZihO3B0Zf4FbMvydSRzEuPUgqoVaNkLwDN6vr2m9RU9Z8VnkUwgOlqp3QlHF7sOSd1BtjgAmCdctdzjWlHDxwnytP4mgcZsHLb+LHs7k6k2KUtnp7TX2F9EDP/I2u+g3SrgbORkOec0ULFyih4pIhGrGfNwRFVnwaRWRiHGvEpo1GG3EQ+UKJt+o4MEmR23ZSXm2/gOZmpO9sFf/bJsXEm79VSGcmgm3Lxe5Lzdz2GJKFhTZE2VtVrHBY95Uy8TVZPPy1KmrjFEqcoh0Kix5+s0p9oNs+6gpqYpRR5PJOWtK53fyvw/2NQAmeNJ3DTEmfrtbXFiDM4ud8tmt76DxIaJV3jlTvFF8Og27tkwHNxU= + on: + python: 3.6 + tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md index fb3cb5f..0547f82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.1.5 + +- Support triangle wave. + - Contributor: @AntiMatterAMA + ## 0.1.4 - Fix channels of Player class from 2 to 1 to play proper sound. diff --git a/README.md b/README.md index 0200a00..33df8b6 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ $ pip install pyaudio ## Supported OS -- macOS Sierra +- macOS 10.12 and above - Ubuntu 16.04 ## Supported versions diff --git a/example/play_440hz.py b/example/play_440hz.py index 7211f9e..af245f5 100755 --- a/example/play_440hz.py +++ b/example/play_440hz.py @@ -20,6 +20,11 @@ def main(): player.play_wave(synthesizer.generate_constant_wave(440.0, 3.0)) time.sleep(0.5) + print("play triangle wave") + synthesizer = Synthesizer(osc1_waveform=Waveform.triangle, osc1_volume=0.8, use_osc2=False) + player.play_wave(synthesizer.generate_constant_wave(440.0, 3.0)) + time.sleep(0.5) + print("play synthesized wave 1") synthesizer = Synthesizer( osc1_waveform=Waveform.sawtooth, osc1_volume=1.0, diff --git a/setup.py b/setup.py index faf5c2e..ee932cb 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,5 @@ from setuptools import setup, find_packages -version = '0.1.4' - -try: - import pypandoc - read_md = lambda f: pypandoc.convert(f, 'rst') -except ImportError: - print("warning: pypandoc module not found, could not convert Markdown to RST") - read_md = lambda f: open(f, 'r').read() +version = '0.1.5' setup( name='synthesizer', @@ -28,7 +21,8 @@ packages=find_packages(exclude=['test']), include_package_data=True, zip_safe=True, - long_description=read_md('README.md'), + long_description=open('README.md').read(), + long_description_content_type='text/markdown', test_suite='nose.collector', install_requires=[ 'enum34>=1.1.6', diff --git a/synthesizer/synthesizer.py b/synthesizer/synthesizer.py index 7ff6679..04f3605 100644 --- a/synthesizer/synthesizer.py +++ b/synthesizer/synthesizer.py @@ -45,8 +45,10 @@ def generate_wave(self, phases): phases = np.copy(phases) * self._freq_transpose return self._volume * self._wave_func(phases) - def gen_triang(self,t,width=0.5): - return scipy.signal.sawtooth(t,width) + @staticmethod + def gen_triang(t, width=0.5): + return scipy.signal.sawtooth(t, width) + class Synthesizer(object): u""" Virtual analog synthesizer object diff --git a/test/test_synthesizer.py b/test/test_synthesizer.py index 2c632af..5b22c46 100644 --- a/test/test_synthesizer.py +++ b/test/test_synthesizer.py @@ -31,3 +31,12 @@ def test_square_wave(): assert_almost_equal(wave.max(), 1.0, places=3) assert_almost_equal(wave.min(), -1.0, places=3) assert_almost_equal(wave.mean(), 0.0, places=3) + + +def test_triangle_wave(): + synthesizer = Synthesizer(osc1_waveform=Waveform.triangle, osc1_volume=1.0, use_osc2=False, rate=RATE) + wave = synthesizer.generate_constant_wave(440.0, 1.0) + eq_(wave.size, RATE) + assert_almost_equal(wave.max(), 1.0, places=3) + assert_almost_equal(wave.min(), -1.0, places=3) + assert_almost_equal(wave.mean(), 0.0, places=3)