Metadata-Version: 2.4
Name: harp-soundcard
Version: 3.0.0
Summary: Interface for data acquisition and control of Harp Sound Card devices.
Author-email: harp-tech <contact@harp-tech.org>
License-Expression: MIT
Project-URL: Homepage, https://harp-tech.org/device.soundcard
Project-URL: Repository, https://github.com/harp-tech/device.soundcard
Project-URL: Bug Tracker, https://github.com/harp-tech/device.soundcard/issues
Project-URL: Changelog, https://github.com/harp-tech/device.soundcard/releases
Keywords: harp,sound,card,audio,hardware,device-control
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: harp-protocol>=0.5
Requires-Dist: harp-device>=0.5
Requires-Dist: numpy>=1.24
Dynamic: license-file

# harp-soundcard

The Python interface for the [Harp Sound Card](https://harp-tech.org/device.soundcard) device. It carries the register classes for the device, the payload and enumeration types those registers use, and a `REGISTER_MAP` pairing every address with its register.

## Installation

```text
pip install harp-soundcard
```

## Reading and writing registers

Register classes are passed to `read` and `write` on an open device transport, such as the serial transport in [Harp Python](https://harp-tech.org/python/).

```python
from harp import serial
from harp.device import client, soundcard

SERIAL_PORT = "/dev/ttyUSB0"  # or "COMx" in Windows, where "x" is the serial port number

with serial.open_device(client.Device, port=SERIAL_PORT) as device:
    print("device:", soundcard.DEVICE_NAME, "WhoAmI:", soundcard.WHO_AM_I)
    print("digital inputs:", device.read(soundcard.InputState).payload)
```

`open_dataset` in `harp.data` takes this module as its second argument, and decodes recorded data through the same register classes.

Uploading sounds to the device is not part of this package. Sounds are uploaded with the Sound Card app or with the `UpdateSoundWaveform` operator in the `Harp.SoundCard` Bonsai package.

## Feedback and contributing

`harp-soundcard` is released as open source under the MIT license. Bug reports and contributions are welcome at [the GitHub repository](https://github.com/harp-tech/device.soundcard).
