Skip to content

Commit

Permalink
Release 0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobjoaquin committed Jul 24, 2009
1 parent 9cefe89 commit 01e1205
Show file tree
Hide file tree
Showing 26 changed files with 224 additions and 159 deletions.
5 changes: 3 additions & 2 deletions MANIFEST
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ demo/score_from_csd.csd
demo/score_from_csd.py demo/score_from_csd.py
demo/swap_columns.py demo/swap_columns.py
demo/swap_columns.sco demo/swap_columns.sco
demo/swap_pan_position.sco demo/test.py
docs/.DS_Store
docs/.buildinfo docs/.buildinfo
docs/bugs.html docs/bugs.html
docs/commandline.html docs/commandline.html
docs/csd_sco_event.html docs/csd_sco_event.html
docs/genindex.html docs/genindex.html
docs/glossary.html docs/glossary.html
docs/index.html docs/index.html
docs/install.html
docs/modindex.html docs/modindex.html
docs/objects.inv docs/objects.inv
docs/search.html docs/search.html
Expand All @@ -39,6 +39,7 @@ docs/_sources/commandline.txt
docs/_sources/csd_sco_event.txt docs/_sources/csd_sco_event.txt
docs/_sources/glossary.txt docs/_sources/glossary.txt
docs/_sources/index.txt docs/_sources/index.txt
docs/_sources/install.txt
docs/_sources/demo/index.txt docs/_sources/demo/index.txt
docs/_static/basic.css docs/_static/basic.css
docs/_static/default.css docs/_static/default.css
Expand Down
65 changes: 64 additions & 1 deletion README
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1,65 @@
Fill me. Csound csd Python Package
By Jacob Joaquin

jacobjoaquin@gmail.com
http://www.thumbuki.com/
http://jacobjoaquin.tumblr.com/
http://twitter.com/JacobJoaquin

copyright (c) Jacob Joaquin 2009

Mission Statement
-----------------

*"Enable users to process and generate Csound orchestras and scores
quickly, easily and efficiently."*


Quick Installation Instructions
-------------------------------

After downloading the csd tar file, you can install csd in using the
following command-lines in a terminal window::

gunzip -c csd-x.x.x.tar | tar xf -
cd csd-x.x.x
python setup.py install

See included manual for more details.

About
-----

CSD provides core functions for building python scripts that can process
and generate Csound code.

As of this moment, the focus is on score manipulation. CSD comes with
many functions that can parse, pull, push information in and out of
Csound scores. In the future, there are plans to provide equivalent
functions for Csound orchestras.

This package ships with a few demo scripts that can be of great use to
anyone who writes Csound music the old fashion way, that is, with a text
editor. The ``sco_align`` script will save you from repeatedly typing
'space-down-left' by aligning Csound scores auto-magically. If you need
to run a dozen or more pfields through a function, ``pfunc`` lets your
write your own function and choose which instruments and pfields to
operate on with a single command-line in a terminal window. Or if you
are organizing your pfields, and decided that amp would work better on
pfield 4 and pitch on pfield 5, then ``swap_columns`` is just what you
need.

In order to use these demo scripts, you'll need to use a command-line
terminal. However, using these scripts in applications may be possible
in the future.

If you are a developer of a Csound front-end, Csound based-app, or are
just looking to extend the capabilities of your favorites text editor,
let me know so we can start the process of figuring out our respective
needs to make this happen. I'm open to any and all ideas from anyone.

This package is currently still very early in the development cycle,
though quickly approaching a beta release. The scripts have been tested
primarily with Apple's Python 2.5.1.



Binary file modified _doc_source/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified _doc_source/build/doctrees/index.doctree
Binary file not shown.
6 changes: 3 additions & 3 deletions _doc_source/source/conf.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
master_doc = 'index' master_doc = 'index'


# General information about the project. # General information about the project.
project = u'CSD' project = u'csd'
copyright = u'2009, Jacob Joaquin' copyright = u'2009, Jacob Joaquin'


# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.0.3' version = '0.0.4'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.0.3 alpha' release = '0.0.4 alpha'


# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
Expand Down
9 changes: 7 additions & 2 deletions _doc_source/source/index.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ Mission Statement


*"Enable users to process and generate Csound orchestras and scores *"Enable users to process and generate Csound orchestras and scores
quickly, easily and efficiently."* quickly, easily and efficiently."*


Download
--------

`csd-0.0.4.tar.gz <http://www.thumbuki.com/csd/release/csd-0.0.4.tar.gz>`_

About About
----- -----


Expand Down Expand Up @@ -59,7 +64,7 @@ primarily with Apple's Python 2.5.1.
Information Information
----------- -----------


Csound CSD Package Csound csd Python Package


By Jacob Joaquin By Jacob Joaquin


Expand Down
11 changes: 5 additions & 6 deletions build/lib/csd/sco/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def map_(score, pattern, pfield_index_list, pfunction, *args):
return merge(score, selection_) return merge(score, selection_)


def select(score, pattern): def select(score, pattern):
'''Returns a dict with matched events from a score. '''Returns a selection from a score.
{index_of_event: event}
Example:: Example::
Expand All @@ -122,7 +121,7 @@ def select(score, pattern):
... , {0: 'i'}) ... , {0: 'i'})
{1: 'i 1 0 4 1.0 440', 2: 'i 1 4 4 0.5 880'} {1: 'i 1 0 4 1.0 440', 2: 'i 1 4 4 0.5 880'}
See :term:`pattern`, :term:`score` See :term:`pattern`, :term:`score`, :term:`selection`
''' '''


Expand All @@ -140,7 +139,7 @@ def select(score, pattern):
return selection_ return selection_


