Skip to content

Commit e445399

Browse files
committed
Add documentation
1 parent 107b7f7 commit e445399

13 files changed

Lines changed: 375 additions & 21 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ __pycache__/
88
dist/
99
build/
1010

11+
docs/_build
12+
1113
tags
1214
.vscode/
1315

README.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ Usage
5656
# See `samplerate.CallbackResampler` for the Callback API, or
5757
# `examples/play_modulation.py` for an example.
5858
59+
See :func:`~samplerate.converters.resample`,
60+
:class:`~samplerate.converters.Resampler`, and
61+
:class:`~samplerate.converters.CallbackResampler` in the API documentation for
62+
details.
63+
5964

6065
See also
6166
--------
@@ -65,15 +70,18 @@ See also
6570
extern calls. The `resample` function of `scikits.samplerate` and this package
6671
share the same function signature for compatiblity.
6772

73+
* `resampy <https://github.com/bmcfee/resampy>`_: sample rate conversion in
74+
Python + Cython.
75+
6876

6977
License
7078
-------
7179

72-
This project is licensed under the MIT license. See `LICENSE.rst <LICENSE.rst>`_
73-
for details.
80+
This project is licensed under the `MIT license
81+
<https://opensource.org/licenses/MIT>`_.
7482

75-
As of version 0.1.9, `libsamplerate`_ is licensed under the 2-clause BSD
76-
license.
83+
As of version 0.1.9, `libsamplerate`_ is licensed under the `2-clause BSD
84+
license <https://opensource.org/licenses/BSD-2-Clause>`_.
7785

7886

7987
.. _libsamplerate: http://www.mega-nerd.com/libsamplerate/

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = python-samplerate
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Change Log
2+
##########
3+
4+
0.1.0
5+
=====
6+
7+
* Initial release.

docs/conf.py

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# python-samplerate documentation build configuration file, created by
5+
# sphinx-quickstart on Thu Feb 9 12:32:39 2017.
6+
#
7+
# This file is execfile()d with the current directory set to its
8+
# containing dir.
9+
#
10+
# Note that not all possible configuration values are present in this
11+
# autogenerated file.
12+
#
13+
# All configuration values have a default; values that are commented out
14+
# serve to show the default.
15+
16+
# If extensions (or modules to document with autodoc) are in another directory,
17+
# add these directories to sys.path here. If the directory is relative to the
18+
# documentation root, use os.path.abspath to make it absolute, like shown here.
19+
#
20+
# import os
21+
import sys
22+
# sys.path.insert(0, os.path.abspath('.'))
23+
24+
# Mock C modules
25+
try:
26+
from unittest.Mock import MagicMock # Python >3.3
27+
except ImportError:
28+
try:
29+
from mock import MagicMock
30+
except ImportError:
31+
raise ImportError('No module named mock')
32+
33+
class Mock(MagicMock):
34+
@classmethod
35+
def __getattr__(cls, name):
36+
return MagicMock()
37+
38+
mock_modules = ['numpy', 'samplerate._src']
39+
sys.modules.update((mod_name, Mock()) for mod_name in mock_modules)
40+
41+
import samplerate
42+
43+
# -- General configuration ------------------------------------------------
44+
45+
# If your documentation needs a minimal Sphinx version, state it here.
46+
#
47+
# needs_sphinx = '1.0'
48+
49+
# Add any Sphinx extension module names here, as strings. They can be
50+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
51+
# ones.
52+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode',
53+
'sphinx.ext.napoleon']
54+
55+
# Add any paths that contain templates here, relative to this directory.
56+
templates_path = ['_templates']
57+
58+
# The suffix(es) of source filenames.
59+
# You can specify multiple suffix as a list of string:
60+
#
61+
# source_suffix = ['.rst', '.md']
62+
source_suffix = '.rst'
63+
64+
# The master toctree document.
65+
master_doc = 'index'
66+
67+
# General information about the project.
68+
project = 'python-samplerate'
69+
copyright = '2017, Tino Wagner'
70+
author = 'Tino Wagner'
71+
72+
# The version info for the project you're documenting, acts as replacement for
73+
# |version| and |release|, also used in various other places throughout the
74+
# built documents.
75+
#
76+
77+
# The full version, including alpha/beta/rc tags.
78+
release = samplerate.__version__
79+
80+
# The short X.Y version.
81+
def get_short_version(version):
82+
"""Return short version from PEP-440 compatible version string."""
83+
if '+' in version:
84+
return version[:version.find('+')]
85+
return version
86+
version = get_short_version(release)
87+
88+
# The language for content autogenerated by Sphinx. Refer to documentation
89+
# for a list of supported languages.
90+
#
91+
# This is also used if you do content translation via gettext catalogs.
92+
# Usually you set "language" from the command line for these cases.
93+
language = None
94+
95+
# List of patterns, relative to source directory, that match files and
96+
# directories to ignore when looking for source files.
97+
# This patterns also effect to html_static_path and html_extra_path
98+
exclude_patterns = []
99+
100+
# The name of the Pygments (syntax highlighting) style to use.
101+
pygments_style = 'sphinx'
102+
103+
# If true, `todo` and `todoList` produce output, else they produce nothing.
104+
todo_include_todos = False
105+
106+
107+
# -- Options for HTML output ----------------------------------------------
108+
109+
# The theme to use for HTML and HTML Help pages. See the documentation for
110+
# a list of builtin themes.
111+
#
112+
html_theme = 'alabaster'
113+
114+
# Theme options are theme-specific and customize the look and feel of a theme
115+
# further. For a list of options available for each theme, see the
116+
# documentation.
117+
#
118+
html_theme_options = {
119+
'description': 'Sample rate conversion in Python using libsamplerate',
120+
'github_user': 'tuxu',
121+
'github_repo': 'python-samplerate',
122+
'github_banner': True,
123+
'fixed_sidebar': True,
124+
}
125+
126+
html_sidebars = {
127+
'**': [
128+
'about.html',
129+
'navigation.html',
130+
'relations.html',
131+
'searchbox.html',
132+
'donate.html',
133+
]
134+
}
135+
136+
# Add any paths that contain custom static files (such as style sheets) here,
137+
# relative to this directory. They are copied after the builtin static files,
138+
# so a file named "default.css" will overwrite the builtin "default.css".
139+
html_static_path = ['_static']
140+
141+
142+
# -- Options for HTMLHelp output ------------------------------------------
143+
144+
# Output file base name for HTML help builder.
145+
htmlhelp_basename = 'python-sampleratedoc'
146+
147+
148+
# -- Options for LaTeX output ---------------------------------------------
149+
150+
latex_elements = {
151+
# The paper size ('letterpaper' or 'a4paper').
152+
#
153+
# 'papersize': 'letterpaper',
154+
155+
# The font size ('10pt', '11pt' or '12pt').
156+
#
157+
# 'pointsize': '10pt',
158+
159+
# Additional stuff for the LaTeX preamble.
160+
#
161+
# 'preamble': '',
162+
163+
# Latex figure (float) alignment
164+
#
165+
# 'figure_align': 'htbp',
166+
}
167+
168+
# Grouping the document tree into LaTeX files. List of tuples
169+
# (source start file, target name, title,
170+
# author, documentclass [howto, manual, or own class]).
171+
latex_documents = [
172+
(master_doc, 'python-samplerate.tex', 'python-samplerate Documentation',
173+
'Tino Wagner', 'manual'),
174+
]
175+
176+
177+
# -- Options for manual page output ---------------------------------------
178+
179+
# One entry per manual page. List of tuples
180+
# (source start file, name, description, authors, manual section).
181+
man_pages = [
182+
(master_doc, 'python-samplerate', 'python-samplerate Documentation',
183+
[author], 1)
184+
]
185+
186+
187+
# -- Options for Texinfo output -------------------------------------------
188+
189+
# Grouping the document tree into Texinfo files. List of tuples
190+
# (source start file, target name, title, author,
191+
# dir menu entry, description, category)
192+
texinfo_documents = [
193+
(master_doc, 'python-samplerate', 'python-samplerate Documentation',
194+
author, 'python-samplerate', 'One line description of project.',
195+
'Miscellaneous'),
196+
]

