8000 Add audio track NIP by staab · Pull Request #1043 · nostr-protocol/nips · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add audio track NIP #1043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions 0a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
NIP-0a
======

Audio Events
---------------

`draft` `optional`

This NIP defines several new event kinds representing different types of audio track. These events
are _parameterized replaceable_ as defined in [NIP-01](./01.md) and deletable per [NIP-09](09.md).
Comment on lines +9 to +10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being replaceable events, I assume there is no way to change the pubkey (author) of future events, since replaceable events are dependent on the original event's pubkey.

I'm thinking through the problematic scenario of publishing audio tracks under a general Music Feed pubkey, and later supporting an Artist's ability to self-publish their audio tracks using their own pubkey, if/when they are onboarded to nostr and take custody of their own private key.

I suppose the older audio track event can be deleted when this happens, leaving the new Artist's self-published event? In this case, should the d tag be re-used or randomly re-generated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, in that scenario you'd probably want to just delete the events and publish new ones. D tag persistence shouldn't matter because the pubkey would be changing anyhow.


Unlike a `kind 1` event with audio attached, audio events are intended to be surfaced in an audio-specific context
rather than in a general micro-blogging context.

The following kinds are defined by this NIP:

- `31337` represents a music track
- `31338` represents a podcast episode

The following tags are required:

- `d` is a unique identifier randomly generated by the client.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the publishing client will randomly generate the d tag? Can the GUID in the optional i tag be used here as the d tag value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be random. Meaningful d-tags are an antipattern, since you can't really anticipate when something might change, even guids.

- `media` is the url of the media. This SHOULD NOT be read, but is required for backwards compatibility reasons.
- `imeta` is as described in [NIP 92](./92.md). Multiple `imeta` tags MAY be included to provide for different
use cases (e.g. streaming vs download).
- `title` is the title of the audio track
- `subject` is the title of the audio track (deprecated, but required for compatibility)

The following tags are optional:

