22 Commits

Author SHA1 Message Date
Lars Immisch d3aa602a04 Setup PCM device in constructor. 2020-04-02 23:24:48 +02:00
Lars Immisch 046e7c4e87 Get rid of warnings, adjust CHANGES 2020-04-01 22:47:11 +02:00
Lars Immisch a4c4c7cb62 Consistent indentation and some code style changes (whould be ws only) 2020-03-09 22:28:08 +01:00
Lars Immisch f478797f6f Merge branch 'dev/card-detail' of https://github.com/jdstmporter/pyalsaaudio into jdstmporter-dev/card-detail 2020-03-09 22:07:23 +01:00
Lars Immisch 12f807698a Merge #80 2020-03-09 22:05:50 +01:00
Julian Porter fc011b5ea6 restored gitignore! 2020-03-06 20:21:47 +00:00
Julian Porter f244a70111 tidied up 2020-03-06 20:06:59 +00:00
Julian Porter a056a90c61 modified version of pyalsaaudio module 2020-03-06 19:59:04 +00:00
Julian Porter be1b3e131d demo 2020-03-05 00:50:30 +00:00
Danny 8abf06bedf Prevent hang on close after capturing audio
Currently, after recording audio using pyalsaaudio, the client is unable to close the device.

The reason is that PulseAudio client tries to drain the pipe to the PulseAudio server (presumably in order to prevent Broken Pipe error) on closing. That will never finish since new data will always arrive in the pipe.

Worse, the __del__ handler was auto-closing and thus auto-hanging.

