Permalink
Browse files

Basic documentation

  • Loading branch information...
1 parent 898369a commit 2272d9d1f3b85bbee8e25c5ee93f5bf7486dd29b @kroger committed Apr 14, 2012
Showing with 52 additions and 31 deletions.
  1. +1 −1 README
  2. +0 −2 docs/Makefile
  3. +1 −0 docs/conf.py
  4. +21 −22 docs/index.rst
  5. +5 −0 docs/music.rst
  6. +0 −2 docs/pyknon.rst
  7. +6 −0 docs/simplemusic.rst
  8. +6 −0 docs/tutorial.rst
  9. +1 −1 pyknon/notation.py
  10. +3 −3 pyknon/plot.py
  11. +8 −0 pyknon/simplemusic.py
View
2 README
@@ -3,7 +3,7 @@ Introduction
Pyknon is a simple music library for Python hackers. With Pyknon you
can generate Midi files quickly and reason about musical
-proprierties.
+proprieties.
Pyknon works with Python 2.6, 2.7, and 3.2.
View
@@ -1,8 +1,6 @@
# Makefile for Sphinx documentation
#
-export PYTHONPATH=../pyknon/:../:$PYTHONPATH
-
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
View
@@ -3,6 +3,7 @@
import sys, os
sys.path.append(os.path.abspath('extensions'))
+sys.path.append(os.path.abspath("../pyknon"))
# -- General configuration -----------------------------------------------------
View
@@ -1,33 +1,32 @@
-Pyknon Documentation
-====================
+======================
+ Pyknon Documentation
+======================
-Pyknon is a simple library for music Set Theory. The main goal is to
-have a simple library to write short scripts. For instance, if you
-want to write an on-line tool to generate 12-tone rows, this library
-maybe to you. On the other hand, if you want to parse music in complex
-formats such as MIDI or MusicXML and perform complex operations
-involving pitch and rhythm, you should use something like
-`music21 <http://mit.edu/music21/>`_.
+.. rubric:: Make music with Python.
-Another goal of Pyknon is to be something good to reason about the
-properties and operations of pitch-class sets.
+Pyknon is a simple music library for Python hackers. With Pyknon you
+can generate Midi files quickly and reason about musical
+proprieties. It works with Python 2.6, 2.7, and 3.2.
- * functional
- * simple
- * documented
+Pyknon has modules for different things. I recommend you start by
+checking the section :ref:`tutorial`. It's a hands on approach on how
+to use this library.
+
+You'll almost always want to work with the modules :mod:`music` and
+:mod:`genmidi` (see section :ref:`music`).
+
+The module :mod:`simplemusic` is a simple numeric library for music
+operations. It's intended mainly for teaching because it's simple. If
+you want to learn more about Set Theory in Music, you may want to look
+at the module :mod:`pcset` (see section :ref:`simplemusic`)
Contents:
---------
.. toctree::
:maxdepth: 1
+ tutorial.rst
pyknon.rst
-
-Indices and tables
-------------------
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
+ music.rst
+ simplemusic.rst
View
@@ -0,0 +1,5 @@
+.. _music:
+
+=============================
+ Notes, Rests, and Sequences
+=============================
View
@@ -26,7 +26,6 @@ note with a duration like '16..' will have a total duration of
>>> calculate_duration(16, 2)
Fraction(7, 64)
-
Integer notation
----------------
@@ -167,4 +166,3 @@ Subset and supersets
12-tone matrix
--------------
- .. autofunction:: simplemusic.matrix
View
@@ -0,0 +1,6 @@
+.. _simplemusic:
+
+==================================
+ Simplemusic and Pitch Class Sets
+==================================
+
View
@@ -0,0 +1,6 @@
+.. _tutorial:
+
+============================================
+ Writing your first composition with Python
+============================================
+
View
@@ -52,7 +52,7 @@ def parse_note(note, volume=120, prev_octave=5, prev_dur=0.25):
note_number = (pitch_number + acc_number) % 12
return note_number, octave, duration, volume
-
+
def parse_notes(notes, volume=120):
prev_oct = 5 # default octave
prev_dur = 0.25 # default duration is 1/4, but it's 1 in the MIDI library
View
@@ -20,12 +20,12 @@ def points_in_a_circle(n_points, radius):
def scaled_points(radius):
points = points_in_a_circle(12, radius)
return [(x + radius + MARGIN, radius - y + MARGIN) for x, y in points]
-
+
def plot_circle(canvas, width, points):
canvas.create_oval(MARGIN, width, width, MARGIN)
-
+
def plot_points(canvas, points):
for x, y in points:
canvas.create_oval(x - 2, y - 2, x + 2, y + 2, fill="black")
@@ -60,7 +60,7 @@ def view(notes_list, width=400):
canvas = canvas_notes(notes_list, width)
mainloop()
-
+
def notes_ps(notes_list, filename, width=400):
canvas = canvas_notes(notes_list, width)
L, T, R, B = canvas.bbox(Tk.ALL)
View
@@ -1,3 +1,11 @@
+"""
+A simple numeric library for music computation.
+
+This module is good for teaching, demonstration, and quick hacks. To
+generate actual music you should use the music module.
+
+"""
+
from __future__ import division
from itertools import combinations, chain

0 comments on commit 2272d9d

Please sign in to comment.