Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with latest version 0.2.11 #8

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
53ab5eb
Fix overflow error handling logic for pa_read_stream.
hubertpham Sep 22, 2015
1783aaf
Fix IOError arguments.
hubertpham Sep 22, 2015
ebea06b
On C module import error, raise the exception rather than sys.exit.
hubertpham Oct 17, 2015
d786cc5
Update examples for Python 3 compatibility.
hubertpham Oct 17, 2015
3e6adb4
Update source code style for consistency.
hubertpham Oct 17, 2015
0e5eb7c
Use setuptools when possible.
hubertpham Oct 18, 2015
5a4da7d
Update INSTALL instructions.
hubertpham Oct 18, 2015
ab5e5b7
Update setup.py and cleanup.
hubertpham Oct 18, 2015
dce064b
Version bump.
hubertpham Oct 18, 2015
da8c238
Add unit tests.
hubertpham Sep 22, 2015
bff409d
Rename test -> examples.
hubertpham Sep 22, 2015
870016f
Skip overflow tests on GNU/Linux ALSA.
hubertpham Sep 22, 2015
e59fa4a
Add loopback-based tests.
hubertpham Jan 8, 2017
7a61080
Add duration for wire callback example.
hubertpham Jan 8, 2017
50e08d4
Merge branch 'unittests'
hubertpham Jan 8, 2017
884ceda
Release GIL when calling Pa_{Open,Start}Stream.
hubertpham Jan 9, 2017
c9bc019
Add tests to detect potential sources of deadlock.
hubertpham Jan 10, 2017
439327b
Minor fix on int type to fix compiler warnings.
hubertpham Jan 10, 2017
47a8068
Release the GIL before PortAudio stream calls.
hubertpham Jan 10, 2017
a0f6d13
Tests: remove dependence on scipy.
hubertpham Jan 10, 2017
8285b9b
Merge branch 'gil-fix'
hubertpham Jan 11, 2017
fe528b2
Update references to examples and tests.
hubertpham Jan 11, 2017
833ebc0
Version bump.
hubertpham Jan 12, 2017
2e696d9
Fix use-after-free error.
hubertpham Feb 27, 2017
39de78a
Merge branch 'use-after-free-fix'
hubertpham Feb 27, 2017
281a8f3
Fix get_output_latency docstring.
hubertpham Mar 1, 2017
653fdfe
Remove generated files from source distribution.
hubertpham Mar 18, 2017
045ebc7
Merge branch 'docs-fix'
hubertpham Mar 18, 2017
7090e25
Version bump.
hubertpham Mar 18, 2017
b37c601
Fixed min() macro not compilling with MSVC compiler
evandrocoan Feb 23, 2020
e6ea652
Fixed installation for Visual Studio 2017 on setup.py
evandrocoan Feb 23, 2020
3a0c152
Merge remote-tracking branch 'origin/master'
evandrocoan Feb 23, 2020
0b9d343
Fixed usage of the 32 postfix on sys.platform because at Python 3.8
evandrocoan Feb 23, 2020
d8f3c93
Fixed missing declaration of extra_link_args on setup.py
evandrocoan Feb 24, 2020
0269349
Created a PyAudioAndPortaudio.sublime-project
evandrocoan Feb 24, 2020
340f30f
Added build Visual Studio instructions to README
evandrocoan Feb 25, 2020
8609fc6
Fixed setup.py using MSVC flags when not using a MSVC compiler
evandrocoan Feb 25, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build/
dist/
docs/
MANIFEST
*.sublime-workspace
48 changes: 47 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
2017-03-18 Hubert Pham <[email protected]>

PyAudio 0.2.11

- Fix use-after-free memory issue in callback handler.

Thanks to both Blaise Potard and Matthias Schaff for their patches!

- Fix docstring for get_output_latency().

Thanks to Timothy Port for finding the issue!

2017-01-10 Hubert Pham <[email protected]>

PyAudio 0.2.10

- Release the GIL during PortAudio I/O calls to avoid potential deadlock.

Thanks to Michael Graczyk for submitting a patch!

- Add a few automated unit tests.

2015-10-18 Hubert Pham <[email protected]>

PyAudio 0.2.9

- Fix overflow error handling logic for pa_read_stream.

Stream.read takes an additional parameter that specifies whether
an exception is raised on audio buffer overflow, for parity with
Stream.write. Includes relevant bug fixes in the C module logic.

Thanks to Tony Jacobson for submitting a patch!

- Fix IOError arguments.