Therefore, pause before de-allocating.
2019-12-02 21:39:44 +00:00
Lars Immisch dcc831e607 Merge pull request #44 from Oranos25/contribution
add support for snd_pcm_drop function
2019-11-14 13:24:36 +01:00
Lars Immisch e587df9143 Merge pull request #55 from moham96/patch-1
update playwav.py for python 3
2019-11-14 13:20:12 +01:00
Lars Immisch 82febd3f7e Merge pull request #67 from pdericson/master
Update pyalsaaudio.rst
2018-11-16 12:50:52 +01:00
Peter Ericson 1695066c11 Update pyalsaaudio.rst 2018-11-16 16:51:05 +08:00
Lars Immisch 25717020ef Transactional semantics for the alsapcm_set* calls 2018-02-28 09:52:53 +00:00
Lars Immisch 1aae655d24 Update periodsize only after alsapcm_setup succeeded 2018-02-28 00:35:26 +01:00
MOHAMMAD RASIM c1c8362eb2 update playwav.py for python 3
use int division for periodsize to be compatible with python 3
2018-02-24 19:40:45 +03:00
Lars Immisch 723eff3887 Prepare next release 2018-02-20 12:18:44 +01:00
Lars Immisch aa9867de18 Document changes, i.e. #53. 2018-02-20 12:10:20 +01:00
Lars Immisch 58f4522769 Merge pull request #53 from jcea/jcea/read_period_size
Unlimited setperiod buffer size when reading frames
2018-02-20 12:05:37 +01:00
Jesus Cea f2fb61d324 Unlimited setperiod buffer size when reading frames 2018-02-20 11:52:47 +01:00
Anthony Piau 9e79494a95 add support for snd_pcm_drop function 2017-12-28 16:30:32 +00:00
7 changed files with 452 additions and 400 deletions
+29
View File
@@ -1,3 +1,32 @@
Version 0.8.6:
- Added four methods to the 'PCM' class to allow users to get detailed information about the device:
- 'getformats()' returns a dictionary of name / value pairs, one for each of the card's
supported formats - e.g. '{"U8": 1, "S16_LE": 2}',
- 'getchannels()' returns a list of the supported channel numbers, e.g. '[1, 2]',
- 'getrates()' returns supported sample rates for the device, e.g. '[48000]',
- 'getratebounds()' returns the device's official minimum and maximum supported
sample rates as a tuple, e.g. '(4000, 48000)'.
(#82 contributed by @jdstmporter)
- Prevent hang on close after capturing audio (#80 contributed by @daym)
Version 0.8.5:
- Return an empty string/bytestring when 'read()' detects an
overrun. Previously the returned data was undefined (contributed by @jcea)
- Unlimited setperiod buffer size when reading frames (contributed by @jcea)
Version 0.8.4:
- Fix Python3 API usage broken in 0.8.3
Version 0.8.3:
- Add DSD sample formats (contributed by @lintweaker)
- Add Mixer.handleevents() to acknowledge events identified by select.poll (contributed by @PaulSD)
- Add functions for listing cards and their names (contributed by @chrisdiamand)
- Add a method for setting enums (contributed by @chrisdiamand)
Version 0.8.2:
- fix #3 (we cannot get the revision from git for pip installs)
+404 -373
View File
File diff suppressed because it is too large Load Diff
+9 -13
View File
@@ -443,35 +443,31 @@ Mixer objects have the following methods:
This method will fail if the mixer has no capture switch capabilities.
.. method:: Mixer.getvolume(direction=PCM_PLAYBACK, unit=Percent)
.. method:: Mixer.getvolume([direction])
Returns a list with the current volume settings for each channel. The list
elements are percentages or dB values, depending on *unit*.
elements are integer percentages.
The *direction* argument can be either :const:`PCM_PLAYBACK` or
The optional *direction* argument can be either :const:`PCM_PLAYBACK` or
:const:`PCM_CAPTURE`, which is relevant if the mixer can control both
playback and capture volume. The default value is :const:`PCM_PLAYBACK`
if the mixer has playback channels, otherwise it is :const:`PCM_CAPTURE`.
.. method:: Mixer.setvolume(volume, channel=MIXER_CHANNEL_ALL, direction=PCM_PLAYBACK, unit=Percent)
.. method:: Mixer.setvolume(volume, [channel], [direction])
Change the current volume settings for this mixer. The *volume* argument
controls the new volume setting as either a percentage or a dB value. Both
integer and floating point values can be given.
controls the new volume setting as an integer percentage.
The *channel* argument can be used to restrict the channels for which the volume is
set. By default, the volume of all channels is adjusted. This assumes that the mixer
can control the volume for the channels independently.
If the optional argument *channel* is present, the volume is set
only for this channel. This assumes that the mixer can control the
volume for the channels independently.
The *direction* argument can be either :const:`PCM_PLAYBACK` or
The optional *direction* argument can be either :const:`PCM_PLAYBACK` or
:const:`PCM_CAPTURE`, which is relevant if the mixer can control both
playback and capture volume. The default value is :const:`PCM_PLAYBACK`
if the mixer has playback channels, otherwise it is :const:`PCM_CAPTURE`.
The *unit* argument determines how the volume value is interpreted, as a prcentage
or as a dB value.
.. method:: Mixer.setmute(mute, [channel])
Sets the mute flag to a new value. The *mute* argument is either 0 for not
+1 -1
View File
@@ -75,7 +75,7 @@ development at the time - and neither are very feature complete.
I wrote PyAlsaAudio to fill this gap. My long term goal is to have the module
included in the standard Python library, but that looks currently unlikely.
PyAlsaAudio hass full support for sound capture, playback of sound, as well as
PyAlsaAudio has full support for sound capture, playback of sound, as well as
the ALSA Mixer API.
MIDI support is not available, and since I don't own any MIDI hardware, it's
+7 -11
View File
@@ -46,17 +46,13 @@ def show_mixer(name, kwargs):
print("Capabilities: %s %s" % (' '.join(mixer.volumecap()),
' '.join(mixer.switchcap())))
volumes = mixer.getvolume()
for i, v in enumerate(volumes):
print("Channel %i volume: %.02f%%" % (i, v))
volumes = mixer.getvolume(unit=alsaaudio.dB)
for i, v in enumerate(volumes):
print("Channel %i volume: %.02fdB" % (i, v))
for i in range(len(volumes)):
print("Channel %i volume: %i%%" % (i,volumes[i]))
try:
mutes = mixer.getmute()
for i, m in enumerate(mutes):
if m:
for i in range(len(mutes)):
if mutes[i]:
print("Channel %i is muted" % i)
except alsaaudio.ALSAAudioError:
# May not support muting
@@ -64,8 +60,8 @@ def show_mixer(name, kwargs):
try:
recs = mixer.getrec()
for i, r in enumerate(recs):
if r:
for i in range(len(recs)):
if recs[i]:
print("Channel %i is recording" % i)
except alsaaudio.ALSAAudioError:
# May not support recording
+1 -1
View File
@@ -30,7 +30,7 @@ def play(device, f):
else:
raise ValueError('Unsupported format')
periodsize = f.getframerate() / 8
periodsize = f.getframerate() // 8
device.setperiodsize(periodsize)
+1 -1
View File
@@ -8,7 +8,7 @@ from setuptools import setup
from setuptools.extension import Extension
from sys import version
pyalsa_version = '0.8.4'
pyalsa_version = '0.8.6'
if __name__ == '__main__':
setup(