Audio Layers
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yw-0.0.9.tar.gz.
File metadata
- Download URL: yw-0.0.9.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec568efcc989ac83fb99450c33fae91f73ebe7603922d6c9843909542e27d88b
|
|
| MD5 |
02b53ba47f3e6b589e475f685f90fe34
|
|
| BLAKE2b-256 |
0a199a46907ebbabc6bf08cd47be26cc51c3a952777874997bdec1fec7e18af2
|
File details
Details for the file yw-0.0.9-py3-none-any.whl.
File metadata
- Download URL: yw-0.0.9-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f9aca1807411243d0d54c9dfa7f599853fc228f8e418fa01e2abf8cdaea8c70
|
|
| MD5 |
20110bee42381c8bac6f6e413af585ef
|
|
| BLAKE2b-256 |
e55e3c30bd57df32d2147602646b3bf57150b774463ceafbb56e660d47bbcd9f
|