IOError exceptions previously had values in the strerror and errno fields
swapped, which is now corrected.

Thanks to Sami Liedes for the report!

- Miscellaneous updates.

Python library surfaces issues with importing low-level C module.
Code formatting update.
Updates to examples for Python 3 compatibility.

2014-02-16 Hubert Pham <[email protected]>

PyAudio 0.2.8
Expand Down Expand Up @@ -96,4 +143,3 @@
2008-02-12 Justin Mazzola Paluska <[email protected]>

- Initial version of debian packaging.

86 changes: 44 additions & 42 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -8,81 +8,83 @@ platforms:
* General UNIX Guide: (GNU/Linux, Mac OS X, Cygwin)
* Microsoft Windows (native)

Generally speaking, you must first install the PortAudio v19 library
before building PyAudio.

Generally speaking, installation involves building the PortAudio v19
library and then building PyAudio.

----------------------------------------------------------------------
General UNIX Guide (GNU/Linux, Mac OS X, Cygwin)
----------------------------------------------------------------------

1. Build and install PortAudio, i.e.:
1. Use a package manager to install PortAudio v19.

To build PortAudio from source instead, extract the source and run:

% ./configure
% make
% make install # you may need to be root

(Or better yet, use your package manager to install PortAudio v19)

2. Extract PyAudio; to build and install, run:
2. Extract PyAudio. To build and install, run:

% python setup.py install


----------------------------------------------------------------------
Microsoft Windows
----------------------------------------------------------------------

If you are targeting native Win32 Python, you will need either
Microsoft Visual Studio or MinGW (via Cygwin). Here are compilation
hints for using MinGW under the Cygwin build environment.
Targeting native Win32 Python will require either Microsoft Visual
Studio or MinGW (via Cygwin). Here are compilation hints for using
MinGW under the Cygwin build environment.

Note: I've only tested this under Cygwin's build environment. Your
mileage may vary in other environments (i.e., compiling PortAudio with
MinGW's compiler and environment).
MinGW's compiler).

(If you have instructions for building PyAudio using Visual Studio,
I'd love to hear about it.)
1. Install cygwin's gcc and mingw packages.

1. Download PortAudio to ./portaudio-v19 in this directory
and build. When running configure, be sure to use ``-mno-cygwin``
(under cygwin) to generate native Win32 binaries:
2. Download PortAudio and build. When running configure, be sure to
specify the MinGW compiler (via a CC environment variable) to
generate native Win32 binaries:

% cd ./portaudio-v19
% CFLAGS="-mno-cygwin" LDFLAGS="-mno-cygwin" ./configure
% make
% cd ..
% CC=i686-w64-mingw32-gcc ./configure --enable-static --with-pic
% make

2. To build PyAudio, run (from this directory):
3. Before building PyAudio, apply a few necessary modifications:

% python setup.py build --static-link -cmingw32
a. Python distutils calls ``gcc'' to build the C extension, so
temporarily move your MinGW compiler to /usr/bin/gcc.

Be sure to invoke the native Win32 python rather than cygwin's
python. The --static-link option statically links in the PortAudio
library to the PyAudio module, which is probably the best way to go
on Windows.
b. Modify Python's Lib/distutils/cygwincompiler.py so that
mscvr900.dll is not included in the build. See:
http://bugs.python.org/issue16472.

From: http://boodebr.org/main/python/build-windows-extensions
Both Python 2.7 and Python 3+ require similar modification.

Update: 2008-09-10
c. For some versions of Python (e.g., Python 2.7 32-bit), it is
necessary to further modify Python's
Lib/distutils/cygwincompiler.py and remove references to
-cmingw32, a flag which is no longer supported.
See http://hg.python.org/cpython/rev/6b89176f1be5/.

Recent versions of Cygwin binutils have version numbers that are
breaking the version number parsing, resulting in errors like:
ValueError: invalid version number '2.18.50.20080625'
d. For some versions of 64-bit Python 3 (e.g., Python 3.2, 3.3, 3.4),
it is necessary to generate .a archive of the Python DLL.
See https://bugs.python.org/issue20785. Example for Python 3.4:

To fix this, edit distutils/version.py. At line 100, replace:
% cd /path/to/Python34-x64/libs/
% gendef /path/to/Windows/System32/python34.dll
% dlltool --as-flags=--64 -m i386:x64-64 -k --output-lib libpython34.a \
--input-def python34.def

version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
re.VERBOSE)
4. To build PyAudio, run:

with
% PORTAUDIO_PATH=/path/to/portaudio_tree /path/to/win/python \
setup.py build --static-link -cmingw32

version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? (\. (\d+))?$',
re.VERBOSE)
Be sure to invoke the native Win32 python rather than cygwin's
python. The --static-link option statically links in the PortAudio
library to the PyAudio module.