docs/index.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. include:: ../README.rst
2+
3+
4+
API documentation
5+
-----------------
6+
7+
.. toctree::
8+
:maxdepth: 2
9+
10+
samplerate/index
11+
12+
13+
Change Log
14+
----------
15+
.. toctree::
16+
:maxdepth: 2
17+
18+
changelog
19+
20+
21+
Indices and tables
22+
------------------
23+
24+
* :ref:`genindex`
25+
* :ref:`modindex`
26+
* :ref:`search`
27+
28+
29+
.. _libsamplerate: http://www.mega-nerd.com/libsamplerate/

docs/samplerate/converters.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
:mod:`samplerate.converters` -- Sample rate converters
2+
======================================================
3+
.. module:: samplerate.converters
4+
5+
Converter types
6+
---------------
7+
8+
.. autoclass:: ConverterType
9+
:members:
10+
:undoc-members:
11+
12+
13+
Sample rate converters
14+
----------------------
15+
16+
Simple
17+
^^^^^^
18+
.. autofunction:: resample
19+
20+
21+
Full API
22+
^^^^^^^^
23+
24+
.. autoclass:: Resampler
25+
:members:
26+
:undoc-members:
27+
28+
29+
Callback API
30+
^^^^^^^^^^^^
31+
32+
.. autoclass:: CallbackResampler
33+
:members:
34+
:undoc-members:

docs/samplerate/exceptions.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:mod:`samplerate.exceptions` -- Sample rate exceptions
2+
======================================================
3+
.. module:: samplerate.exceptions
4+
5+
.. autoclass:: ResamplingError
6+
:members:
7+
:undoc-members:

docs/samplerate/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
`samplerate` module documentation
2+
=================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
samplerate
8+
converters
9+
exceptions
10+
lowlevel

docs/samplerate/lowlevel.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:mod:`samplerate.lowlevel` -- Lowlevel wrappers around libsamplerate
2+
====================================================================
3+
.. automodule:: samplerate.lowlevel
4+
:members:

0 commit comments

Comments
 (0)