/ README.rst
README.rst
  1  Introduction
  2  ============
  3  
  4  
  5  .. image:: https://readthedocs.org/projects/circuitpython-wave/badge/?version=latest
  6      :target: https://docs.circuitpython.org/projects/wave/en/latest/
  7      :alt: Documentation Status
  8  
  9  
 10  .. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
 11      :target: https://adafru.it/discord
 12      :alt: Discord
 13  
 14  
 15  .. image:: https://github.com/adafruit/Adafruit_CircuitPython_wave/workflows/Build%20CI/badge.svg
 16      :target: https://github.com/adafruit/Adafruit_CircuitPython_wave/actions
 17      :alt: Build Status
 18  
 19  
 20  .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
 21      :target: https://github.com/psf/black
 22      :alt: Code Style: Black
 23  
 24  Read and write standard WAV-format files
 25  
 26  
 27  Dependencies
 28  =============
 29  This driver depends on:
 30  
 31  * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
 32  
 33  Please ensure all dependencies are available on the CircuitPython filesystem.
 34  This is easily achieved by downloading
 35  `the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
 36  or individual libraries can be installed using
 37  `circup <https://github.com/adafruit/circup>`_.
 38  
 39  Installing from PyPI
 40  =====================
 41  
 42  On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
 43  PyPI <https://pypi.org/project/adafruit-circuitpython-wave/>`_.
 44  To install for current user:
 45  
 46  .. code-block:: shell
 47  
 48      pip3 install adafruit-circuitpython-wave
 49  
 50  To install system-wide (this may be required in some cases):
 51  
 52  .. code-block:: shell
 53  
 54      sudo pip3 install adafruit-circuitpython-wave
 55  
 56  To install in a virtual environment in your current project:
 57  
 58  .. code-block:: shell
 59  
 60      mkdir project-name && cd project-name
 61      python3 -m venv .venv
 62      source .env/bin/activate
 63      pip3 install adafruit-circuitpython-wave
 64  
 65  Installing to a Connected CircuitPython Device with Circup
 66  ==========================================================
 67  
 68  Make sure that you have ``circup`` installed in your Python environment.
 69  Install it with the following command if necessary:
 70  
 71  .. code-block:: shell
 72  
 73      pip3 install circup
 74  
 75  With ``circup`` installed and your CircuitPython device connected use the
 76  following command to install:
 77  
 78  .. code-block:: shell
 79  
 80      circup install adafruit_wave
 81  
 82  Or the following command to update an existing version:
 83  
 84  .. code-block:: shell
 85  
 86      circup update
 87  
 88  Usage Example
 89  =============
 90  
 91  .. code-block:: python
 92  
 93      import adafruit_wave
 94  
 95      with adafruit_wave.open("sample.wav") as w:
 96          print(w.getsampwidth())
 97          print(w.getnchannels())
 98          print(list(memoryview(w.readframes(100)).cast("h")))
 99  
100  Documentation
101  =============
102  API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/wave/en/latest/>`_.
103  
104  For information on building library documentation, please check out
105  `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
106  
107  Contributing
108  ============
109  
110  Contributions are welcome! Please read our `Code of Conduct
111  <https://github.com/adafruit/Adafruit_CircuitPython_wave/blob/HEAD/CODE_OF_CONDUCT.md>`_
112  before contributing to help this project stay welcoming.