def select_all(score): def select_all(score):
'''Returns a dict of all events in a score, keyed by index. '''Returns a selection of all events in a score.
Example:: Example::
Expand All @@ -150,11 +149,11 @@ def select_all(score):
... i 1 4 4 0.5 880""") ... i 1 4 4 0.5 880""")
{0: 'f 1 0 8192 10 1', 1: 'i 1 0 4 1.0 440', 2: 'i 1 4 4 0.5 880'} {0: 'f 1 0 8192 10 1', 1: 'i 1 0 4 1.0 440', 2: 'i 1 4 4 0.5 880'}
See :term:`score` See :term:`score`, :term:`selection`
''' '''


# Convert score string to list # Convert score string to list
s_list = score.splitlines() s_list = score.splitlines()


# Dictionary to store all events. {index_of_event: event} # Dictionary to store all events. {index_of_event: event}
Expand Down
2 changes: 1 addition & 1 deletion build/lib/csd/sco/element/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with csd. If not, see <http://www.gnu.org/licenses/>. # along with csd. If not, see <http://www.gnu.org/licenses/>.


'''Csound score elements.''' '''Module for handling Csound score elements.'''


import re import re


Expand Down
47 changes: 13 additions & 34 deletions build/lib/csd/sco/event/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -119,27 +119,8 @@ def insert(event, pfield_index, fill='.'):


def match(event, pattern): def match(event, pattern):
'''Returns a boolean determined whether an event matches the '''Returns a boolean determined whether an event matches the
requirements of a pattern. requirements of a :term:`pattern`.
A pattern is built from a Python dict, and must follow strict
guidelines. The key must be an integer, as the key is the index
of the pfield in which this function will test. The value of the
dict can be either a single value or several values in list form.
A pattern that returns True for i-events::
{0: 'i'}
A pattern that returns True for i-events and f-tables::
{0: ['i', 'f']}
A single pattern may check against multiple pfields. The following
example returns True for an i-event with an identifier of 1, 2, or
3::
{0: 'i', 1: [1, 2, 3]}
Example:: Example::
>>> event.match('i 1 0 4 1.0 440', {0: 'i'}) >>> event.match('i 1 0 4 1.0 440', {0: 'i'})
Expand All @@ -148,9 +129,6 @@ def match(event, pattern):
True True
>>> event.match('i 1 0 4 1.0 440', {0: 'i', 1: 2}) >>> event.match('i 1 0 4 1.0 440', {0: 'i', 1: 2})
False False
.. note:: Limited support for the moment. Functions for designing
patterns may come at a later time.
See :term:`event`, :term:`pattern`. See :term:`event`, :term:`pattern`.
Expand All @@ -177,13 +155,13 @@ def match(event, pattern):
return True return True


def number_of_pfields(event): def number_of_pfields(event):
'''Returns an integer of the amounts of pfield elements in an '''Returns an int of the number of pfields that exists in a given
event. event.
The statement (pfield 0) is also counted. Comments and whitespace The statement (pfield 0) is also counted. Comments and whitespace
are omitted from the tally. are omitted from the tally. The following examples counts 'i',
'1', '0', '4', '1.0' and '440', and does not include '; A440' as
Example:: part of the returned figure::
>>> event.number_of_pfields('i 1 0 4 1.0 440 ; A440') >>> event.number_of_pfields('i 1 0 4 1.0 440 ; A440')
6 6
Expand Down Expand Up @@ -240,7 +218,7 @@ def remove(event, pfield_index):
>>> event.remove('i 1 0 4 1.0 440 ; A440', 4) >>> event.remove('i 1 0 4 1.0 440 ; A440', 4)
('i 1 0 4 440 ; A440', '1.0') ('i 1 0 4 440 ; A440', '1.0')
See :term:`event`, :term:`pfield` See :term:`event`, :term:`pfield_index`
''' '''


Expand All @@ -254,11 +232,10 @@ def remove(event, pfield_index):
return event, pf return event, pf


def sanitize(event): def sanitize(event):
'''Returns a copy of the score event with extra whitespace and '''Returns a copy of the event with extra whitespace and
comments removed. comments removed.
This function will introduce a single space between a statement and A single whitespace separates each pfield in the return.
the following non-whitespace element.
Example:: Example::
Expand Down Expand Up @@ -295,7 +272,7 @@ def set(event, pfield_index, value):
>>> event.set('i 1 0 4 1.0 440 ; A440', 5, 1138) >>> event.set('i 1 0 4 1.0 440 ; A440', 5, 1138)
'i 1 0 4 1.0 1138 ; A440' 'i 1 0 4 1.0 1138 ; A440'
See :term:`event`, :term:`pfield` See :term:`event`, :term:`pfield_index`
''' '''


Expand Down Expand Up @@ -326,7 +303,7 @@ def set(event, pfield_index, value):
return ''.join(tokens) return ''.join(tokens)


def split(event): def split(event):
'''Returns a list that includes all event pfield and comments '''Returns a list that includes all event pfield and comment
elements. elements.
Example:: Example::
Expand Down Expand Up @@ -400,7 +377,7 @@ def swap(event, pfield_index_a, pfield_index_b):
.. note:: This currently will not swap pfield 0. Not sure if it .. note:: This currently will not swap pfield 0. Not sure if it
should, though throwing an error might be in order. should, though throwing an error might be in order.
See :term:`event` See :term:`event`, :term:`pfield_index`
''' '''


Expand All @@ -422,6 +399,8 @@ def tokenize(event):
.. note:: This function will attempt to tokenize invalid elements. .. note:: This function will attempt to tokenize invalid elements.
Be sure that the event you provide is syntactically correct. Be sure that the event you provide is syntactically correct.
Though this module should provide an is_valid() that does this
for you.
See :term:`event` See :term:`event`
Expand Down
Loading

0 comments on commit 01e1205

Please sign in to comment.