3. To install PyAudio:
5. To install PyAudio:

% python setup.py install --skip-build
% python setup.py install --skip-build

The --skip-build option prevents Python from searching your system
for Visual Studio and the .NET framework.
Or create a Python wheel and install using pip.
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include src/*.c src/*.h src/*.py
include Makefile CHANGELOG INSTALL MANIFEST.in
recursive-include test *.py *.c
graft docs
recursive-include examples *.py
recursive-include tests *.py
graft sphinx
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.PHONY: docs clean build

VERSION := 0.2.8
VERSION := 0.2.11
PYTHON ?= python
BUILD_ARGS ?=
SPHINX ?= sphinx-build
Expand All @@ -11,7 +11,8 @@ PYTHON_BUILD_DIR:=$(shell $(PYTHON) -c "import distutils.util; import sys; print
BUILD_DIR:=lib.$(PYTHON_BUILD_DIR)
BUILD_STAMP:=$(BUILD_DIR)/build
SRCFILES := src/*.c src/*.h src/*.py
EXAMPLES := test/*.py
EXAMPLES := examples/*.py
TESTS := tests/*.py

what:
@echo "make targets:"
Expand Down Expand Up @@ -43,5 +44,5 @@ docs: build
######################################################################
# Source Tarball
######################################################################
tarball: docs $(SRCFILES) $(EXAMPLES) MANIFEST.in
tarball: $(SRCFILES) $(EXAMPLES) $(TESTS) MANIFEST.in
@$(PYTHON) setup.py sdist
11 changes: 11 additions & 0 deletions PyAudioAndPortaudio.sublime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders":
[
{
"path": "../portaudio"
},
{
"path": "."
}
]
}
18 changes: 14 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
======================================================================
PyAudio v0.2.8: Python Bindings for PortAudio.
PyAudio v0.2.11: Python Bindings for PortAudio.
======================================================================

See: http://people.csail.mit.edu/hubert/pyaudio/
Expand All @@ -8,13 +8,24 @@ PyAudio provides Python bindings for PortAudio v19, the cross-platform
audio I/O library. Using PyAudio, you can easily use Python to play
and record audio on a variety of platforms.

See INSTALL for compilation hints.
## Installation (Visual Studio)

1. Download and install Visual Studio 2017 or superior and:
1. `git clone https://github.com/evandroforks/portaudio`
1. Open the file `portaudio\build\msvc\portaudio.sln` with Visual Studio
1. Select the Solution Configuration as `Release` and the Solution Platforms as `x64` on the top toolbar
1. Go to the menu `Build -> Build Solution`
1. Copy the file `portaudio\build\msvc\x64\Release\portaudio.lib` to `C:\Python\libs\` (Or whatever your Windows Python is installed)
1. Run the command: `python -m pip install git+https://github.com/evandroforks/pyaudio`
1. Or just clone this repository and run `cd pyaudio && python -m pip install .`

See INSTALL for other compilation hints.

======================================================================

PyAudio : Python Bindings for PortAudio.

Copyright (c) 2006-2014 Hubert Pham
Copyright (c) 2006 Hubert Pham

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand All @@ -36,4 +47,3 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

======================================================================

File renamed without changes.
2 changes: 1 addition & 1 deletion test/play_wave.py → examples/play_wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
data = wf.readframes(CHUNK)

# play stream (3)
while data != '':
while len(data) > 0:
stream.write(data)
data = wf.readframes(CHUNK)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
data = wf.readframes(chunk)

# play stream
while data != '':
while len(data) > 0:
stream.write(data)
data = wf.readframes(chunk)

Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion test/wire_callback.py → examples/wire_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
WIDTH = 2
CHANNELS = 2
RATE = 44100
DURATION = 5

if sys.platform == 'darwin':
CHANNELS = 1
Expand All @@ -30,7 +31,9 @@ def callback(in_data, frame_count, time_info, status):

stream.start_stream()

while stream.is_active():
start = time.time()

while stream.is_active() and (time.time() - start) < DURATION:
time.sleep(0.1)

stream.stop_stream()
Expand Down
File renamed without changes.
File renamed without changes.
Loading