yw
Audio Layers
To install: pip install yw
Overview
The yw package provides a comprehensive suite of tools for audio processing and manipulation in Python. It leverages popular libraries such as numpy, librosa, soundfile, and matplotlib to offer functionalities like audio file conversion, resampling, waveform manipulation, and audio visualization.
Features
- Audio Conversion: Convert audio files to different formats and sample rates using
convert_to_wav. - Waveform Manipulation: Functions to ensure mono audio, resample audio, and manipulate waveforms with operations like adding silence.
- Audio Information Extraction: Retrieve detailed information from audio files, such as duration, sample rate, and format-specific data.
- Audio Visualization: Plot waveforms and spectrograms to visualize audio data.
- Sound Object: A
Soundclass that encapsulates audio data along with utility methods for easy manipulation and analysis.
Usage Examples
Converting Audio Files to WAV
Convert any audio file format supported by ffmpeg to WAV format with a specified sample rate:
from yw import convert_to_wav
convert_to_wav('input.mp3', 'output.wav', sample_rate=44100)
Extracting Audio File Information
Get detailed information from a WAV file:
from yw import sound_file_info_dict
info = sound_file_info_dict('example.wav')
print(info)
Plotting a Waveform
Visualize the waveform of an audio file:
from yw import display_sound
display_sound('path/to/audio.wav')
Working with the Sound Class
Create a Sound object from a file, manipulate it, and save the output:
from yw import Sound
sound = Sound.from_file('input.wav')
sound.resample(new_sr=22050)
sound.save_to_wav('output_resampled.wav')
Mixing Audio
Mix two audio files into one by adjusting their relative weights:
from yw import Sound
sound1 = Sound.from_file('audio1.wav')
sound2 = Sound.from_file('audio2.wav')
sound1.mix_in(sound2, weight=0.5)
sound1.save_to_wav('mixed_output.wav')
Documentation
Each function and class in the yw package comes with detailed docstrings that provide more information on their usage and parameters. Here are some key functions/classes and their purposes:
convert_to_wav(source_file, target_file=None, sample_rate=44100): Convert an audio file to WAV format.sound_file_info_dict(filepath): Retrieve a dictionary containing information about the audio file.display_sound(filepath): Plot and play an audio file.Sound: A class that represents an audio signal, with methods likefrom_file,resample,mix_in, andsave_to_wavfor handling audio data.
For more detailed information, refer to the docstrings provided within the code.
Metadata
Release files for yw 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yw-0.0.10.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yw-0.0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.6 kB
Release files / yw-0.0.10.tar.gz
| Download URL | yw-0.0.10.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12f98bd09ccc4680639bc5c367486fd6c5cdf24b5605cedc1646ab5c36b5ea00
|
|
BLAKE2b-256 checksum How to use checksums |
2d03be2939a3ea7b13c65ba274fcd7b90bee3f9702db900232ffdd3e4d406d7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / yw-0.0.10-py3-none-any.whl
| Download URL | yw-0.0.10-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a16f8500ba0532ceb715daa2091f271b4392cf655d59f9636756d2915868cdb
|
|
BLAKE2b-256 checksum How to use checksums |
dc26bd83431cfd7ded45409089d360557dac645ba702732ded3cba3579794760
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|