- `i` is an external GUID in the format defined [here](https://github.com/MerryOscar/nips/commit/280eb498e0ac56b8f9356c1b7a88cc8b31579801).
- `c` is the track's value as defined by a given category.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems too vague. Also, the category should definitely be the mark:

["c", "genre", "Pop"]

not

["c", "Pop", "genre"] <<< this is backwards compared to most other tags :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • genre
  • subgenre
  • artist
  • record_label
  • producer

what other fields should be expected?

  • composer
  • album
  • track_number
  • tracks
  • bpm
  • year

https://images.prismic.io/soundcharts/868e0bf5c60017040f5ca7b84ca94ee1606204d5_macos-itunes-edit-metadata-how-to-2.jpg?auto=compress,format

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://soundcharts.com/blog/music-metadata might provide helpful insight on doing this right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["c", "Pop", "genre"] <<< this is backwards compared to most other tags :(

This looks backward, but like with NIP 32 the intention is to be able to index the value, rather than the key. It's more important to be able to filter by category values (e.g. #c: ["Pop"]) than to filter by what categories are defined.

Also added a list of categories to the NIP.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more important to be able to filter by category values (e.g. #c: ["Pop"]) than to filter by what categories are defined.

That's a good point. Too bad this makes the event.getMatchingTags function in NDK totally useless for parsing these audio events, but I can implement my own tag parsing.

Thanks for adding those categories.

- `website` is an external url to a website related to the track.
- `duration` is the duration of the audio track, in seconds.
- `published_at` is a timestamp representing the track's original publish date.

Expected categories may include (but are not limited to):

- `genre`
- `subgenre`
- `artist`
- `record_label`
- `producer`
- `composer`
- `album`
- `track_number`
- `tracks`
- `bpm`
- `year`

Note that artists, producers, SHOULD be referred to using both a plaintext `c` tag AND a conventional `p` tag when pubkey is available. When doing so, the `p` tag's petname MUST be the same as the `c` tag's value. In this way `c` tags can be used to indicate genre, as well as artist, producer, etc.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the consequences of a p tag's petname not matching a c tag's value?

If a pubkey updates their petname, must these audio tracks be replaced with an updated version to reflect the new petname to avoid a mismatch of p and c tags?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Petnames are arbitrary, and aren't assigned by the pubkey owner. If they don't match, then clients would have to treat the c tag as an arbitrary string and the p tag as a normal mention.


If included, `genre` and `subgenre` SHOULD be based on [this list](https://github.com/wavlake/genre-list).

`content` SHOULD be summary or description of the audio content.

Example:

```json
{
"id": <event_id>,
"pubkey": <author_pubkey>,
"created_at": <created_at>,
"kind": 31337,
"content": "Chill beats",
"tags": [
["d", "<id>"],
["c", "Pop", "genre"],
["c", "EDM", "subgenre"],
["c", "Columbia Records", "record_label"],
["c", "AC/DC", "artist"],
["i", "podcast:item:guid:123", "https://fountain.fm/episode/30uEXC25615Ze2ELjY2p"],
["p", "2a07724d42fd8004b5c97b62ba03b6baf3919f9e8211667039987866997e97ad", "wss://my-relay.com", "AC/DC"],
["title", "Platinum Robots on the Moon"],
["subject", "Platinum Robots on the Moon"],
["published_at", "<published_at>"],
["imeta", "url https://example.com/my-track.m3u8", "x <hash>", ...]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staab I'd like to include the podcast artwork as well as the individual episode artwork. What would be an example of how to include track artwork and podcast artwork and distinguish meaningfully between them so the client knows which is which?

For example, when looking up a podcast episode via Podcastindex API, they provide an image for the episode and the podcast image as well. Sometimes they are the same if the podcast does not have unique artwork per episode, but they can be different.

Would we differentiate this using summary or alt from NIP-94? (Seems a little messy)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that matter, how do we indicate streaming vs download using an imeta tag?

Multiple imeta tags MAY be included to provide for different use cases (e.g. streaming vs download).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If necessary, we could add an attribute to imeta, something like content disposition, e.g. ["imeta", "url https://example.com/cover.png", "x <hash>", "disposition cover"]. For streaming vs download we could do the same thing, but in the near term I think it'll be clear enough which url to use for what, m3u8 is suitable for streaming, mp4 for download for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me

]
}
```
2 changes: 2 additions & 0 deletions 51.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Aside from their main identifier, the `"d"` tag, sets can optionally have a `"ti
| Kind mute sets | 30007 | mute pubkeys by kinds<br>`"d"` tag MUST be the kind string | `"p"` (pubkeys) |
| Interest sets | 30015 | interest topics represented by a bunch of "hashtags" | `"t"` (hashtags) |
| Emoji sets | 30030 | categorized emoji groups | `"emoji"` (see [NIP-30](30.md)) |
| Music Playlist | 30037 | a list of kind `31337` music tracks | `"a"` (kind:31337 music tracks) |
| Podcast Playlist | 30038 | a list of kind `31338` podcast episodes | `"a"` (kind:31338 podcast episodes) |
| Release artifact sets | 30063 | groups of files of a software release | `"e"` (kind:1063 [file metadata](94.md) events), `"i"` (application identifier, typically reverse domain notation), `"version"` |

## Deprecated standard lists
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
- [NIP-07: `window.nostr` capability for web browsers](07.md)
- [NIP-08: Handling Mentions](08.md) --- **unrecommended**: deprecated in favor of [NIP-27](27.md)
- [NIP-09: Event Deletion Request](09.md)
- [NIP-0a: Audio Tracks](0a.md)
- [NIP-10: Conventions for clients' use of `e` and `p` tags in text events](10.md)
- [NIP-11: Relay Information Document](11.md)
- [NIP-13: Proof of Work](13.md)
Expand Down Expand Up @@ -198,6 +199,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `30618` | Repository state announcements | [34](34.md) |
| `30818` | Wiki article | [54](54.md) |
| `30819` | Redirects | [54](54.md) |
| `31337` | Music Track | [0a](0a.md) |
| `31338` | Podcast Episode | [0a](0a.md) |
| `31388` | Link Set | [Corny Chat][cornychat-linkset] |
| `31890` | Feed | [NUD: Custom Feeds][NUD: Custom Feeds] |
| `31922` | Date-Based Calendar Event | [52](52.md) |
Expand Down
0