mksinewave
mksinewave is a Python command-line utility for generating pure sine wave audio tones with customizable configurations, smooth attenuation fades, and automatic audio container inference.
Features
- Flexible Frequency Formats: Accepts standard numbers (
440), human-friendly shortcuts (1.4k), or explicit units (22kHz). - Smart Fades: Prevent harsh audio pops and clicks with customizable linear head and tail attenuation (fade-in/fade-out).
- FFmpeg-Style Extension Inference: Saves directly to
.wav,.flac,.ogg, or.aiffby automatically detecting the format from your output filename. - Safety Proofed: Includes built-in human hearing range guards (20 Hz - 22 kHz) and Nyquist frequency anti-aliasing checks.
- Safe Overwriting: Protects existing files unless explicitly overridden with the
-f / --forceflag.
Installation
Clone the repository and install it locally using pip:
pip install mksinewave
For active local development, install using the [dev] optional dependency group in editable mode:
pip install -e "mksinewave[dev]"
Usage
Once installed, the global mksinewave command is available anywhere on your system.
Basic Syntax
mksinewave <frequency> <duration> [options]
Examples
1. Generate a standard A4 tone (440Hz) for 3 seconds:
mksinewave 440 3
2. Generate a 1.5 khz tone for 5 seconds as a compressed FLAC file with a smooth fade-in and fade-out:
mksinewave 1.5k 5 --fade-in 0.5 --fade-out 1.0 -o output.flac -v
3. Force overwrite an existing file using a specific sample rate:
mksinewave "2.2 kHz" 2.5 -s 48000 -o alert.ogg -f
Available Command-Line Flags
--fade-in: Length of head attenuation fade-in in seconds (Default: 0.0).--fade-out: Length of tail attenuation fade-out in" seconds (Default: 0.0).-s,--sample-rate: Audio sampling rate in hertz (Default: 44100).-o,--output: Output file path inferred via extension (Default: sine_wave.wav).-f,--force: Overwrite the target file if it already exists.-v,--verbose: Enable logging output detailing the generation process.frequency(Positional): Target frequency. Supports formats like 440, 1.4k, 22kHz.duration(Positional): Total length of the audio track in seconds.
Development & Testing
This project maintains rigorous test coverage using pytest and pytest-cov.
If you installed the development dependencies, you can execute the test suite globally from the project root directory:
test-mksinewave
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for mksinewave 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mksinewave-1.0.2.tar.gz | 4.5 kB | Without provenance | Details for mksinewave-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mksinewave-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for mksinewave-1.0.2-py3-none-any.whl |
Total release size: 10.1 kB
Release files / mksinewave-1.0.2.tar.gz
| Download URL | mksinewave-1.0.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e6fa816e7e8e73731f31489822aec7dcdc244b2d1258f5b92a915f6c5f21c86
|
|
BLAKE2b-256 checksum How to use checksums |
69a85e8c54548c2fc1efffd9f0673cda30941f63d375caa0d3b8d5b846122524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.9 Linux/6.17.0-PRoot-Distro
|
Release files / mksinewave-1.0.2-py3-none-any.whl
| Download URL | mksinewave-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7ba0fd3db664944863ce676a4bb144faae871dd956c7ef9ba66a95c97b7962d
|
|
BLAKE2b-256 checksum How to use checksums |
9a4680be82be920ad84df10d04b5e9cf43911cb05264a05b62600bef0559881c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.9 Linux/6.17.0-PRoot-Distro
|
Security for mksinewave 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.