Skip to content

Commit

Permalink
more pep8, version jump
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian-Robert Stöter committed Apr 11, 2015
1 parent 800aa67 commit db23531
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 38 deletions.
16 changes: 2 additions & 14 deletions isobar/pattern/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class PSeq(Pattern):
"""

def __init__(self, list=[], repeats=sys.maxsize):
#----------------------------------------------------------------------
# take a copy of the list to avoid changing the original
#----------------------------------------------------------------------
assert hasattr(list, "__getitem__"), "PSeq must take a list argument"
self.list = copy.copy(list)
self.repeats = repeats
Expand All @@ -42,7 +40,6 @@ def next(self):

# support for pattern arguments
list = self.value(self.list)
repeats = self.value(self.repeats)

rv = Pattern.value(list[self.pos])
self.pos += 1
Expand Down Expand Up @@ -123,7 +120,8 @@ class PGeom(Pattern):
>>> p = PGeom(1, 2)
>>> p.nextn(16)
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512,
1024, 2048, 4096, 8192, 16384, 32768]
"""

def __init__(self, start=1, multiply=2, length=sys.maxsize):
Expand Down Expand Up @@ -305,22 +303,16 @@ def next(self):
repeat = random.uniform(0, 1) < prob

if self.rcount >= count or not repeat:
#--------------------------------------------------------------
# finished creeping, pull some more data from our buffer
#--------------------------------------------------------------
for n in range(creep):
self.buffer.pop(0)
self.buffer.append(self.pattern.next())
self.rcount = 1
else:
#--------------------------------------------------------------
# finished the Nth repeat but, still more repeats to do
#--------------------------------------------------------------
self.rcount += 1

#------------------------------------------------------------------
# reset to the start of our buffer
#------------------------------------------------------------------
if not repeat:
self.pos -= 1
else:
Expand Down Expand Up @@ -604,14 +596,10 @@ def __init__(self, chord=Chord.major, type=UP):
self.offsets = []

try:
#------------------------------------------------------------------
# prefer to specify a chord (or Key)
#------------------------------------------------------------------
self.notes = self.chord.semitones
except:
#------------------------------------------------------------------
# can alternatively specify a list of notes
#------------------------------------------------------------------
self.notes = self.chord

if type == PArp.UP:
Expand Down
4 changes: 2 additions & 2 deletions isobar/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ def play(self):
except:
values["note"] = key[degree] + (octave * 12)

#----------------------------------------------------------------------
'''
# For cases in which we want to introduce a rest, simply set our 'amp'
# value to zero. This means that we can still send rest events to
# devices which receive all generic events (useful to display rests
# when rendering a score).
#----------------------------------------------------------------------
'''
if random.uniform(0, 1) < values['omit']:
values["note"] = None

Expand Down
41 changes: 19 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,27 @@

from setuptools import setup

#------------------------------------------------------------------------
# Generate a PyPI-friendly RST file from our markdown README.
#------------------------------------------------------------------------
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except:
long_description = None
long_description = None

setup(
name = 'isobar',
version = '0.0.1',
description = 'A Python library to express and manipulate musical patterns',
long_description = long_description,
author = 'Daniel Jones',
author_email = 'dan-isobar@erase.net',
url = 'https://github.com/ideoforms/isobar',
packages = ['isobar'],
install_requires = ['pyOSC >= 0.3b0', 'python-rtmidi'],
keywords = ('sound', 'music', 'composition'),
classifiers = [
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Artistic Software',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers'
]
name='isobar',
version='0.0.2',
description='A Python library to express and manipulate musical patterns',
long_description=long_description,
author='Daniel Jones',
author_email='dan-isobar@erase.net',
url='https://github.com/ideoforms/isobar',
packages=['isobar'],
install_requires=['pyOSC >= 0.3b0', 'python-rtmidi'],
keywords=('sound', 'music', 'composition'),
classifiers=[
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Artistic Software',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers'
]
)

0 comments on commit db23531

Please sign in to comment.