Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ $ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import melopy
>>> melopy.major_scale('C5')
['C5', 'D5', 'E5', 'F5', 'G5', 'A5', 'B5']
>>> from melopy.scales import generateScale
>>> generateScale('major', 'c4')
['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5']
>>>
```

Expand All @@ -39,7 +39,7 @@ For examples, check out the `examples` directory:

To run the tests:

$ python tests/melopy_tests.py
$ python tests.py

### Organization

Expand Down
6 changes: 3 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Load it
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import melopy
>>> melopy.major_scale('C5')
>>> from melopy.scales import generateScale
>>> generateScale('major', 'C5')
['C5', 'D5', 'E5', 'F5', 'G5', 'A5', 'B5']
>>>

Expand All @@ -51,7 +51,7 @@ To run the tests:

::

$ python tests/melopy_tests.py
$ python tests.py

Organization
============
Expand Down
5 changes: 3 additions & 2 deletions melopy/chords.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from utility import note_to_key, key_to_note, iterate
from exceptions import MelopyGenericError
from __future__ import absolute_import, division
from melopy.utility import note_to_key, key_to_note, iterate
from melopy.exceptions import MelopyGenericError

CHORD_INTERVALS = {
'maj': [4,3],
Expand Down
6 changes: 4 additions & 2 deletions melopy/melopy.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division, absolute_import

import wave, struct, random, math
import os, sys

from utility import *
from scales import *
from melopy.utility import *
from melopy.scales import *

# same included wave functions
# a function of frequency and tick
Expand Down
5 changes: 3 additions & 2 deletions melopy/scales.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from utility import note_to_key, key_to_note, iterate
from exceptions import MelopyGenericError
from __future__ import absolute_import, division
from melopy.utility import note_to_key, key_to_note, iterate
from melopy.exceptions import MelopyGenericError

SCALE_STEPS = {
"major":[2,2,1,2,2,2,1],
Expand Down
5 changes: 3 additions & 2 deletions melopy/utility.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division, absolute_import
from math import log
from exceptions import MelopyGenericError, MelopyValueError
from melopy.exceptions import MelopyGenericError, MelopyValueError

def key_to_frequency(key):
"""Returns the frequency of the note (key) keys from A0"""
Expand All @@ -11,7 +12,7 @@ def key_to_frequency(key):
def key_to_note(key, octaves=True):
"""Returns a string representing a note which is (key) keys from A0"""
notes = ['a','a#','b','c','c#','d','d#','e','f','f#','g','g#']
octave = (key + 8) / 12
octave = (key + 8) // 12
note = notes[(key - 1) % 12]

if octaves:
Expand Down
1 change: 1 addition & 0 deletions tests/melopy_tests.py → tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, nested_scopes

import unittest

Expand Down
2 changes: 0 additions & 2 deletions tests/__init__.py

This file was deleted.