Documentation for 0.11.0

This commit is contained in:
Lars Immisch
2024-05-30 23:19:19 +02:00
parent 6b17f924e4
commit 7a629527e0
14 changed files with 532 additions and 479 deletions

View File

@@ -419,9 +419,7 @@ table.footnote td {
}
dl {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin: 0;
padding: 0;
}

View File

@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -237,6 +237,10 @@ a.headerlink {
visibility: hidden;
}
a:visited {
color: #551A8B;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
@@ -670,6 +674,16 @@ dd {
margin-left: 30px;
}
.sig dd {
margin-top: 0px;
margin-bottom: 0px;
}
.sig dl {
margin-top: 0px;
margin-bottom: 0px;
}
dl > dd:last-child,
dl > dd:last-child > :last-child {
margin-bottom: 0;
@@ -738,6 +752,14 @@ abbr, acronym {
cursor: help;
}
.translated {
background-color: rgba(207, 255, 207, 0.2)
}
.untranslated {
background-color: rgba(255, 207, 207, 0.2)
}
/* -- code displays --------------------------------------------------------- */
pre {

View File

@@ -4,7 +4,7 @@
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/

View File

@@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */

View File

@@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@@ -57,12 +57,12 @@ const _removeChildren = (element) => {
const _escapeRegExp = (string) =>
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
const _displayItem = (item, searchTerms) => {
const _displayItem = (item, searchTerms, highlightTerms) => {
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
const contentRoot = document.documentElement.dataset.content_root;
const [docName, title, anchor, descr, score, _filename] = item;
@@ -75,28 +75,35 @@ const _displayItem = (item, searchTerms) => {
if (dirname.match(/\/index\/$/))
dirname = dirname.substring(0, dirname.length - 6);
else if (dirname === "index/") dirname = "";
requestUrl = docUrlRoot + dirname;
requestUrl = contentRoot + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
requestUrl = docUrlRoot + docName + docFileSuffix;
requestUrl = contentRoot + docName + docFileSuffix;
linkUrl = docName + docLinkSuffix;
}
let linkEl = listItem.appendChild(document.createElement("a"));
linkEl.href = linkUrl + anchor;
linkEl.dataset.score = score;
linkEl.innerHTML = title;
if (descr)
if (descr) {
listItem.appendChild(document.createElement("span")).innerHTML =
" (" + descr + ")";
// highlight search terms in the description
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
}
else if (showSearchSummary)
fetch(requestUrl)
.then((responseData) => responseData.text())
.then((data) => {
if (data)
listItem.appendChild(
Search.makeSearchSummary(data, searchTerms)
Search.makeSearchSummary(data, searchTerms, anchor)
);
// highlight search terms in the summary
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
});
Search.output.appendChild(listItem);
};
@@ -109,26 +116,43 @@ const _finishSearch = (resultCount) => {
);
else
Search.status.innerText = _(
`Search finished, found ${resultCount} page(s) matching the search query.`
);
"Search finished, found ${resultCount} page(s) matching the search query."
).replace('${resultCount}', resultCount);
};
const _displayNextItem = (
results,
resultCount,
searchTerms
searchTerms,
highlightTerms,
) => {
// results left, load the summary and display it
// this is intended to be dynamic (don't sub resultsCount)
if (results.length) {
_displayItem(results.pop(), searchTerms);
_displayItem(results.pop(), searchTerms, highlightTerms);
setTimeout(
() => _displayNextItem(results, resultCount, searchTerms),
() => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
5
);
}
// search finished, update title and status message
else _finishSearch(resultCount);
};
// Helper function used by query() to order search results.
// Each input is an array of [docname, title, anchor, descr, score, filename].
// Order the results by score (in opposite order of appearance, since the
// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
const _orderResultsByScoreThenName = (a, b) => {
const leftScore = a[4];
const rightScore = b[4];
if (leftScore === rightScore) {
// same score: sort alphabetically
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
};
/**
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
@@ -152,13 +176,26 @@ const Search = {
_queued_query: null,
_pulse_status: -1,
htmlToText: (htmlString) => {
htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
for (const removalQuery of [".headerlinks", "script", "style"]) {
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
}
if (anchor) {
const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
if (anchorContent) return anchorContent.textContent;
console.warn(
`Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
);
}
// if anchor not specified or not found, fall back to main content
const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent;
if (docContent) return docContent.textContent;
console.warn(
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
"Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
);
return "";
},
@@ -231,16 +268,7 @@ const Search = {
else Search.deferQuery(query);
},
/**
* execute search (requires search index to be loaded)
*/
query: (query) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const allTitles = Search._index.alltitles;
const indexEntries = Search._index.indexentries;
_parseQuery: (query) => {
// stem the search terms and add them to the correct list
const stemmer = new Stemmer();
const searchTerms = new Set();
@@ -276,16 +304,32 @@ const Search = {
// console.info("required: ", [...searchTerms]);
// console.info("excluded: ", [...excludedTerms]);
// array of [docname, title, anchor, descr, score, filename]
let results = [];
return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
},
/**
* execute search (requires search index to be loaded)
*/
_performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const allTitles = Search._index.alltitles;
const indexEntries = Search._index.indexentries;
// Collect multiple result groups to be sorted separately and then ordered.
// Each is an array of [docname, title, anchor, descr, score, filename].
const normalResults = [];
const nonMainIndexResults = [];
_removeChildren(document.getElementById("search-progress"));
const queryLower = query.toLowerCase();
const queryLower = query.toLowerCase().trim();
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
results.push([
normalResults.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
@@ -300,46 +344,47 @@ const Search = {
// search for explicit entries in index directives
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
for (const [file, id] of foundEntries) {
let score = Math.round(100 * queryLower.length / entry.length)
results.push([
for (const [file, id, isMain] of foundEntries) {
const score = Math.round(100 * queryLower.length / entry.length);
const result = [
docNames[file],
titles[file],
id ? "#" + id : "",
null,
score,
filenames[file],
]);
];
if (isMain) {
normalResults.push(result);
} else {
nonMainIndexResults.push(result);
}
}
}
}
// lookup as object
objectTerms.forEach((term) =>
results.push(...Search.performObjectSearch(term, objectTerms))
normalResults.push(...Search.performObjectSearch(term, objectTerms))
);
// lookup as search terms in fulltext
results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
// let the scorer override scores with a custom scoring function
if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
if (Scorer.score) {
normalResults.forEach((item) => (item[4] = Scorer.score(item)));
nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
}
// now sort the results by score (in opposite order of appearance, since the
// display function below uses pop() to retrieve items) and then
// alphabetically
results.sort((a, b) => {
const leftScore = a[4];
const rightScore = b[4];
if (leftScore === rightScore) {
// same score: sort alphabetically
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
});
// Sort each group of results by score and then alphabetically by name.
normalResults.sort(_orderResultsByScoreThenName);
nonMainIndexResults.sort(_orderResultsByScoreThenName);
// Combine the result groups in (reverse) order.
// Non-main index entries are typically arbitrary cross-references,
// so display them after other results.
let results = [...nonMainIndexResults, ...normalResults];
// remove duplicate search results
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
@@ -353,14 +398,19 @@ const Search = {
return acc;
}, []);
results = results.reverse();
return results.reverse();
},
query: (query) => {
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
// for debugging
//Search.lastresults = results.slice(); // a copy
// console.info("search results:", Search.lastresults);
// print the results
_displayNextItem(results, results.length, searchTerms);
_displayNextItem(results, results.length, searchTerms, highlightTerms);
},
/**
@@ -458,14 +508,18 @@ const Search = {
// add support for partial matches
if (word.length > 2) {
const escapedWord = _escapeRegExp(word);
Object.keys(terms).forEach((term) => {
if (term.match(escapedWord) && !terms[word])
arr.push({ files: terms[term], score: Scorer.partialTerm });
});
Object.keys(titleTerms).forEach((term) => {
if (term.match(escapedWord) && !titleTerms[word])
arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
});
if (!terms.hasOwnProperty(word)) {
Object.keys(terms).forEach((term) => {
if (term.match(escapedWord))
arr.push({ files: terms[term], score: Scorer.partialTerm });
});
}
if (!titleTerms.hasOwnProperty(word)) {
Object.keys(titleTerms).forEach((term) => {
if (term.match(escapedWord))
arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
});
}
}
// no match but word was a required one
@@ -488,9 +542,8 @@ const Search = {
// create the mapping
files.forEach((file) => {
if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
fileMap.get(file).push(word);
else fileMap.set(file, [word]);
if (!fileMap.has(file)) fileMap.set(file, [word]);
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
});
});
@@ -541,8 +594,8 @@ const Search = {
* search summary for a given text. keywords is a list
* of stemmed words.
*/
makeSearchSummary: (htmlText, keywords) => {
const text = Search.htmlToText(htmlText);
makeSearchSummary: (htmlText, keywords, anchor) => {
const text = Search.htmlToText(htmlText, anchor);
if (text === "") return null;
const textLower = text.toLowerCase();

View File

@@ -1,16 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<title>Index &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="#" />
<link rel="search" title="Search" href="search.html" />
@@ -60,6 +59,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.asoundlib_version">asoundlib_version() (in module alsaaudio)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.avail">avail() (alsaaudio.PCM method)</a>
</li>
</ul></td>
</tr></table>
@@ -137,7 +138,7 @@
<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.PCM.info">info() (alsaaudio.PCM method)</a>, <a href="libalsaaudio.html#id0">[1]</a>
<li><a href="libalsaaudio.html#alsaaudio.PCM.info">info() (alsaaudio.PCM method)</a>
</li>
</ul></td>
</tr></table>
@@ -169,15 +170,13 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.PCM.pause">pause() (alsaaudio.PCM method)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM">PCM (class in alsaaudio)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.pcmmode">pcmmode() (alsaaudio.PCM method)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.pcms">pcms() (in module alsaaudio)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.pcms">pcms() (in module alsaaudio)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.pcmtype">pcmtype() (alsaaudio.PCM method)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.Mixer.polldescriptors">polldescriptors() (alsaaudio.Mixer method)</a>
@@ -186,6 +185,8 @@
<li><a href="libalsaaudio.html#alsaaudio.PCM.polldescriptors">(alsaaudio.PCM method)</a>
</li>
</ul></li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.polldescriptors_revents">polldescriptors_revents() (alsaaudio.PCM method)</a>
</li>
</ul></td>
</tr></table>
@@ -252,35 +253,14 @@
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
@@ -288,16 +268,8 @@
<input type="submit" value="Go" />
</form>
</div>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
@@ -306,8 +278,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

View File

@@ -1,17 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>alsaaudio documentation &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<title>alsaaudio documentation &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Introduction" href="pyalsaaudio.html" />
@@ -32,7 +32,7 @@
<div class="body" role="main">
<section id="alsaaudio-documentation">
<h1>alsaaudio documentation<a class="headerlink" href="#alsaaudio-documentation" title="Permalink to this heading"></a></h1>
<h1>alsaaudio documentation<a class="headerlink" href="#alsaaudio-documentation" title="Link to this heading"></a></h1>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
@@ -58,20 +58,20 @@
</div>
</section>
<section id="download">
<h1>Download<a class="headerlink" href="#download" title="Permalink to this heading"></a></h1>
<h1>Download<a class="headerlink" href="#download" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p><a class="reference external" href="https://pypi.python.org/pypi/pyalsaaudio">Download from pypi</a></p></li>
</ul>
</section>
<section id="github">
<h1>Github<a class="headerlink" href="#github" title="Permalink to this heading"></a></h1>
<h1>Github<a class="headerlink" href="#github" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/">Repository</a></p></li>
<li><p><a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/issues">Bug tracker</a></p></li>
</ul>
</section>
<section id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this heading"></a></h1>
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
@@ -86,27 +86,16 @@
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="#">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
<div>
<h3><a href="#">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">alsaaudio documentation</a></li>
<li><a class="reference internal" href="#download">Download</a></li>
<li><a class="reference internal" href="#github">Github</a></li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>
<div class="relations">
</div><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="#">Documentation overview</a><ul>
@@ -114,7 +103,14 @@
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
@@ -122,16 +118,8 @@
<input type="submit" value="Go" />
</form>
</div>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
@@ -140,8 +128,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/index.rst.txt"

View File

@@ -1,17 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>alsaaudio &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<title>alsaaudio &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
@@ -33,11 +32,11 @@
<div class="body" role="main">
<section id="module-alsaaudio">
<span id="alsaaudio"></span><h1><a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><a class="headerlink" href="#module-alsaaudio" title="Permalink to this heading"></a></h1>
<span id="alsaaudio"></span><h1><a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><a class="headerlink" href="#module-alsaaudio" title="Link to this heading"></a></h1>
<p>The <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a> module defines functions and classes for using ALSA.</p>
<dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.pcms">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">pcms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.pcms" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">pcms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.pcms" title="Link to this definition"></a></dt>
<dd><p>List available PCM devices by name.</p>
<p>Arguments are:</p>
<ul class="simple">
@@ -61,7 +60,7 @@ commandline:</p>
<dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.cards">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">cards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.cards" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">cards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.cards" title="Link to this definition"></a></dt>
<dd><p>List the available ALSA cards by name. This function is only moderately
useful. If you want to see a list of available PCM devices, use <a class="reference internal" href="#alsaaudio.pcms" title="alsaaudio.pcms"><code class="xref py py-func docutils literal notranslate"><span class="pre">pcms()</span></code></a>
instead.</p>
@@ -69,7 +68,7 @@ instead.</p>
<dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.mixers">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">mixers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.mixers" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">mixers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.mixers" title="Link to this definition"></a></dt>
<dd><p>List the available mixers. The arguments are:</p>
<ul>
<li><p><em>cardindex</em> - the card index. If this argument is given, the device name
@@ -107,20 +106,24 @@ device, not the mixers for the first card.</p></li>
<dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.asoundlib_version">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">asoundlib_version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.asoundlib_version" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">asoundlib_version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#alsaaudio.asoundlib_version" title="Link to this definition"></a></dt>
<dd><p>Return a Python string containing the ALSA version found.</p>
</dd></dl>
<section id="pcm-objects">
<span id="id1"></span><h2>PCM Objects<a class="headerlink" href="#pcm-objects" title="Permalink to this heading"></a></h2>
<span id="id1"></span><h2>PCM Objects<a class="headerlink" href="#pcm-objects" title="Link to this heading"></a></h2>
<p>PCM objects in <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a> can play or capture (record) PCM
sound through speakers or a microphone. The PCM constructor takes the
following arguments:</p>
<dl class="py class">
<dt class="sig sig-object py" id="alsaaudio.PCM">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">PCM</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_NORMAL</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">44100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channels</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_FORMAT_S16_LE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">periodsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">32</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">periods</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM" title="Permalink to this definition"></a></dt>
<dd><p>This class is used to represent a PCM device (either for playback and
recording). The arguments are:</p>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">PCM(type:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_PLAYBACK,</span> <span class="pre">mode:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_NORMAL,</span> <span class="pre">rate:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">44100,</span> <span class="pre">channels:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">2,</span></span></dt>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">format:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_FORMAT_S16_LE,</span> <span class="pre">periodsize:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">32,</span> <span class="pre">periods:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">4,</span></span></dt>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">device:</span> <span class="pre">str</span> <span class="pre">=</span> <span class="pre">'default',</span> <span class="pre">cardindex:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">-1)</span> <span class="pre">-&gt;</span> <span class="pre">PCM</span></span></dt>
<dd><p>This class is used to represent a PCM device (either for playback or
recording). The constructors arguments are:</p>
<ul class="simple">
<li><p><em>type</em> - can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code>
(default).</p></li>
@@ -237,7 +240,14 @@ the <cite>device</cite> keyword argument is ignored.
<p><strong>Note:</strong> This should not be used, as it bypasses most of ALSAs configuration.</p>
</li>
</ul>
<p>This will construct a PCM object with the given settings.</p>
<p>The defaults mentioned above are values passed by :mod:alsaaudio
to ALSA, not anything internal to ALSA.</p>
<p><strong>Note:</strong> For default and non-default values alike, there is no
guarantee that a PCM device supports the requested configuration,
and ALSA may pick realizable values which it believes to be closest
to the request. Therefore, after creating a PCM object, it is
necessary to verify whether its realized configuration is acceptable.
The :func:info method can be used to query it.</p>
<p><em>Changed in 0.10:</em></p>
<ul class="simple">
<li><p>Added the optional named parameter <cite>periods</cite>.</p></li>
@@ -259,8 +269,19 @@ name of the card. This was always fragile and broke some legitimate usecases.</p
<p>PCM objects have the following methods:</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.info">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.info" title="Permalink to this definition"></a></dt>
<dd><p>The info function returns a dictionary containing the configuration of a PCM device. As ALSA takes into account limitations of the hardware and software devices the configuration achieved might not correspond to the values used during creation. There is therefore a need to check the realised configuration before processing the sound coming from the device or before sending sound to a device. A small subset of parameters can be set, but cannot be queried. These parameters are stored by alsaaudio and returned as they were given by the user, to distinguish them from parameters retrieved from ALSA these parameters have a name prefixed with <strong>“ (call value) “</strong>. Yet another set of properties derives directly from the hardware and can be obtained through ALSA.</p>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span></span></span><a class="headerlink" href="#alsaaudio.PCM.info" title="Link to this definition"></a></dt>
<dd><p>Returns a dictionary containing the configuration of a PCM device.</p>
<p>A small subset of properties reflects fixed parameters given by the
user, stored within alsaaudio. To distinguish them from properties
retrieved from ALSA when the call is made, they have their name
prefixed with <strong>“ (call value) “</strong>.</p>
<p>Descriptions of properties which can be directly set during PCM object
instantiation carry the prefix “PCM():”, followed by the respective
constructor parameter. Note that due to device limitations, the values
may deviate from those originally requested.</p>
<p>Yet another set of properties cannot be set, and derives directly from
the hardware, possibly depending on other properties. Those properties
descriptions are prefixed with “hw:” below.</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Key</p></th>
@@ -362,7 +383,15 @@ name of the card. This was always fragile and broke some legitimate usecases.</p
<td><p>tuple (integer (Hz), integer (Hz))</p></td>
</tr>
<tr class="row-odd"><td><p>significant_bits</p></td>
<td><p><em>significant bits in sample</em></p></td>
<td><p><em>significant bits in sample</em> <a class="footnote-reference brackets" href="#tss" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p></td>
<td><p>integer (negative indicates error)</p></td>
</tr>
<tr class="row-even"><td><p>nominal_bits</p></td>
<td><p><em>nominal bits in sample</em> <a class="footnote-reference brackets" href="#tss" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p></td>
<td><p>integer (negative indicates error)</p></td>
</tr>
<tr class="row-odd"><td><p>physical_bits</p></td>
<td><p><em>sample width in bits</em> <a class="footnote-reference brackets" href="#tss" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p></td>
<td><p>integer (negative indicates error)</p></td>
</tr>
<tr class="row-even"><td><p>is_batch</p></td>
@@ -407,80 +436,82 @@ name of the card. This was always fragile and broke some legitimate usecases.</p
</tr>
</tbody>
</table>
<p>The italicized descriptions give a summary of the “full” description as it can be found in the <a class="reference external" href="https://www.alsa-project.org/alsa-doc">ALSA documentation</a>. “hw:”: indicates that the property indicated relates to the hardware. Parameters passed to the PCM object during instantation are prefixed with “PCM():”, they are described there for the keyword argument indicated after “PCM():”.</p>
</dd></dl>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="tss" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#id2">1</a>,<a role="doc-backlink" href="#id3">2</a>,<a role="doc-backlink" href="#id4">3</a>)</span>
<p>More information in the <a class="reference internal" href="terminology.html#term-sample-size"><span class="std std-ref">terminology section for sample size</span></a></p>
</aside>
</aside>
<blockquote>
<div><p>The italicized descriptions give a summary of the “full” description
as can be found in the
<a class="reference external" href="https://www.alsa-project.org/alsa-doc">ALSA documentation</a>.</p>
<p><em>New in 0.9.1</em></p>
</div></blockquote>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.dumpinfo">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">dumpinfo</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.dumpinfo" title="Link to this definition"></a></dt>
<dd><p>Dumps the PCM objects configured parameters to stdout.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.pcmtype">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmtype</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.pcmtype" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmtype</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.pcmtype" title="Link to this definition"></a></dt>
<dd><p>Returns the type of PCM object. Either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> or
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code>.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.pcmmode">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmmode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.pcmmode" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmmode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.pcmmode" title="Link to this definition"></a></dt>
<dd><p>Return the mode of the PCM object. One of <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_ASYNC</span></code>, or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.cardname">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.cardname" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">string</span></span></span><a class="headerlink" href="#alsaaudio.PCM.cardname" title="Link to this definition"></a></dt>
<dd><p>Return the name of the sound card used by this PCM object.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setchannels">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setchannels</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nchannels</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setchannels" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setchannels</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nchannels</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setchannels" title="Link to this definition"></a></dt>
<dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>channels</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p>
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>channels</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setrate">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rate</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setrate" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rate</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setrate" title="Link to this definition"></a></dt>
<dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>rate</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p>
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>rate</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setformat">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setformat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">format</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setformat" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setformat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setformat" title="Link to this definition"></a></dt>
<dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>format</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p>
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>format</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setperiodsize">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setperiodsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">period</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setperiodsize" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setperiodsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">period</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setperiodsize" title="Link to this definition"></a></dt>
<dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>periodsize</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p>
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>periodsize</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="id0">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#id0" title="Permalink to this definition"></a></dt>
<dd><p>Returns a dictionary with the PCM objects configured parameters.</p>
<p>Values are retrieved from the ALSA library if they are available;
otherwise they represent those stored by pyalsaaudio, and their keys
are prefixed with (call value) .</p>
<p><em>New in 0.9.1</em></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.dumpinfo">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">dumpinfo</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.dumpinfo" title="Permalink to this definition"></a></dt>
<dd><p>Dumps the PCM objects configured parameters to stdout.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.state">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">state</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.state" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">state</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.state" title="Link to this definition"></a></dt>
<dd><p>Returs the current state of the stream, which can be one of
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_STATE_OPEN</span></code> (this should not actually happen),
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_STATE_SETUP</span></code> (after <a class="reference internal" href="#alsaaudio.PCM.drop" title="alsaaudio.PCM.drop"><code class="xref py py-func docutils literal notranslate"><span class="pre">drop()</span></code></a> or <a class="reference internal" href="#alsaaudio.PCM.drain" title="alsaaudio.PCM.drain"><code class="xref py py-func docutils literal notranslate"><span class="pre">drain()</span></code></a>),
@@ -494,9 +525,22 @@ are prefixed with (call value) .</p>
<p><em>New in 0.10</em></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.avail">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">avail</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.avail" title="Link to this definition"></a></dt>
<dd><p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects, returns the number of writable
(that is, free) frames in the buffer.</p>
<p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> PCM objects, returns the number of readable
(that is, filled) frames in the buffer.</p>
<p>An attempt to read/write more frames than indicated will block (in
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode) or fail and return zero (in
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode).</p>
<p><em>New in 0.11</em></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.read">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">read</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.read" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">read</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">bytes</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.PCM.read" title="Link to this definition"></a></dt>
<dd><p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode, this function blocks until a full period is
available, and then returns a tuple (length,data) where <em>length</em> is
the number of frames of captured data, and <em>data</em> is the captured
@@ -505,25 +549,35 @@ periodsize*framesize bytes.</p>
<p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, the call will not block, but will return
<code class="docutils literal notranslate"><span class="pre">(0,'')</span></code> if no new period has become available since the last
call to read.</p>
<p>In case of an overrun, this function will return a negative size: <code class="xref py py-const docutils literal notranslate"><span class="pre">-EPIPE</span></code>.
This indicates that data was lost, even if the operation itself succeeded.
Try using a larger periodsize.</p>
<p>In case of a buffer overrun, this function will return the negative
size <code class="xref py py-const docutils literal notranslate"><span class="pre">-EPIPE</span></code>, and no data is read.
This indicates that data was lost. To resume capturing, just call read
again, but note that the stream was already corrupted.
To avoid the problem in the future, try using a larger period size
and/or more periods, at the cost of higher latency.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.write">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">write</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.write" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">write</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.write" title="Link to this definition"></a></dt>
<dd><p>Writes (plays) the sound in data. The length of data <em>must</em> be a
multiple of the frame size, and <em>should</em> be exactly the size of a
period. If less than period size frames are provided, the actual
playout will not happen until more data is written.</p>
<p>If the device is not in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, this call will block if
the kernel buffer is full, and until enough sound has been played
to allow the sound data to be buffered. The call always returns the
size of the data provided.</p>
<p>If the data was successfully written, the call returns the size of the
data <em>in frames</em>.</p>
<p>If the device is not in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, this call will block
if the kernel buffer is full, and until enough sound has been played
to allow the sound data to be buffered.</p>
<p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, the call will return immediately, with a
return value of zero, if the buffer is full. In this case, the data
should be written at a later time.</p>
should be written again at a later time.</p>
<p>In case of a buffer underrun, this function will return the negative
size <code class="xref py py-const docutils literal notranslate"><span class="pre">-EPIPE</span></code>, and no data is written.
At this point, the playback was already corrupted. If you want to play
the data nonetheless, call write again with the same data.
To avoid the problem in the future, try using a larger period size
and/or more periods, at the cost of higher latency.</p>
<p>Note that this call completing means only that the samples were buffered
in the kernel, and playout will continue afterwards. Make sure that the
stream is drained before discarding the PCM handle.</p>
@@ -531,21 +585,21 @@ stream is drained before discarding the PCM handle.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.pause">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pause</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">enable=True</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.pause" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pause</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">enable:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">True</span></span></em><span class="optional">]</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.pause" title="Link to this definition"></a></dt>
<dd><p>If <em>enable</em> is <code class="xref py py-const docutils literal notranslate"><span class="pre">True</span></code>, playback or capture is paused.
Otherwise, playback/capture is resumed.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.drop">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drop</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.drop" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drop</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.drop" title="Link to this definition"></a></dt>
<dd><p>Stop the stream and drop residual buffered frames.</p>
<p><em>New in 0.9</em></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.drain">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drain</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.drain" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drain</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.drain" title="Link to this definition"></a></dt>
<dd><p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects, play residual buffered frames
and then stop the stream. In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode,
this function blocks until all pending playback is drained.</p>
@@ -555,7 +609,7 @@ this function blocks until all pending playback is drained.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.close">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.close" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.PCM.close" title="Link to this definition"></a></dt>
<dd><p>Closes the PCM device.</p>
<p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode,
this function blocks until all pending playback is drained.</p>
@@ -563,30 +617,40 @@ this function blocks until all pending playback is drained.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.polldescriptors">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.polldescriptors" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.PCM.polldescriptors" title="Link to this definition"></a></dt>
<dd><p>Returns a list of tuples of <em>(file descriptor, eventmask)</em> that can be
used to wait for changes on the PCM with <em>select.poll</em>.</p>
<p>The <em>eventmask</em> value is compatible with <a href="#id3"><span class="problematic" id="id4">`poll.register`__</span></a> in the Python
<p>The <em>eventmask</em> value is compatible with <a href="#id6"><span class="problematic" id="id7">`poll.register`__</span></a> in the Python
<code class="xref py py-const docutils literal notranslate"><span class="pre">select</span></code> module.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.polldescriptors_revents">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">polldescriptors_revents</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">descriptors</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.polldescriptors_revents" title="Link to this definition"></a></dt>
<dd><p>Processes the descriptor list returned by <a class="reference internal" href="#alsaaudio.PCM.polldescriptors" title="alsaaudio.PCM.polldescriptors"><code class="xref py py-func docutils literal notranslate"><span class="pre">polldescriptors()</span></code></a> after
using it with <em>select.poll</em>, and returns a single <em>eventmask</em> value that
is meaningful for deciding whether <a class="reference internal" href="#alsaaudio.PCM.read" title="alsaaudio.PCM.read"><code class="xref py py-func docutils literal notranslate"><span class="pre">read()</span></code></a> or <a class="reference internal" href="#alsaaudio.PCM.write" title="alsaaudio.PCM.write"><code class="xref py py-func docutils literal notranslate"><span class="pre">write()</span></code></a> should
be called.</p>
<p><em>New in 0.11</em></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.set_tstamp_mode">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_mode</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">mode=PCM_TSTAMP_ENABLE</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_mode" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_mode</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">mode:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_TSTAMP_ENABLE</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_mode" title="Link to this definition"></a></dt>
<dd><p>Set the ALSA timestamp mode on the device. The mode argument can be set to
either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_NONE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_ENABLE</span></code>.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.get_tstamp_mode">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_mode" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_mode" title="Link to this definition"></a></dt>
<dd><p>Return the integer value corresponding to the ALSA timestamp mode. The
return value can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_NONE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_ENABLE</span></code>.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.set_tstamp_type">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_type</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">type=PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_type" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_type</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">type:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></span></em><span class="optional">]</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_type" title="Link to this definition"></a></dt>
<dd><p>Set the ALSA timestamp mode on the device. The type argument
can be set to either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC_RAW</span></code>.</p>
@@ -594,7 +658,7 @@ can be set to either <code class="xref py py-const docutils literal notranslate"
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.get_tstamp_type">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_type</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_type" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_type</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_type" title="Link to this definition"></a></dt>
<dd><p>Return the integer value corresponding to the ALSA timestamp type. The
return value can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC_RAW</span></code>.</p>
@@ -602,7 +666,7 @@ return value can be either <code class="xref py py-const docutils literal notran
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.htimestamp">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">htimestamp</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.htimestamp" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">htimestamp</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.PCM.htimestamp" title="Link to this definition"></a></dt>
<dd><p>Return a Python tuple <em>(seconds, nanoseconds, frames_available_in_buffer)</em>.</p>
<p>The type of output is controlled by the tstamp_type, as described in the table below.</p>
<table class="docutils align-default">
@@ -649,7 +713,7 @@ update.</p></td>
<p>The most common reason for problems with playback of PCM audio is that writes
to PCM devices must <em>exactly</em> match the data rate of the device.</p>
<p>If too little data is written to the device, it will underrun, and
ugly clicking sounds will occur. Conversely, of too much data is
ugly clicking sounds will occur. Conversely, if too much data is
written to the device, the write function will either block
(<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode) or return zero (<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode).</p>
<p>If your program does nothing but play sound, the best strategy is to put the
@@ -668,11 +732,11 @@ accumulate to quite a lot after a few seconds. Hint: use time.time()
to check how much time has really passed, and add extra writes as nessecary.</p>
</section>
<section id="mixer-objects">
<span id="id2"></span><h2>Mixer Objects<a class="headerlink" href="#mixer-objects" title="Permalink to this heading"></a></h2>
<span id="id5"></span><h2>Mixer Objects<a class="headerlink" href="#mixer-objects" title="Link to this heading"></a></h2>
<p>Mixer objects provides access to the ALSA mixer API.</p>
<dl class="py class">
<dt class="sig sig-object py" id="alsaaudio.Mixer">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">Mixer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">control</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'Master'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">Mixer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">control</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'Master'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#alsaaudio.Mixer" title="alsaaudio.Mixer"><span class="pre">Mixer</span></a></span></span><a class="headerlink" href="#alsaaudio.Mixer" title="Link to this definition"></a></dt>
<dd><p>Arguments are:</p>
<ul class="simple">
<li><p><em>control</em> - specifies which control to manipulate using this mixer
@@ -698,26 +762,26 @@ devices.</p></li>
<p>Mixer objects have the following methods:</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.cardname">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.cardname" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.cardname" title="Link to this definition"></a></dt>
<dd><p>Return the name of the sound card used by this Mixer object</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.mixer">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixer</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.mixer" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixer</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.mixer" title="Link to this definition"></a></dt>
<dd><p>Return the name of the specific mixer controlled by this object, For example
<code class="docutils literal notranslate"><span class="pre">'Master'</span></code> or <code class="docutils literal notranslate"><span class="pre">'PCM'</span></code></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.mixerid">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixerid</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.mixerid" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixerid</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.mixerid" title="Link to this definition"></a></dt>
<dd><p>Return the ID of the ALSA mixer controlled by this object.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.switchcap">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">switchcap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.switchcap" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">switchcap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.switchcap" title="Link to this definition"></a></dt>
<dd><p>Returns a list of the switches which are defined by this specific mixer.
Possible values in this list are:</p>
<table class="docutils align-default">
@@ -756,7 +820,7 @@ Possible values in this list are:</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.volumecap">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">volumecap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.volumecap" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">volumecap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.volumecap" title="Link to this definition"></a></dt>
<dd><p>Returns a list of the volume control capabilities of this
mixer. Possible values in the list are:</p>
<table class="docutils align-default">
@@ -790,7 +854,7 @@ mixer. Possible values in the list are:</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getenum">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getenum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getenum" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getenum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getenum" title="Link to this definition"></a></dt>
<dd><p>For enumerated controls, return the currently selected item and the list of
items available.</p>
<p>Returns a tuple <em>(string, list of strings)</em>.</p>
@@ -816,7 +880,7 @@ control.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setenum">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setenum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setenum" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setenum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setenum" title="Link to this definition"></a></dt>
<dd><p>For enumerated controls, sets the currently selected item.
<em>index</em> is an index into the list of available enumerated items returned
by <a class="reference internal" href="#alsaaudio.Mixer.getenum" title="alsaaudio.Mixer.getenum"><code class="xref py py-func docutils literal notranslate"><span class="pre">getenum()</span></code></a>.</p>
@@ -824,7 +888,7 @@ by <a class="reference internal" href="#alsaaudio.Mixer.getenum" title="alsaaudi
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getrange">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrange</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">VOLUME_UNITS_RAW</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getrange" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrange</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">VOLUME_UNITS_RAW</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getrange" title="Link to this definition"></a></dt>
<dd><p>Return the volume range of the ALSA mixer controlled by this object.
The value is a tuple of integers whose meaning is determined by the
<em>units</em> argument.</p>
@@ -838,7 +902,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getvolume">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getvolume" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getvolume" title="Link to this definition"></a></dt>
<dd><p>Returns a list with the current volume settings for each channel. The list
elements are integers whose meaning is determined by the <em>units</em> argument.</p>
<p>The optional <em>pcmtype</em> argument can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> or
@@ -851,7 +915,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setvolume">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">volume</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setvolume" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">volume</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setvolume" title="Link to this definition"></a></dt>
<dd><p>Change the current volume settings for this mixer. The <em>volume</em> argument
is an integer whose meaning is determined by the <em>units</em> argument.</p>
<p>If the optional argument <em>channel</em> is present, the volume is set
@@ -867,7 +931,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getmute">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getmute</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getmute" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getmute</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getmute" title="Link to this definition"></a></dt>
<dd><p>Return a list indicating the current mute setting for each channel.
0 means not muted, 1 means muted.</p>
<p>This method will fail if the mixer has no playback switch capabilities.</p>
@@ -875,7 +939,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setmute">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setmute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mute</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setmute" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setmute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mute</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setmute" title="Link to this definition"></a></dt>
<dd><p>Sets the mute flag to a new value. The <em>mute</em> argument is either 0 for not
muted, or 1 for muted.</p>
<p>The optional <em>channel</em> argument controls which channel is
@@ -885,7 +949,7 @@ muted. The default is to set the mute flag for all channels.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getrec">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrec</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getrec" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrec</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getrec" title="Link to this definition"></a></dt>
<dd><p>Return a list indicating the current record mute setting for each channel.
0 means not recording, 1 means recording.</p>
<p>This method will fail if the mixer has no capture switch capabilities.</p>
@@ -893,7 +957,7 @@ muted. The default is to set the mute flag for all channels.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setrec">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setrec</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capture</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setrec" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setrec</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capture</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setrec" title="Link to this definition"></a></dt>
<dd><p>Sets the capture mute flag to a new value. The <em>capture</em> argument
is either 0 for no capture, or 1 for capture.</p>
<p>The optional <em>channel</em> argument controls which channel is
@@ -903,16 +967,16 @@ changed. The default is to set the capture flag for all channels.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.polldescriptors">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.polldescriptors" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.polldescriptors" title="Link to this definition"></a></dt>
<dd><p>Returns a list of tuples of <em>(file descriptor, eventmask)</em> that can be
used to wait for changes on the mixer with <em>select.poll</em>.</p>
<p>The <em>eventmask</em> value is compatible with <a href="#id3"><span class="problematic" id="id5">`poll.register`__</span></a> in the Python
<p>The <em>eventmask</em> value is compatible with <a href="#id6"><span class="problematic" id="id8">`poll.register`__</span></a> in the Python
<code class="xref py py-const docutils literal notranslate"><span class="pre">select</span></code> module.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.handleevents">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">handleevents</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.handleevents" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">handleevents</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.handleevents" title="Link to this definition"></a></dt>
<dd><p>Acknowledge events on the <a class="reference internal" href="#alsaaudio.Mixer.polldescriptors" title="alsaaudio.Mixer.polldescriptors"><code class="xref py py-func docutils literal notranslate"><span class="pre">polldescriptors()</span></code></a> file descriptors
to prevent subsequent polls from returning the same events again.
Returns the number of events that were acknowledged.</p>
@@ -920,7 +984,7 @@ Returns the number of events that were acknowledged.</p>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.close">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.close" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.close" title="Link to this definition"></a></dt>
<dd><p>Closes the Mixer device.</p>
</dd></dl>
@@ -943,7 +1007,7 @@ understand half of the API, and that which I do understand has come from a
painful trial and error process.</p>
</section>
<section id="examples">
<span id="pcm-example"></span><h2>Examples<a class="headerlink" href="#examples" title="Permalink to this heading"></a></h2>
<span id="pcm-example"></span><h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"></a></h2>
<p>The following example are provided:</p>
<ul class="simple">
<li><p><cite>playwav.py</cite></p></li>
@@ -967,7 +1031,7 @@ painful trial and error process.</p>
<p>mixertest.py accepts the commandline options <em>-d &lt;device&gt;</em> and
<em>-c &lt;cardindex&gt;</em>.</p>
<section id="playwav-py">
<h3>playwav.py<a class="headerlink" href="#playwav-py" title="Permalink to this heading"></a></h3>
<h3>playwav.py<a class="headerlink" href="#playwav-py" title="Link to this heading"></a></h3>
<p><strong>playwav.py</strong> plays a wav file.</p>
<p>To test PCM playback (on your default soundcard), run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python playwav.py &lt;wav file&gt;
@@ -975,7 +1039,7 @@ painful trial and error process.</p>
</div>
</section>
<section id="recordtest-py-and-playbacktest-py">
<h3>recordtest.py and playbacktest.py<a class="headerlink" href="#recordtest-py-and-playbacktest-py" title="Permalink to this heading"></a></h3>
<h3>recordtest.py and playbacktest.py<a class="headerlink" href="#recordtest-py-and-playbacktest-py" title="Link to this heading"></a></h3>
<p><strong>recordtest.py</strong> and <strong>playbacktest.py</strong> will record and play a raw
sound file in CD quality.</p>
<p>To test PCM recordings (on your default soundcard), run:</p>
@@ -990,7 +1054,7 @@ with <code class="docutils literal notranslate"><span class="pre">Ctl-C</span></
</div>
</section>
<section id="mixertest-py">
<h3>mixertest.py<a class="headerlink" href="#mixertest-py" title="Permalink to this heading"></a></h3>
<h3>mixertest.py<a class="headerlink" href="#mixertest-py" title="Link to this heading"></a></h3>
<p>Without arguments, <strong>mixertest.py</strong> will list all available <em>controls</em> on the
default soundcard.</p>
<p>The output might look like this:</p>
@@ -1052,36 +1116,75 @@ Channel 1 volume: 61%
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><ul>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.pcms"><code class="docutils literal notranslate"><span class="pre">pcms()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.cards"><code class="docutils literal notranslate"><span class="pre">cards()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.mixers"><code class="docutils literal notranslate"><span class="pre">mixers()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.asoundlib_version"><code class="docutils literal notranslate"><span class="pre">asoundlib_version()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#pcm-objects">PCM Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="#mixer-objects">Mixer Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">Examples</a></li>
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><ul>
<li><a class="reference internal" href="#alsaaudio.pcms"><code class="docutils literal notranslate"><span class="pre">pcms()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.cards"><code class="docutils literal notranslate"><span class="pre">cards()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.mixers"><code class="docutils literal notranslate"><span class="pre">mixers()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.asoundlib_version"><code class="docutils literal notranslate"><span class="pre">asoundlib_version()</span></code></a></li>
<li><a class="reference internal" href="#pcm-objects">PCM Objects</a><ul>
<li><a class="reference internal" href="#alsaaudio.PCM.info"><code class="docutils literal notranslate"><span class="pre">PCM.info()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.dumpinfo"><code class="docutils literal notranslate"><span class="pre">PCM.dumpinfo()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.pcmtype"><code class="docutils literal notranslate"><span class="pre">PCM.pcmtype()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.pcmmode"><code class="docutils literal notranslate"><span class="pre">PCM.pcmmode()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.cardname"><code class="docutils literal notranslate"><span class="pre">PCM.cardname()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.setchannels"><code class="docutils literal notranslate"><span class="pre">PCM.setchannels()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.setrate"><code class="docutils literal notranslate"><span class="pre">PCM.setrate()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.setformat"><code class="docutils literal notranslate"><span class="pre">PCM.setformat()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.setperiodsize"><code class="docutils literal notranslate"><span class="pre">PCM.setperiodsize()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.state"><code class="docutils literal notranslate"><span class="pre">PCM.state()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.avail"><code class="docutils literal notranslate"><span class="pre">PCM.avail()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.read"><code class="docutils literal notranslate"><span class="pre">PCM.read()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.write"><code class="docutils literal notranslate"><span class="pre">PCM.write()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.pause"><code class="docutils literal notranslate"><span class="pre">PCM.pause()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.drop"><code class="docutils literal notranslate"><span class="pre">PCM.drop()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.drain"><code class="docutils literal notranslate"><span class="pre">PCM.drain()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.close"><code class="docutils literal notranslate"><span class="pre">PCM.close()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.polldescriptors"><code class="docutils literal notranslate"><span class="pre">PCM.polldescriptors()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.polldescriptors_revents"><code class="docutils literal notranslate"><span class="pre">PCM.polldescriptors_revents()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.set_tstamp_mode"><code class="docutils literal notranslate"><span class="pre">PCM.set_tstamp_mode()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.get_tstamp_mode"><code class="docutils literal notranslate"><span class="pre">PCM.get_tstamp_mode()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.set_tstamp_type"><code class="docutils literal notranslate"><span class="pre">PCM.set_tstamp_type()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.get_tstamp_type"><code class="docutils literal notranslate"><span class="pre">PCM.get_tstamp_type()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.htimestamp"><code class="docutils literal notranslate"><span class="pre">PCM.htimestamp()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#mixer-objects">Mixer Objects</a><ul>
<li><a class="reference internal" href="#alsaaudio.Mixer"><code class="docutils literal notranslate"><span class="pre">Mixer</span></code></a><ul>
<li><a class="reference internal" href="#alsaaudio.Mixer.cardname"><code class="docutils literal notranslate"><span class="pre">Mixer.cardname()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.mixer"><code class="docutils literal notranslate"><span class="pre">Mixer.mixer()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.mixerid"><code class="docutils literal notranslate"><span class="pre">Mixer.mixerid()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.switchcap"><code class="docutils literal notranslate"><span class="pre">Mixer.switchcap()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.volumecap"><code class="docutils literal notranslate"><span class="pre">Mixer.volumecap()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getenum"><code class="docutils literal notranslate"><span class="pre">Mixer.getenum()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setenum"><code class="docutils literal notranslate"><span class="pre">Mixer.setenum()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getrange"><code class="docutils literal notranslate"><span class="pre">Mixer.getrange()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getvolume"><code class="docutils literal notranslate"><span class="pre">Mixer.getvolume()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setvolume"><code class="docutils literal notranslate"><span class="pre">Mixer.setvolume()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getmute"><code class="docutils literal notranslate"><span class="pre">Mixer.getmute()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setmute"><code class="docutils literal notranslate"><span class="pre">Mixer.setmute()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getrec"><code class="docutils literal notranslate"><span class="pre">Mixer.getrec()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setrec"><code class="docutils literal notranslate"><span class="pre">Mixer.setrec()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.polldescriptors"><code class="docutils literal notranslate"><span class="pre">Mixer.polldescriptors()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.handleevents"><code class="docutils literal notranslate"><span class="pre">Mixer.handleevents()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.close"><code class="docutils literal notranslate"><span class="pre">Mixer.close()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#playwav-py">playwav.py</a></li>
<li><a class="reference internal" href="#recordtest-py-and-playbacktest-py">recordtest.py and playbacktest.py</a></li>
<li><a class="reference internal" href="#mixertest-py">mixertest.py</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="relations">
</div><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
@@ -1089,7 +1192,14 @@ Channel 1 volume: 61%
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/libalsaaudio.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
@@ -1097,16 +1207,8 @@ Channel 1 volume: 61%
<input type="submit" value="Go" />
</form>
</div>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
@@ -1115,8 +1217,8 @@ Channel 1 volume: 61%
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/libalsaaudio.rst.txt"

Binary file not shown.

View File

@@ -1,16 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Module Index &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<title>Python Module Index &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
@@ -60,35 +59,14 @@
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
@@ -96,16 +74,8 @@
<input type="submit" value="Go" />
</form>
</div>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
@@ -114,8 +84,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

View File

@@ -1,17 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Introduction &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<title>Introduction &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="PCM Terminology and Concepts" href="terminology.html" />
@@ -33,7 +32,7 @@
<div class="body" role="main">
<section id="introduction">
<h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this heading"></a></h1>
<h1>Introduction<a class="headerlink" href="#introduction" title="Link to this heading"></a></h1>
<dl class="field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd"><p>Casper Wilstrup &lt;<a class="reference external" href="mailto:cwi&#37;&#52;&#48;aves&#46;dk">cwi<span>&#64;</span>aves<span>&#46;</span>dk</a>&gt;</p>
@@ -56,7 +55,7 @@ bugs in this API, and those should be reported to the ALSA team - not me.</p>
</aside>
</section>
<section id="what-is-alsa">
<h1>What is ALSA<a class="headerlink" href="#what-is-alsa" title="Permalink to this heading"></a></h1>
<h1>What is ALSA<a class="headerlink" href="#what-is-alsa" title="Link to this heading"></a></h1>
<p>The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
functionality to the Linux operating system.</p>
<p>Logically ALSA consists of these components:</p>
@@ -72,7 +71,7 @@ all ALSA capable applications.</p></li>
<p>More information about ALSA may be found on the project homepage
<a class="reference external" href="http://www.alsa-project.org">http://www.alsa-project.org</a></p>
<section id="alsa-and-python">
<h2>ALSA and Python<a class="headerlink" href="#alsa-and-python" title="Permalink to this heading"></a></h2>
<h2>ALSA and Python<a class="headerlink" href="#alsa-and-python" title="Link to this heading"></a></h2>
<p>The older Linux sound API (OSS) which is now deprecated is well supported
by the standard Python library, through the ossaudiodev module. No native ALSA
support exists in the standard library.</p>
@@ -89,7 +88,7 @@ appreciated.</p>
</section>
</section>
<section id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading"></a></h1>
<h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
<p>Note: the wrappers link with the alsasound library (from the alsa-lib package)
and need the ALSA headers for compilation. Verify that you have
/usr/lib/libasound.so and /usr/include/alsa (or similar paths) before building.</p>
@@ -108,7 +107,7 @@ ship with ALSA kernels.</p>
</div>
</section>
<section id="testing">
<h1>Testing<a class="headerlink" href="#testing" title="Permalink to this heading"></a></h1>
<h1>Testing<a class="headerlink" href="#testing" title="Link to this heading"></a></h1>
<p>Make sure that <code class="code docutils literal notranslate"><span class="pre">aplay</span></code> plays a file through the soundcard you want, then
try:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python playwav.py &lt;filename.wav&gt;
@@ -143,30 +142,19 @@ a real problem.</p>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="#what-is-alsa">What is ALSA</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#alsa-and-python">ALSA and Python</a></li>
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Introduction</a></li>
<li><a class="reference internal" href="#what-is-alsa">What is ALSA</a><ul>
<li><a class="reference internal" href="#alsa-and-python">ALSA and Python</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
<li><a class="reference internal" href="#installation">Installation</a></li>
<li><a class="reference internal" href="#testing">Testing</a></li>
</ul>
<div class="relations">
</div><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
@@ -175,7 +163,14 @@ a real problem.</p>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pyalsaaudio.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
@@ -183,16 +178,8 @@ a real problem.</p>
<input type="submit" value="Go" />
</form>
</div>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
@@ -201,8 +188,8 @@ a real problem.</p>
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/pyalsaaudio.rst.txt"

View File

@@ -1,23 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<title>Search &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/searchtools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="#" />
<script src="searchindex.js" defer></script>
<script src="searchindex.js" defer="defer"></script>
<meta name="robots" content="noindex" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
@@ -60,10 +60,7 @@
</form>
<div id="search-results">
</div>
<div id="search-results"></div>
</div>
@@ -71,42 +68,13 @@
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
</div>
</div>
<div class="clearer"></div>
@@ -115,8 +83,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PCM Terminology and Concepts &#8212; alsaaudio documentation 0.10.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<title>PCM Terminology and Concepts &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="alsaaudio" href="libalsaaudio.html" />
@@ -33,7 +32,7 @@
<div class="body" role="main">
<section id="pcm-terminology-and-concepts">
<h1>PCM Terminology and Concepts<a class="headerlink" href="#pcm-terminology-and-concepts" title="Permalink to this heading"></a></h1>
<h1>PCM Terminology and Concepts<a class="headerlink" href="#pcm-terminology-and-concepts" title="Link to this heading"></a></h1>
<p>In order to use PCM devices it is useful to be familiar with some concepts and
terminology.</p>
<dl>
@@ -101,6 +100,21 @@ each write should contain exactly 32 frames of sound data, and each
read will return either 32 frames of data or nothing at all.</p>
</dd>
</dl>
<dl id="term-sample-size">
<dt>Sample size</dt><dd><p>Each sample takes <em>physical_bits</em> of space. <em>nominal_bits</em> tells
how many least significant bits are used. This is the bit depth
in the format name and sometimes called just <em>sample bits</em> or
<em>format width</em>. <em>significant_bits</em> tells how many most significant
bits of the <em>nominal_bits</em> are used by the sample. This can be thought
of as the <em>sample resolution</em>. This is visualized as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">MSB</span> <span class="o">|</span><span class="mi">00000000</span> <span class="n">XXXXXXXX</span> <span class="n">XXXXXXXX</span> <span class="mi">00000000</span><span class="o">|</span> <span class="n">LSB</span>
<span class="o">|--</span><span class="n">significant</span><span class="o">--|</span>
<span class="o">|---------</span><span class="n">nominal</span><span class="o">---------|</span>
<span class="o">|-------------</span><span class="n">physical</span><span class="o">--------------|</span>
</pre></div>
</div>
</dd>
</dl>
<p>Once you understand these concepts, you will be ready to use the PCM API. Read
on.</p>
</section>
@@ -111,28 +125,7 @@ on.</p>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<div class="sphinxsidebarwrapper"><div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
@@ -141,7 +134,14 @@ on.</p>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/terminology.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
@@ -149,16 +149,8 @@ on.</p>
<input type="submit" value="Go" />
</form>
</div>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
@@ -167,8 +159,8 @@ on.</p>
&copy;2017, Lars Immisch & Casper Wilstrup.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/terminology.rst.txt"