~ubuntu-branches/ubuntu/trusty/portmidi/trusty

« back to all changes in this revision

Viewing changes to pm_python/README26.txt

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2010-02-14 17:30:52 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100214173052-uraknpxk6m8ogzf8
Tags: 1:200-0ubuntu1
* New upstream release
* debian/patches/: Refresh/rediff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
PyPortMidi v0.03 03/15/05
 
2
Python wrappings for PortMidi
 
3
John Harrison
 
4
harrison@media.mit.edu
 
5
 
 
6
Modified by Roger B. Dannenberg, Nov 2009
 
7
 
 
8
PyPortMidi details for Python 2.6
 
9
---------------------------------
 
10
 
 
11
Installing PyPortMidi from its Pyrex source code:
 
12
-------------------------------------------------
 
13
 
 
14
0. Windows and Linux only: install Python if you need it.
 
15
   These instructions were tested using Python2.6. For
 
16
   Linux, I installed from sources (rather than using
 
17
   synaptic) in order to get Python.h, which was missing
 
18
   from the runtime that was already installed. Make sure
 
19
   you know which python you are running. After installing
 
20
   from sources, I had /usr/local/bin/python as well as
 
21
   /usr/bin/python. The local/bin/python was the new one.
 
22
 
 
23
1. Linux only: install ASLA if it is not installed:
 
24
   http://www.alsa-project.org/
 
25
 
 
26
2. Linux and Windows only: Install Pyrex if it is not installed
 
27
   http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/
 
28
   (If that URL does not work, try this one:
 
29
  http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-0.9.8.5.tar.gz)
 
30
   (Tested using Pyrex-0.9.8.5)
 
31
   I was not able to run Pyrex on OS X due to version problems,
 
32
   but Pyrex is only used to translate pypm.pyx to pypm.c, which
 
33
   is included in the PortMidi release, so you really do not need
 
34
   Pyrex.
 
35
   On Linux, I did this:
 
36
       extract to ~/Pyrex-0.9.8.5
 
37
       cd ~/Pyrex-0.9.8.5
 
38
       PYTHONPATH=`pwd` [Note: my initial PYTHONPATH was empty, 
 
39
                         otherwise I would do an append to the path]
 
40
     You can then run ~/Pyrex-0.9.8.5/bin/pyrexc pypm.pyx to make
 
41
     pypm.c, but the following instructions just use the pypm.c 
 
42
     that's in the repository.
 
43
 
 
44
3. Choose to rebuild the PortMidi C library...or not:
 
45
   compiled binaries of the PortMidi package are included for Win32,
 
46
   and OS X, so you might be able to skip this step. If you need
 
47
   to rebuild these:
 
48
        a. download and extract PortMidi from SourceForge
 
49
           http://sourceforge.net/projects/portmedia/files/
 
50
 
 
51
        b. Win32: - compile PortMidi with MS VC 2008 Express (free download)
 
52
                  - build the project, creating
 
53
                    portmidi/Release/portmidi.{lib,dll}
 
54
 
 
55
        c. OS X:  - change to portmedia/portmidi directory
 
56
                  - compile. Type: xcodebuild -project portmidi.xcodeproj -target libportmidi.dylib -configuration Release
 
57
 
 
58
        d. Linux: - follow directions in portmidi/pm_linux/README_LINUX.txt
 
59
                  - copy libportmidi.a
 
60
                         from portmidi's pm_linux directory
 
61
                         to PyPortMidi's linux directory
 
62
 
 
63
4. WINDOWS: in a command prompt window, cd to portmidi/pm_python, and type:
 
64
   python setup.py install
 
65
   (make sure you have admin/superuser privileges)
 
66
 
 
67
   MAC OS X: you will need xcode. Even though this README says it is for
 
68
       version 2.6, OS X 1.5 has Python 2.5 installed, so I worked with it
 
69
       and have not tried installing 2.6 or testing it with PyPortMidi.
 
70
   open pm_python/macpypm/macpypm.xcodeproj
 
71
   build the pypm.so target. It should build on OS X 10.5 using 
 
72
       Python 2.5, but you may need to adjust some directories
 
73
   copy (by hand) pm_python/macpypm/build/Release/pypm.so to the
 
74
       appropriate python directory, e.g.
 
75
       /Volumes/Macintosh HD/Library/Python/2.5/site-packaages/pypm.so
 
76
   rename pm_python/pypm.py to pm_python/pypm.py-hidden (so that python
 
77
       will not try to load it instead of pypm.so -- pypm.py is for
 
78
       Python 3000 and not for Python 2.x)
 
79
   open a terminal and cd portmidi/pm_python
 
80
   test the installation with: python test.py
 
81
 
 
82
   LINUX: I used the commands in build26.sh to create and install the
 
83
   PyPortMidi extension. This should really be a nice makefile (at least)
 
84
   but I don't know how to generalize this for different versions of 
 
85
   Python and Linux, so for now, you should inspect the paths and verify
 
86
   that they are correct before blindly running this as a script.
 
87
 
 
88
 
 
89
Distribution of PyPortMidi compiled code:
 
90
--------------------------------------------
 
91
 
 
92
John Harrison created a Win32 installer for Python 2.3.x. 
 
93
There is no installer for Python 2.6 and beyond. (Follow directions above.)
 
94
 
 
95
Using PyPortMidi
 
96
----------------
 
97
Running the test.py sample script and looking at the test.py code is the
 
98
easiest way to start. The classes and functions are mostly documented, or
 
99
seem self-explanatory. miniTest.py is another test program.
 
100
 
 
101
You can also look at the portmidi.h header, which heavily documents all
 
102
of PortMidi's functions.
 
103
 
 
104
Overview of Files and Architecture
 
105
----------------------------------
 
106
 
 
107
Pyrex is used to build an interface from Python 2.6 to the PortMidi
 
108
dynamic library. The interface has been changed in several ways, 
 
109
mainly providing some default behavior such as using the built-in
 
110
PortTime as a time reference.
 
111
 
 
112
Pyrex compiles pypm.pyx to pypm.c
 
113
pypm.c is compiled to a dynamic library pypm.pyd and installed so
 
114
    that Python can load it.
 
115
There is no wrapper or intermediate layer of Python code. Everything
 
116
is defined in pypm.pyx and implemented via C.
 
117
 
 
118
Bugs, suggestions etc.
 
119
----------------------
 
120
Pm_Channel(channel) in PortMidi numbers channels from 0 to 15. 
 
121
Pm_Channel(channel) in PyPortMidi for Python 2.6 numbers channels 
 
122
from 1 to 16. This was intended as a "bug fix", but now PyPortMidi 
 
123
and PortMidi behave differently. Perhaps PyPortMidi will be changed 
 
124
if it will not disrupt too many users and applications.
 
125
 
 
126
I welcome any bugs you have to report or any suggestions you have about
 
127
how to improve the code and the interface.
 
128
 
 
129
-John
 
130
 
 
131
CHANGELOG
 
132
 
 
133
18-nov-2009 Roger B. Dannenberg
 
134
   Update after porting to Python 3.1 and testing on Vista.
 
135
 
 
136
 
 
137