Metadata-Version: 2.4
Name: fmps
Version: 1.10.27
Summary: Compiler and Decompiler for the FMP (Flexible Music Packed) audio format.
Author-email: AlxnDevX <alxndevcontact@yahoo.com>
License: LGPL-2.1
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 🎵 FMP Audio Library (Flexible Music Packed)

> A custom high-fidelity audio container (`.fmp`) designed to package 16-bit lossless PCM tracks alongside structured metadata, accompanied by an ultra-lightweight web player.

---

## 🚀 Features

* **Lossless Quality:** Stores pure 16-bit stereo or mono PCM audio at 44.1kHz+, maintaining clarity identical to the original studio source.
* **Integrated Metadata Header:** Supports the injection of dynamic metadata in JSON format (Title, Artist, Album, Channels, and Sample Rate) directly into the container.
* **Native Web Player (`fmp_player.js`):** An optimized script utilizing the `Web Audio API` for local binary streaming and direct decoding, free from distortion or popping sounds.
* **Python Encoder (`fmp_encoder.py`):** A fast and efficient CLI script to package `.wav` files into `.fmp` format with support for custom metadata.

---

## 📂 Project Structure

```text
FMP-Audio-Library/
│
├── src/
│   └── fmp_encoder.py    # Python script to compile WAV to FMP with metadata
├── web/
│   └── fmp_player.js     # Web player optimized for the Audio API
└── README.md
```
---

# 🛠️ Using the Encoder (Python)
To package a WAV audio file into a custom .fmp container along with its metadata, run the following command in your terminal:

Bash
python src/fmp_encoder.py your_track.wav output.fmp "Track Name" "Your Name / Alias"

---

# 🎧 Using the Web Player (JavaScript)
Integrate the player into your web project by importing and calling the main function from your script:

JavaScript
// Loads and plays the .FMP file in the browser
loadAndPlayFMP('../salida.fmp');

---

# 📄 .FMP Container Specification
The binary format is structured as follows:

- Magic Number (4 bytes): Fixed identifier FMPS.

- Flags (2 bytes): Configuration flags (e.g., 0x0010 for stereo).

- Sample Rate (4 bytes): Sample rate in Hz (e.g., 44100).

- Total Frames (4 bytes): Total number of audio frames.

- Meta Length (2 bytes): Size in bytes of the JSON metadata block, aligned to an even number.

- Metadata (Meta Length bytes): Flat JSON object in UTF-8 encoding.

- PCM Payload (Remainder of the file): Raw audio data in 16-bit Int16Array format.

---

# 👤 Autor

**Developed by [AlxnDevX, Inc](https://www.github.com/AlxnDevTD)**
```text
The Project Is In Development Status
