https://github.com/cyanchanges/python-dfpwm
Convert something to DFPWM
https://github.com/cyanchanges/python-dfpwm
Last synced: about 1 year ago
JSON representation
Convert something to DFPWM
- Host: GitHub
- URL: https://github.com/cyanchanges/python-dfpwm
- Owner: CyanChanges
- License: other
- Created: 2023-12-26T09:52:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-18T07:52:39.000Z (about 1 year ago)
- Last Synced: 2025-05-09T00:16:21.707Z (about 1 year ago)
- Language: Python
- Size: 8.47 MB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DFPWM
DFPWM convertor for Python
## Installation
### From PyPI
You can get this package from PyPI
if you are in py311 Linux x86
```shell
pip install dfpwm
```
## Usage
```python
from pathlib import Path
import soundfile as sf # for reading audio
import dfpwm
data, sample_rate = sf.read('./someaudio.mp3') # read audio
# If sample rate is not 48000, may get strange result
# use `dfpwm.resample(...)` to resample
if sample_rate != dfpwm.SAMPLE_RATE:
raise ValueError(f"{sample_rate} != {dfpwm.SAMPLE_RATE}")
if len(data.shape) != 0 and data.shape[1] > 1:
data = data[:, 0] # get channel 0
dfpwm = dfpwm.compressor(data) # convert
Path('out.dfpwm').write_bytes(dfpwm) # write result to file
```
## Build from source
### Clone
```shell
git clone https://github.com/CyanChanges/python-dfpwm.git python-dfpwm
cd python-dfpwm
```
### Build
This project use `poetry` to build,
Make sure `poetry` is installed.
```shell
poetry build
```