diff options
| author | Fabian <fabianfabian@gmail.com> | 2025-07-23 22:31:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-23 17:31:55 -0300 |
| commit | e50f37a527ace39cc3057827d52295c6b6de1112 (patch) | |
| tree | 45815aa9cf6a31ce1b17b5efef6c10f684821f33 /A0.md | |
| parent | 074b8eeb0194804ea7fa9d6e695c3d9e9c62e153 (diff) | |
NIP-A0: Voice Messages (#1984)
Diffstat (limited to 'A0.md')
| -rw-r--r-- | A0.md | 60 |
1 files changed, 60 insertions, 0 deletions
| @@ -0,0 +1,60 @@ | |||
| 1 | NIP-A0 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | Voice Messages | ||
| 5 | ----------- | ||
| 6 | |||
| 7 | **Status:** Draft | ||
| 8 | |||
| 9 | This NIP defines new events `kind: 1222` for root messages and `kind: 1244` for reply messages to be used for short voice messages, typically up to 60 seconds in length. | ||
| 10 | |||
| 11 | ## Specification | ||
| 12 | |||
| 13 | ### Event Kind `1222` and Kind `1244` | ||
| 14 | |||
| 15 | The `kind: 1222` event is defined as follows: | ||
| 16 | |||
| 17 | - `content`: MUST be a URL pointing directly to an audio file. | ||
| 18 | - The audio file SHOULD be in `audio/webm` format. Clients MAY support other common audio formats like `audio/ogg`, `audio/mp4` (m4a), or `audio/mpeg` (mp3), but `audio/webm` is recommended for broad compatibility and efficiency. | ||
| 19 | - The audio duration SHOULD be no longer than 60 seconds. Clients publishing `kind: 1222` events SHOULD enforce this limit or provide a clear warning to the user if exceeded. | ||
| 20 | - `tags`: | ||
| 21 | - Tags MAY be included as per other NIPs (e.g., `t` for hashtags, `g` for geohash, etc.). | ||
| 22 | |||
| 23 | The `kind: 1244` event is defined as follows: | ||
| 24 | |||
| 25 | - To be used for replies, `kind: 1244` events MUST follow the structure of `NIP-22`. | ||
| 26 | - `content`: MUST be a URL pointing directly to an audio file. | ||
| 27 | - The audio file SHOULD be in `audio/webm` format. Clients MAY support other common audio formats like `audio/ogg`, `audio/mp4` (m4a), or `audio/mpeg` (mp3), but `audio/webm` is recommended for broad compatibility and efficiency. | ||
| 28 | - The audio duration SHOULD be no longer than 60 seconds. Clients publishing `kind: 1222` events SHOULD enforce this limit or provide a clear warning to the user if exceeded. | ||
| 29 | - `tags`: | ||
| 30 | - Tags MAY be included as per other NIPs (e.g., `t` for hashtags, `g` for geohash, etc.). | ||
| 31 | |||
| 32 | |||
| 33 | ## Visual representation with `imeta` (NIP-92) tag (optional) | ||
| 34 | |||
| 35 | The following imeta (NIP-92) tags MAY be included so clients can render a visual preview without having to download the audio file first: | ||
| 36 | |||
| 37 | - `waveform`: amplitude values over time, space separated, less than 100 values should be enough to render a nice visual | ||
| 38 | - `duration`: audio length in seconds | ||
| 39 | |||
| 40 | ## Examples | ||
| 41 | |||
| 42 | ### Root Voice Message Example | ||
| 43 | |||
| 44 | ```json | ||
| 45 | { | ||
| 46 | "content": "https://blossom.primal.net/5fe7df0e46ee6b14b5a8b8b92939e84e3ca5e3950eb630299742325d5ed9891b.mp4", | ||
| 47 | "created_at": 1752501052, | ||
| 48 | "id": "...", | ||
| 49 | "kind": 1222, | ||
| 50 | "pubkey": "...", | ||
| 51 | "sig": "...", | ||
| 52 | "tags": [ | ||
| 53 | [ | ||
| 54 | "imeta", | ||
| 55 | "url https://blossom.primal.net/5fe7df0e46ee6b14b5a8b8b92939e84e3ca5e3950eb630299742325d5ed9891b.mp4", | ||
| 56 | "waveform 0 0.05 0.27 0.08 0.01 0.01 0.01 0.03 0.38 1.5 0.49 0.02 0.28 0.04 0.01 0 0 0.39 0.22 0.16 0.05 0.06 0.55 0.01 0.06 0.01 0 0 0.02 0.61 0.02 0.07 0.01 0.21 0.09 0.12 0.63 0.01 0.02 0.02 0.42 0.02 0.68 0.05 0.02 0.05 0.02 0 0 0 0", | ||
| 57 | "duration 8" | ||
| 58 | ] | ||
| 59 | ] | ||
| 60 | } \ No newline at end of file | ||