nips/A0.md

2.6 KiB

NIP-A0

Voice Messages

Status: Draft

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.

Specification

Event Kind 1222 and Kind 1244

The kind: 1222 event is defined as follows:

  • content: MUST be a URL pointing directly to an audio file.
    • 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.
    • 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.
  • tags:
    • Tags MAY be included as per other NIPs (e.g., t for hashtags, g for geohash, etc.).

The kind: 1244 event is defined as follows:

  • To be used for replies, kind: 1244 events MUST follow the structure of NIP-22.
  • content: MUST be a URL pointing directly to an audio file.
    • 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.
    • 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.
  • tags:
    • Tags MAY be included as per other NIPs (e.g., t for hashtags, g for geohash, etc.).

Visual representation with imeta (NIP-92) tag (optional)

The following imeta (NIP-92) tags MAY be included so clients can render a visual preview without having to download the audio file first:

  • waveform: amplitude values over time, space separated, less than 100 values should be enough to render a nice visual
  • duration: audio length in seconds

Examples

Root Voice Message Example

{
  "content": "https://blossom.primal.net/5fe7df0e46ee6b14b5a8b8b92939e84e3ca5e3950eb630299742325d5ed9891b.mp4",
  "created_at": 1752501052,
  "id": "...",
  "kind": 1222,
  "pubkey": "...",
  "sig": "...",
  "tags": [
    [
      "imeta",
      "url https://blossom.primal.net/5fe7df0e46ee6b14b5a8b8b92939e84e3ca5e3950eb630299742325d5ed9891b.mp4",
      "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",
      "duration 8"
    ]
  ]
}