music-metadata 7.11.7 → 7.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/LICENSE.txt +9 -0
  2. package/README.md +434 -432
  3. package/lib/ParserFactory.d.ts +48 -49
  4. package/lib/ParserFactory.js +252 -251
  5. package/lib/aiff/AiffParser.d.ts +14 -15
  6. package/lib/aiff/AiffParser.js +84 -85
  7. package/lib/aiff/AiffToken.d.ts +22 -22
  8. package/lib/aiff/AiffToken.js +43 -43
  9. package/lib/apev2/APEv2Parser.d.ts +30 -30
  10. package/lib/apev2/APEv2Parser.js +161 -162
  11. package/lib/apev2/APEv2TagMapper.d.ts +4 -4
  12. package/lib/apev2/APEv2TagMapper.js +86 -86
  13. package/lib/apev2/APEv2Token.d.ts +100 -100
  14. package/lib/apev2/APEv2Token.js +126 -126
  15. package/lib/asf/AsfObject.d.ts +319 -319
  16. package/lib/asf/AsfObject.js +384 -384
  17. package/lib/asf/AsfParser.d.ts +17 -17
  18. package/lib/asf/AsfParser.js +135 -135
  19. package/lib/asf/AsfTagMapper.d.ts +7 -7
  20. package/lib/asf/AsfTagMapper.js +95 -95
  21. package/lib/asf/AsfUtil.d.ts +13 -13
  22. package/lib/asf/AsfUtil.js +40 -40
  23. package/lib/asf/GUID.d.ts +84 -86
  24. package/lib/asf/GUID.js +121 -123
  25. package/lib/common/BasicParser.d.ts +17 -17
  26. package/lib/common/BasicParser.js +18 -18
  27. package/lib/common/CaseInsensitiveTagMap.d.ts +10 -10
  28. package/lib/common/CaseInsensitiveTagMap.js +21 -21
  29. package/lib/common/CombinedTagMapper.d.ts +19 -19
  30. package/lib/common/CombinedTagMapper.js +51 -51
  31. package/lib/common/FourCC.d.ts +6 -6
  32. package/lib/common/FourCC.js +28 -28
  33. package/lib/common/GenericTagMapper.d.ts +51 -51
  34. package/lib/common/GenericTagMapper.js +55 -55
  35. package/lib/common/GenericTagTypes.d.ts +33 -33
  36. package/lib/common/GenericTagTypes.js +131 -131
  37. package/lib/common/MetadataCollector.d.ts +76 -76
  38. package/lib/common/MetadataCollector.js +275 -275
  39. package/lib/common/RandomFileReader.d.ts +22 -20
  40. package/lib/common/RandomFileReader.js +34 -37
  41. package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
  42. package/lib/common/RandomUint8ArrayReader.js +25 -25
  43. package/lib/common/Util.d.ts +57 -58
  44. package/lib/common/Util.js +157 -162
  45. package/lib/core.d.ts +48 -48
  46. package/lib/core.js +90 -90
  47. package/lib/dsdiff/DsdiffParser.d.ts +14 -14
  48. package/lib/dsdiff/DsdiffParser.js +143 -143
  49. package/lib/dsdiff/DsdiffToken.d.ts +9 -9
  50. package/lib/dsdiff/DsdiffToken.js +21 -21
  51. package/lib/dsf/DsfChunk.d.ts +86 -86
  52. package/lib/dsf/DsfChunk.js +54 -54
  53. package/lib/dsf/DsfParser.d.ts +9 -9
  54. package/lib/dsf/DsfParser.js +56 -56
  55. package/lib/flac/FlacParser.d.ts +28 -28
  56. package/lib/flac/FlacParser.js +175 -175
  57. package/lib/id3v1/ID3v1Parser.d.ts +13 -13
  58. package/lib/id3v1/ID3v1Parser.js +134 -134
  59. package/lib/id3v1/ID3v1TagMap.d.ts +4 -4
  60. package/lib/id3v1/ID3v1TagMap.js +22 -22
  61. package/lib/id3v2/AbstractID3Parser.d.ts +17 -17
  62. package/lib/id3v2/AbstractID3Parser.js +60 -60
  63. package/lib/id3v2/FrameParser.d.ts +32 -32
  64. package/lib/id3v2/FrameParser.js +329 -329
  65. package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
  66. package/lib/id3v2/ID3v22TagMapper.js +55 -55
  67. package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
  68. package/lib/id3v2/ID3v24TagMapper.js +193 -193
  69. package/lib/id3v2/ID3v2Parser.d.ts +29 -29
  70. package/lib/id3v2/ID3v2Parser.js +184 -194
  71. package/lib/id3v2/ID3v2Token.d.ts +73 -73
  72. package/lib/id3v2/ID3v2Token.js +106 -106
  73. package/lib/iff/index.d.ts +33 -33
  74. package/lib/iff/index.js +19 -19
  75. package/lib/index.d.ts +45 -45
  76. package/lib/index.js +74 -74
  77. package/lib/lyrics3/Lyrics3.d.ts +3 -3
  78. package/lib/lyrics3/Lyrics3.js +17 -17
  79. package/lib/matroska/MatroskaDtd.d.ts +8 -8
  80. package/lib/matroska/MatroskaDtd.js +279 -279
  81. package/lib/matroska/MatroskaParser.d.ts +37 -37
  82. package/lib/matroska/MatroskaParser.js +235 -235
  83. package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
  84. package/lib/matroska/MatroskaTagMapper.js +35 -35
  85. package/lib/matroska/types.d.ts +175 -175
  86. package/lib/matroska/types.js +33 -32
  87. package/lib/mp4/Atom.d.ts +16 -16
  88. package/lib/mp4/Atom.js +70 -70
  89. package/lib/mp4/AtomToken.d.ts +395 -395
  90. package/lib/mp4/AtomToken.js +406 -406
  91. package/lib/mp4/MP4Parser.d.ts +30 -30
  92. package/lib/mp4/MP4Parser.js +511 -511
  93. package/lib/mp4/MP4TagMapper.d.ts +5 -5
  94. package/lib/mp4/MP4TagMapper.js +115 -115
  95. package/lib/mpeg/ExtendedLameHeader.d.ts +27 -27
  96. package/lib/mpeg/ExtendedLameHeader.js +31 -31
  97. package/lib/mpeg/MpegParser.d.ts +49 -49
  98. package/lib/mpeg/MpegParser.js +524 -529
  99. package/lib/mpeg/ReplayGainDataFormat.d.ts +55 -55
  100. package/lib/mpeg/ReplayGainDataFormat.js +69 -69
  101. package/lib/mpeg/XingTag.d.ts +45 -45
  102. package/lib/mpeg/XingTag.js +69 -69
  103. package/lib/musepack/index.d.ts +5 -5
  104. package/lib/musepack/index.js +32 -32
  105. package/lib/musepack/sv7/BitReader.d.ts +13 -13
  106. package/lib/musepack/sv7/BitReader.js +54 -54
  107. package/lib/musepack/sv7/MpcSv7Parser.d.ts +8 -8
  108. package/lib/musepack/sv7/MpcSv7Parser.js +46 -46
  109. package/lib/musepack/sv7/StreamVersion7.d.ts +28 -28
  110. package/lib/musepack/sv7/StreamVersion7.js +41 -41
  111. package/lib/musepack/sv8/MpcSv8Parser.d.ts +6 -6
  112. package/lib/musepack/sv8/MpcSv8Parser.js +55 -55
  113. package/lib/musepack/sv8/StreamVersion8.d.ts +40 -40
  114. package/lib/musepack/sv8/StreamVersion8.js +80 -80
  115. package/lib/ogg/Ogg.d.ts +72 -72
  116. package/lib/ogg/Ogg.js +2 -2
  117. package/lib/ogg/OggParser.d.ts +23 -23
  118. package/lib/ogg/OggParser.js +126 -126
  119. package/lib/ogg/opus/Opus.d.ts +48 -48
  120. package/lib/ogg/opus/Opus.js +28 -28
  121. package/lib/ogg/opus/OpusParser.d.ts +25 -25
  122. package/lib/ogg/opus/OpusParser.js +56 -56
  123. package/lib/ogg/speex/Speex.d.ts +36 -36
  124. package/lib/ogg/speex/Speex.js +31 -31
  125. package/lib/ogg/speex/SpeexParser.d.ts +22 -22
  126. package/lib/ogg/speex/SpeexParser.js +35 -35
  127. package/lib/ogg/theora/Theora.d.ts +20 -20
  128. package/lib/ogg/theora/Theora.js +23 -23
  129. package/lib/ogg/theora/TheoraParser.d.ts +28 -28
  130. package/lib/ogg/theora/TheoraParser.js +44 -44
  131. package/lib/ogg/vorbis/Vorbis.d.ts +69 -79
  132. package/lib/ogg/vorbis/Vorbis.js +78 -78
  133. package/lib/ogg/vorbis/VorbisDecoder.d.ts +12 -12
  134. package/lib/ogg/vorbis/VorbisDecoder.js +32 -32
  135. package/lib/ogg/vorbis/VorbisParser.d.ts +36 -36
  136. package/lib/ogg/vorbis/VorbisParser.js +128 -128
  137. package/lib/ogg/vorbis/VorbisTagMapper.d.ts +7 -7
  138. package/lib/ogg/vorbis/VorbisTagMapper.js +132 -132
  139. package/lib/riff/RiffChunk.d.ts +16 -16
  140. package/lib/riff/RiffChunk.js +32 -32
  141. package/lib/riff/RiffInfoTagMap.d.ts +10 -10
  142. package/lib/riff/RiffInfoTagMap.js +37 -37
  143. package/lib/type.d.ts +592 -599
  144. package/lib/type.js +5 -13
  145. package/lib/wav/BwfChunk.d.ts +17 -0
  146. package/lib/wav/BwfChunk.js +28 -0
  147. package/lib/wav/WaveChunk.d.ts +64 -64
  148. package/lib/wav/WaveChunk.js +65 -65
  149. package/lib/wav/WaveParser.d.ts +24 -24
  150. package/lib/wav/WaveParser.js +156 -144
  151. package/lib/wavpack/WavPackParser.d.ts +14 -14
  152. package/lib/wavpack/WavPackParser.js +99 -105
  153. package/lib/wavpack/WavPackToken.d.ts +64 -64
  154. package/lib/wavpack/WavPackToken.js +76 -76
  155. package/package.json +150 -142
package/lib/type.d.ts CHANGED
@@ -1,599 +1,592 @@
1
- /// <reference types="node" />
2
- import { GenericTagId, TagType } from './common/GenericTagTypes';
3
- import { IFooter } from './apev2/APEv2Token';
4
- /**
5
- * Attached picture, typically used for cover art
6
- */
7
- export interface IPicture {
8
- /**
9
- * Image mime type
10
- */
11
- format: string;
12
- /**
13
- * Image data
14
- */
15
- data: Buffer;
16
- /**
17
- * Optional description
18
- */
19
- description?: string;
20
- /**
21
- * Picture type
22
- */
23
- type?: string;
24
- /**
25
- * File name
26
- */
27
- name?: string;
28
- }
29
- /**
30
- * Abstract interface to access rating information
31
- */
32
- export interface IRating {
33
- /**
34
- * Rating source, could be an e-mail address
35
- */
36
- source?: string;
37
- /**
38
- * Rating [0..1]
39
- */
40
- rating: number;
41
- }
42
- export interface ICommonTagsResult {
43
- track: {
44
- no: number | null;
45
- of: number | null;
46
- };
47
- disk: {
48
- no: number | null;
49
- of: number | null;
50
- };
51
- /**
52
- * Release year
53
- */
54
- year?: number;
55
- /**
56
- * Track title
57
- */
58
- title?: string;
59
- /**
60
- * Track, maybe several artists written in a single string.
61
- */
62
- artist?: string;
63
- /**
64
- * Track artists, aims to capture every artist in a different string.
65
- */
66
- artists?: string[];
67
- /**
68
- * Track album artists
69
- */
70
- albumartist?: string;
71
- /**
72
- * Album title
73
- */
74
- album?: string;
75
- /**
76
- * Release data
77
- */
78
- date?: string;
79
- /**
80
- * Original release date
81
- */
82
- originaldate?: string;
83
- /**
84
- * Original release yeat
85
- */
86
- originalyear?: number;
87
- /**
88
- * List of comments
89
- */
90
- comment?: string[];
91
- /**
92
- * Genre
93
- */
94
- genre?: string[];
95
- /**
96
- * Embedded album art
97
- */
98
- picture?: IPicture[];
99
- /**
100
- * Track composer
101
- */
102
- composer?: string[];
103
- /**
104
- * Lyrics
105
- */
106
- lyrics?: string[];
107
- /**
108
- * Album title, formatted for alphabetic ordering
109
- */
110
- albumsort?: string;
111
- /**
112
- * Track title, formatted for alphabetic ordering
113
- */
114
- titlesort?: string;
115
- /**
116
- * The canonical title of the work
117
- */
118
- work?: string;
119
- /**
120
- * Track artist, formatted for alphabetic ordering
121
- */
122
- artistsort?: string;
123
- /**
124
- * Album artist, formatted for alphabetic ordering
125
- */
126
- albumartistsort?: string;
127
- /**
128
- * Composer, formatted for alphabetic ordering
129
- */
130
- composersort?: string;
131
- /**
132
- * Lyricist(s)
133
- */
134
- lyricist?: string[];
135
- /**
136
- * Writer(s)
137
- */
138
- writer?: string[];
139
- /**
140
- * Conductor(s)
141
- */
142
- conductor?: string[];
143
- /**
144
- * Remixer(s)
145
- */
146
- remixer?: string[];
147
- /**
148
- * Arranger(s)
149
- */
150
- arranger?: string[];
151
- /**
152
- * Engineer(s)
153
- */
154
- engineer?: string[];
155
- /**
156
- * Producer(s)
157
- */
158
- producer?: string[];
159
- /**
160
- * Mix-DJ(s)
161
- */
162
- djmixer?: string[];
163
- /**
164
- * Mixed by
165
- */
166
- mixer?: string[];
167
- technician?: string[];
168
- label?: string[];
169
- grouping?: string;
170
- subtitle?: string[];
171
- description?: string[];
172
- longDescription?: string;
173
- discsubtitle?: string[];
174
- totaltracks?: string;
175
- totaldiscs?: string;
176
- movementTotal?: number;
177
- compilation?: boolean;
178
- rating?: IRating[];
179
- bpm?: number;
180
- /**
181
- * Keywords to reflect the mood of the audio, e.g. 'Romantic' or 'Sad'
182
- */
183
- mood?: string;
184
- /**
185
- * Release format, e.g. 'CD'
186
- */
187
- media?: string;
188
- /**
189
- * Release catalog number(s)
190
- */
191
- catalognumber?: string[];
192
- /**
193
- * TV show title
194
- */
195
- tvShow?: string;
196
- /**
197
- * TV show title, formatted for alphabetic ordering
198
- */
199
- tvShowSort?: string;
200
- /**
201
- * TV season title sequence number
202
- */
203
- tvSeason?: number;
204
- /**
205
- * TV Episode sequence number
206
- */
207
- tvEpisode?: number;
208
- /**
209
- * TV episode ID
210
- */
211
- tvEpisodeId?: string;
212
- /**
213
- * TV network
214
- */
215
- tvNetwork?: string;
216
- podcast?: boolean;
217
- podcasturl?: string;
218
- releasestatus?: string;
219
- releasetype?: string[];
220
- releasecountry?: string;
221
- script?: string;
222
- language?: string;
223
- copyright?: string;
224
- license?: string;
225
- encodedby?: string;
226
- encodersettings?: string;
227
- gapless?: boolean;
228
- barcode?: string;
229
- isrc?: string[];
230
- asin?: string;
231
- musicbrainz_recordingid?: string;
232
- musicbrainz_trackid?: string;
233
- musicbrainz_albumid?: string;
234
- musicbrainz_artistid?: string[];
235
- musicbrainz_albumartistid?: string[];
236
- musicbrainz_releasegroupid?: string;
237
- musicbrainz_workid?: string;
238
- musicbrainz_trmid?: string;
239
- musicbrainz_discid?: string;
240
- acoustid_id?: string;
241
- acoustid_fingerprint?: string;
242
- musicip_puid?: string;
243
- musicip_fingerprint?: string;
244
- website?: string;
245
- 'performer:instrument'?: string[];
246
- averageLevel?: number;
247
- peakLevel?: number;
248
- notes?: string[];
249
- originalalbum?: string;
250
- originalartist?: string;
251
- discogs_artist_id?: number[];
252
- discogs_release_id?: number;
253
- discogs_label_id?: number;
254
- discogs_master_release_id?: number;
255
- discogs_votes?: number;
256
- discogs_rating?: number;
257
- /**
258
- * Track gain ratio [0..1]
259
- */
260
- replaygain_track_gain_ratio?: number;
261
- /**
262
- * Track peak ratio [0..1]
263
- */
264
- replaygain_track_peak_ratio?: number;
265
- /**
266
- * Track gain ratio
267
- */
268
- replaygain_track_gain?: IRatio;
269
- /**
270
- * Track peak ratio
271
- */
272
- replaygain_track_peak?: IRatio;
273
- /**
274
- * Album gain ratio
275
- */
276
- replaygain_album_gain?: IRatio;
277
- /**
278
- * Album peak ratio
279
- */
280
- replaygain_album_peak?: IRatio;
281
- /**
282
- * minimum & maximum global gain values across a set of files scanned as an album
283
- */
284
- replaygain_undo?: {
285
- leftChannel: number;
286
- rightChannel: number;
287
- };
288
- /**
289
- * minimum & maximum global gain values across a set of files scanned as an album
290
- */
291
- replaygain_track_minmax?: number[];
292
- /**
293
- * The initial key of the music in the file, e.g. "A Minor".
294
- * Ref: https://docs.microsoft.com/en-us/windows/win32/wmformat/wm-initialkey
295
- */
296
- key?: string;
297
- /**
298
- * Podcast Category
299
- */
300
- category?: string[];
301
- /**
302
- * iTunes Video Quality
303
- *
304
- * 2: Full HD
305
- * 1: HD
306
- * 0: SD
307
- */
308
- hdVideo?: number;
309
- /**
310
- * Podcast Keywords
311
- */
312
- keywords?: string[];
313
- /**
314
- * Movement
315
- */
316
- movement?: string;
317
- /**
318
- * Movement Index/Total
319
- */
320
- movementIndex: {
321
- no?: number;
322
- of?: number;
323
- };
324
- /**
325
- * Podcast Identifier
326
- */
327
- podcastId?: string;
328
- /**
329
- * Show Movement
330
- */
331
- showMovement?: boolean;
332
- /**
333
- * iTunes Media Type
334
- *
335
- * 1: Normal
336
- * 2: Audiobook
337
- * 6: Music Video
338
- * 9: Movie
339
- * 10: TV Show
340
- * 11: Booklet
341
- * 14: Ringtone
342
- *
343
- * https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata#user-content-media-type-stik
344
- */
345
- stik?: number;
346
- }
347
- export interface IRatio {
348
- /**
349
- * [0..1]
350
- */
351
- ratio: number;
352
- /**
353
- * Decibel
354
- */
355
- dB: number;
356
- }
357
- export declare type FormatId = 'container' | 'duration' | 'bitrate' | 'sampleRate' | 'bitsPerSample' | 'codec' | 'tool' | 'codecProfile' | 'lossless' | 'numberOfChannels' | 'numberOfSamples' | 'audioMD5' | 'chapters' | 'modificationTime' | 'creationTime' | 'trackPeakLevel' | 'trackGain' | 'albumGain';
358
- export interface IAudioTrack {
359
- samplingFrequency?: number;
360
- outputSamplingFrequency?: number;
361
- channels?: number;
362
- channelPositions?: Buffer;
363
- bitDepth?: number;
364
- }
365
- export interface IVideoTrack {
366
- flagInterlaced?: boolean;
367
- stereoMode?: number;
368
- pixelWidth?: number;
369
- pixelHeight?: number;
370
- displayWidth?: number;
371
- displayHeight?: number;
372
- displayUnit?: number;
373
- aspectRatioType?: number;
374
- colourSpace?: Buffer;
375
- gammaValue?: number;
376
- }
377
- export declare enum TrackType {
378
- video = 1,
379
- audio = 2,
380
- complex = 3,
381
- logo = 4,
382
- subtitle = 17,
383
- button = 18,
384
- control = 32
385
- }
386
- export interface ITrackInfo {
387
- type?: TrackType;
388
- codecName?: string;
389
- codecSettings?: string;
390
- flagEnabled?: boolean;
391
- flagDefault?: boolean;
392
- flagLacing?: boolean;
393
- name?: string;
394
- language?: string;
395
- audio?: IAudioTrack;
396
- video?: IVideoTrack;
397
- }
398
- export interface IFormat {
399
- readonly trackInfo: ITrackInfo[];
400
- /**
401
- * E.g.: 'flac'
402
- */
403
- readonly container?: string;
404
- /**
405
- * List of tags found in parsed audio file
406
- */
407
- readonly tagTypes?: TagType[];
408
- /**
409
- * Duration in seconds
410
- */
411
- readonly duration?: number;
412
- /**
413
- * Number bits per second of encoded audio file
414
- */
415
- readonly bitrate?: number;
416
- /**
417
- * Sampling rate in Samples per second (S/s)
418
- */
419
- readonly sampleRate?: number;
420
- /**
421
- * Audio bit depth
422
- */
423
- readonly bitsPerSample?: number;
424
- /**
425
- * Encoder brand, e.g.: LAME3.99r
426
- */
427
- readonly tool?: string;
428
- /**
429
- * Encoder name / compressionType, e.g.: 'PCM', 'ITU-T G.711 mu-law'
430
- */
431
- readonly codec?: string;
432
- /**
433
- * Codec profile
434
- */
435
- readonly codecProfile?: string;
436
- readonly lossless?: boolean;
437
- /**
438
- * Number of audio channels
439
- */
440
- readonly numberOfChannels?: number;
441
- /**
442
- * Number of samples frames.
443
- * One sample contains all channels
444
- * The duration is: numberOfSamples / sampleRate
445
- */
446
- readonly numberOfSamples?: number;
447
- /**
448
- * 16-byte MD5 of raw audio
449
- */
450
- readonly audioMD5?: Buffer;
451
- /**
452
- * Chapters in audio stream
453
- */
454
- readonly chapters?: IChapter[];
455
- /**
456
- * Time file was created
457
- */
458
- readonly creationTime?: Date;
459
- /**
460
- * Time file was modified
461
- */
462
- readonly modificationTime?: Date;
463
- readonly trackGain?: number;
464
- readonly trackPeakLevel?: number;
465
- readonly albumGain?: number;
466
- }
467
- export interface ITag {
468
- id: string;
469
- value: any;
470
- }
471
- export interface IChapter {
472
- /**
473
- * Chapter title
474
- */
475
- title: string;
476
- /**
477
- * Audio offset in sample number, 0 is the first sample.
478
- * Duration offset is sampleOffset / format.sampleRate
479
- */
480
- sampleOffset: number;
481
- }
482
- /**
483
- * Flat list of tags
484
- */
485
- export interface INativeTags {
486
- [tagType: string]: ITag[];
487
- }
488
- /**
489
- * Tags ordered by tag-ID
490
- */
491
- export interface INativeTagDict {
492
- [tagId: string]: any[];
493
- }
494
- export interface INativeAudioMetadata {
495
- format: IFormat;
496
- native: INativeTags;
497
- quality: IQualityInformation;
498
- }
499
- export interface IQualityInformation {
500
- /**
501
- * Warnings
502
- */
503
- warnings: IParserWarning[];
504
- }
505
- export interface IParserWarning {
506
- message: string;
507
- }
508
- export interface IAudioMetadata extends INativeAudioMetadata {
509
- /**
510
- * Metadata, form independent interface
511
- */
512
- common: ICommonTagsResult;
513
- }
514
- /**
515
- * Corresponds with parser module name
516
- */
517
- export declare type ParserType = 'mpeg' | 'apev2' | 'mp4' | 'asf' | 'flac' | 'ogg' | 'aiff' | 'wavpack' | 'riff' | 'musepack' | 'dsf' | 'dsdiff' | 'adts' | 'matroska';
518
- export interface IOptions {
519
- /**
520
- * default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration.
521
- */
522
- duration?: boolean;
523
- /**
524
- * default: `false`, if set to `true`, it will skip parsing covers.
525
- */
526
- skipCovers?: boolean;
527
- /**
528
- * default: `false`, if set to `true`, it will not search all the entire track for additional headers.
529
- * Only recommenced to use in combination with streams.
530
- */
531
- skipPostHeaders?: boolean;
532
- /**
533
- * default: `false`, if set to `true`, it will include MP4 chapters
534
- */
535
- includeChapters?: boolean;
536
- /**
537
- * Set observer for async callbacks to common or format.
538
- */
539
- observer?: Observer;
540
- }
541
- export interface IApeHeader extends IOptions {
542
- /**
543
- * Offset of APE-header
544
- */
545
- offset: number;
546
- /**
547
- * APEv1 / APEv2 header offset
548
- */
549
- footer: IFooter;
550
- }
551
- export interface IPrivateOptions extends IOptions {
552
- apeHeader?: IApeHeader;
553
- }
554
- /**
555
- * Event definition send after each change to common/format metadata change to observer.
556
- */
557
- export interface IMetadataEvent {
558
- /**
559
- * Tag which has been updated.
560
- */
561
- tag: {
562
- /**
563
- * Either 'common' if it a generic tag event, or 'format' for format related updates
564
- */
565
- type: 'common' | 'format';
566
- /**
567
- * Tag id
568
- */
569
- id: GenericTagId | FormatId;
570
- /**
571
- * Tag value
572
- */
573
- value: any;
574
- };
575
- /**
576
- * Metadata model including the attached tag
577
- */
578
- metadata: IAudioMetadata;
579
- }
580
- export declare type Observer = (update: IMetadataEvent) => void;
581
- /**
582
- * Provides random data read access
583
- * Used read operations on file of buffers
584
- */
585
- export interface IRandomReader {
586
- /**
587
- * Total length of file or buffer
588
- */
589
- fileSize: number;
590
- /**
591
- * Read from a given position of an abstracted file or buffer.
592
- * @param buffer {Buffer} is the buffer that the data will be written to.
593
- * @param offset {number} is the offset in the buffer to start writing at.
594
- * @param length {number}is an integer specifying the number of bytes to read.
595
- * @param position {number} is an argument specifying where to begin reading from in the file.
596
- * @return {Promise<number>} bytes read
597
- */
598
- randomRead(buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
599
- }
1
+ /// <reference types="node" />
2
+ import { GenericTagId, TagType } from './common/GenericTagTypes';
3
+ import { IFooter } from './apev2/APEv2Token';
4
+ import { TrackType } from './matroska/types';
5
+ export { TrackType } from './matroska/types';
6
+ /**
7
+ * Attached picture, typically used for cover art
8
+ */
9
+ export interface IPicture {
10
+ /**
11
+ * Image mime type
12
+ */
13
+ format: string;
14
+ /**
15
+ * Image data
16
+ */
17
+ data: Buffer;
18
+ /**
19
+ * Optional description
20
+ */
21
+ description?: string;
22
+ /**
23
+ * Picture type
24
+ */
25
+ type?: string;
26
+ /**
27
+ * File name
28
+ */
29
+ name?: string;
30
+ }
31
+ /**
32
+ * Abstract interface to access rating information
33
+ */
34
+ export interface IRating {
35
+ /**
36
+ * Rating source, could be an e-mail address
37
+ */
38
+ source?: string;
39
+ /**
40
+ * Rating [0..1]
41
+ */
42
+ rating: number;
43
+ }
44
+ export interface ICommonTagsResult {
45
+ track: {
46
+ no: number | null;
47
+ of: number | null;
48
+ };
49
+ disk: {
50
+ no: number | null;
51
+ of: number | null;
52
+ };
53
+ /**
54
+ * Release year
55
+ */
56
+ year?: number;
57
+ /**
58
+ * Track title
59
+ */
60
+ title?: string;
61
+ /**
62
+ * Track, maybe several artists written in a single string.
63
+ */
64
+ artist?: string;
65
+ /**
66
+ * Track artists, aims to capture every artist in a different string.
67
+ */
68
+ artists?: string[];
69
+ /**
70
+ * Track album artists
71
+ */
72
+ albumartist?: string;
73
+ /**
74
+ * Album title
75
+ */
76
+ album?: string;
77
+ /**
78
+ * Release data
79
+ */
80
+ date?: string;
81
+ /**
82
+ * Original release date
83
+ */
84
+ originaldate?: string;
85
+ /**
86
+ * Original release yeat
87
+ */
88
+ originalyear?: number;
89
+ /**
90
+ * List of comments
91
+ */
92
+ comment?: string[];
93
+ /**
94
+ * Genre
95
+ */
96
+ genre?: string[];
97
+ /**
98
+ * Embedded album art
99
+ */
100
+ picture?: IPicture[];
101
+ /**
102
+ * Track composer
103
+ */
104
+ composer?: string[];
105
+ /**
106
+ * Lyrics
107
+ */
108
+ lyrics?: string[];
109
+ /**
110
+ * Album title, formatted for alphabetic ordering
111
+ */
112
+ albumsort?: string;
113
+ /**
114
+ * Track title, formatted for alphabetic ordering
115
+ */
116
+ titlesort?: string;
117
+ /**
118
+ * The canonical title of the work
119
+ */
120
+ work?: string;
121
+ /**
122
+ * Track artist, formatted for alphabetic ordering
123
+ */
124
+ artistsort?: string;
125
+ /**
126
+ * Album artist, formatted for alphabetic ordering
127
+ */
128
+ albumartistsort?: string;
129
+ /**
130
+ * Composer, formatted for alphabetic ordering
131
+ */
132
+ composersort?: string;
133
+ /**
134
+ * Lyricist(s)
135
+ */
136
+ lyricist?: string[];
137
+ /**
138
+ * Writer(s)
139
+ */
140
+ writer?: string[];
141
+ /**
142
+ * Conductor(s)
143
+ */
144
+ conductor?: string[];
145
+ /**
146
+ * Remixer(s)
147
+ */
148
+ remixer?: string[];
149
+ /**
150
+ * Arranger(s)
151
+ */
152
+ arranger?: string[];
153
+ /**
154
+ * Engineer(s)
155
+ */
156
+ engineer?: string[];
157
+ /**
158
+ * Producer(s)
159
+ */
160
+ producer?: string[];
161
+ /**
162
+ * Mix-DJ(s)
163
+ */
164
+ djmixer?: string[];
165
+ /**
166
+ * Mixed by
167
+ */
168
+ mixer?: string[];
169
+ technician?: string[];
170
+ label?: string[];
171
+ grouping?: string;
172
+ subtitle?: string[];
173
+ description?: string[];
174
+ longDescription?: string;
175
+ discsubtitle?: string[];
176
+ totaltracks?: string;
177
+ totaldiscs?: string;
178
+ movementTotal?: number;
179
+ compilation?: boolean;
180
+ rating?: IRating[];
181
+ bpm?: number;
182
+ /**
183
+ * Keywords to reflect the mood of the audio, e.g. 'Romantic' or 'Sad'
184
+ */
185
+ mood?: string;
186
+ /**
187
+ * Release format, e.g. 'CD'
188
+ */
189
+ media?: string;
190
+ /**
191
+ * Release catalog number(s)
192
+ */
193
+ catalognumber?: string[];
194
+ /**
195
+ * TV show title
196
+ */
197
+ tvShow?: string;
198
+ /**
199
+ * TV show title, formatted for alphabetic ordering
200
+ */
201
+ tvShowSort?: string;
202
+ /**
203
+ * TV season title sequence number
204
+ */
205
+ tvSeason?: number;
206
+ /**
207
+ * TV Episode sequence number
208
+ */
209
+ tvEpisode?: number;
210
+ /**
211
+ * TV episode ID
212
+ */
213
+ tvEpisodeId?: string;
214
+ /**
215
+ * TV network
216
+ */
217
+ tvNetwork?: string;
218
+ podcast?: boolean;
219
+ podcasturl?: string;
220
+ releasestatus?: string;
221
+ releasetype?: string[];
222
+ releasecountry?: string;
223
+ script?: string;
224
+ language?: string;
225
+ copyright?: string;
226
+ license?: string;
227
+ encodedby?: string;
228
+ encodersettings?: string;
229
+ gapless?: boolean;
230
+ barcode?: string;
231
+ isrc?: string[];
232
+ asin?: string;
233
+ musicbrainz_recordingid?: string;
234
+ musicbrainz_trackid?: string;
235
+ musicbrainz_albumid?: string;
236
+ musicbrainz_artistid?: string[];
237
+ musicbrainz_albumartistid?: string[];
238
+ musicbrainz_releasegroupid?: string;
239
+ musicbrainz_workid?: string;
240
+ musicbrainz_trmid?: string;
241
+ musicbrainz_discid?: string;
242
+ acoustid_id?: string;
243
+ acoustid_fingerprint?: string;
244
+ musicip_puid?: string;
245
+ musicip_fingerprint?: string;
246
+ website?: string;
247
+ 'performer:instrument'?: string[];
248
+ averageLevel?: number;
249
+ peakLevel?: number;
250
+ notes?: string[];
251
+ originalalbum?: string;
252
+ originalartist?: string;
253
+ discogs_artist_id?: number[];
254
+ discogs_release_id?: number;
255
+ discogs_label_id?: number;
256
+ discogs_master_release_id?: number;
257
+ discogs_votes?: number;
258
+ discogs_rating?: number;
259
+ /**
260
+ * Track gain ratio [0..1]
261
+ */
262
+ replaygain_track_gain_ratio?: number;
263
+ /**
264
+ * Track peak ratio [0..1]
265
+ */
266
+ replaygain_track_peak_ratio?: number;
267
+ /**
268
+ * Track gain ratio
269
+ */
270
+ replaygain_track_gain?: IRatio;
271
+ /**
272
+ * Track peak ratio
273
+ */
274
+ replaygain_track_peak?: IRatio;
275
+ /**
276
+ * Album gain ratio
277
+ */
278
+ replaygain_album_gain?: IRatio;
279
+ /**
280
+ * Album peak ratio
281
+ */
282
+ replaygain_album_peak?: IRatio;
283
+ /**
284
+ * minimum & maximum global gain values across a set of files scanned as an album
285
+ */
286
+ replaygain_undo?: {
287
+ leftChannel: number;
288
+ rightChannel: number;
289
+ };
290
+ /**
291
+ * minimum & maximum global gain values across a set of files scanned as an album
292
+ */
293
+ replaygain_track_minmax?: number[];
294
+ /**
295
+ * The initial key of the music in the file, e.g. "A Minor".
296
+ * Ref: https://docs.microsoft.com/en-us/windows/win32/wmformat/wm-initialkey
297
+ */
298
+ key?: string;
299
+ /**
300
+ * Podcast Category
301
+ */
302
+ category?: string[];
303
+ /**
304
+ * iTunes Video Quality
305
+ *
306
+ * 2: Full HD
307
+ * 1: HD
308
+ * 0: SD
309
+ */
310
+ hdVideo?: number;
311
+ /**
312
+ * Podcast Keywords
313
+ */
314
+ keywords?: string[];
315
+ /**
316
+ * Movement
317
+ */
318
+ movement?: string;
319
+ /**
320
+ * Movement Index/Total
321
+ */
322
+ movementIndex: {
323
+ no?: number;
324
+ of?: number;
325
+ };
326
+ /**
327
+ * Podcast Identifier
328
+ */
329
+ podcastId?: string;
330
+ /**
331
+ * Show Movement
332
+ */
333
+ showMovement?: boolean;
334
+ /**
335
+ * iTunes Media Type
336
+ *
337
+ * 1: Normal
338
+ * 2: Audiobook
339
+ * 6: Music Video
340
+ * 9: Movie
341
+ * 10: TV Show
342
+ * 11: Booklet
343
+ * 14: Ringtone
344
+ *
345
+ * https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata#user-content-media-type-stik
346
+ */
347
+ stik?: number;
348
+ }
349
+ export interface IRatio {
350
+ /**
351
+ * [0..1]
352
+ */
353
+ ratio: number;
354
+ /**
355
+ * Decibel
356
+ */
357
+ dB: number;
358
+ }
359
+ export declare type FormatId = 'container' | 'duration' | 'bitrate' | 'sampleRate' | 'bitsPerSample' | 'codec' | 'tool' | 'codecProfile' | 'lossless' | 'numberOfChannels' | 'numberOfSamples' | 'audioMD5' | 'chapters' | 'modificationTime' | 'creationTime' | 'trackPeakLevel' | 'trackGain' | 'albumGain';
360
+ export interface IAudioTrack {
361
+ samplingFrequency?: number;
362
+ outputSamplingFrequency?: number;
363
+ channels?: number;
364
+ channelPositions?: Buffer;
365
+ bitDepth?: number;
366
+ }
367
+ export interface IVideoTrack {
368
+ flagInterlaced?: boolean;
369
+ stereoMode?: number;
370
+ pixelWidth?: number;
371
+ pixelHeight?: number;
372
+ displayWidth?: number;
373
+ displayHeight?: number;
374
+ displayUnit?: number;
375
+ aspectRatioType?: number;
376
+ colourSpace?: Buffer;
377
+ gammaValue?: number;
378
+ }
379
+ export interface ITrackInfo {
380
+ type?: TrackType;
381
+ codecName?: string;
382
+ codecSettings?: string;
383
+ flagEnabled?: boolean;
384
+ flagDefault?: boolean;
385
+ flagLacing?: boolean;
386
+ name?: string;
387
+ language?: string;
388
+ audio?: IAudioTrack;
389
+ video?: IVideoTrack;
390
+ }
391
+ export interface IFormat {
392
+ readonly trackInfo: ITrackInfo[];
393
+ /**
394
+ * E.g.: 'flac'
395
+ */
396
+ readonly container?: string;
397
+ /**
398
+ * List of tags found in parsed audio file
399
+ */
400
+ readonly tagTypes?: TagType[];
401
+ /**
402
+ * Duration in seconds
403
+ */
404
+ readonly duration?: number;
405
+ /**
406
+ * Number bits per second of encoded audio file
407
+ */
408
+ readonly bitrate?: number;
409
+ /**
410
+ * Sampling rate in Samples per second (S/s)
411
+ */
412
+ readonly sampleRate?: number;
413
+ /**
414
+ * Audio bit depth
415
+ */
416
+ readonly bitsPerSample?: number;
417
+ /**
418
+ * Encoder brand, e.g.: LAME3.99r
419
+ */
420
+ readonly tool?: string;
421
+ /**
422
+ * Encoder name / compressionType, e.g.: 'PCM', 'ITU-T G.711 mu-law'
423
+ */
424
+ readonly codec?: string;
425
+ /**
426
+ * Codec profile
427
+ */
428
+ readonly codecProfile?: string;
429
+ readonly lossless?: boolean;
430
+ /**
431
+ * Number of audio channels
432
+ */
433
+ readonly numberOfChannels?: number;
434
+ /**
435
+ * Number of samples frames.
436
+ * One sample contains all channels
437
+ * The duration is: numberOfSamples / sampleRate
438
+ */
439
+ readonly numberOfSamples?: number;
440
+ /**
441
+ * 16-byte MD5 of raw audio
442
+ */
443
+ readonly audioMD5?: Buffer;
444
+ /**
445
+ * Chapters in audio stream
446
+ */
447
+ readonly chapters?: IChapter[];
448
+ /**
449
+ * Time file was created
450
+ */
451
+ readonly creationTime?: Date;
452
+ /**
453
+ * Time file was modified
454
+ */
455
+ readonly modificationTime?: Date;
456
+ readonly trackGain?: number;
457
+ readonly trackPeakLevel?: number;
458
+ readonly albumGain?: number;
459
+ }
460
+ export interface ITag {
461
+ id: string;
462
+ value: any;
463
+ }
464
+ export interface IChapter {
465
+ /**
466
+ * Chapter title
467
+ */
468
+ title: string;
469
+ /**
470
+ * Audio offset in sample number, 0 is the first sample.
471
+ * Duration offset is sampleOffset / format.sampleRate
472
+ */
473
+ sampleOffset: number;
474
+ }
475
+ /**
476
+ * Flat list of tags
477
+ */
478
+ export interface INativeTags {
479
+ [tagType: string]: ITag[];
480
+ }
481
+ /**
482
+ * Tags ordered by tag-ID
483
+ */
484
+ export interface INativeTagDict {
485
+ [tagId: string]: any[];
486
+ }
487
+ export interface INativeAudioMetadata {
488
+ format: IFormat;
489
+ native: INativeTags;
490
+ quality: IQualityInformation;
491
+ }
492
+ export interface IQualityInformation {
493
+ /**
494
+ * Warnings
495
+ */
496
+ warnings: IParserWarning[];
497
+ }
498
+ export interface IParserWarning {
499
+ message: string;
500
+ }
501
+ export interface IAudioMetadata extends INativeAudioMetadata {
502
+ /**
503
+ * Metadata, form independent interface
504
+ */
505
+ common: ICommonTagsResult;
506
+ }
507
+ /**
508
+ * Corresponds with parser module name
509
+ */
510
+ export declare type ParserType = 'mpeg' | 'apev2' | 'mp4' | 'asf' | 'flac' | 'ogg' | 'aiff' | 'wavpack' | 'riff' | 'musepack' | 'dsf' | 'dsdiff' | 'adts' | 'matroska';
511
+ export interface IOptions {
512
+ /**
513
+ * default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration.
514
+ */
515
+ duration?: boolean;
516
+ /**
517
+ * default: `false`, if set to `true`, it will skip parsing covers.
518
+ */
519
+ skipCovers?: boolean;
520
+ /**
521
+ * default: `false`, if set to `true`, it will not search all the entire track for additional headers.
522
+ * Only recommenced to use in combination with streams.
523
+ */
524
+ skipPostHeaders?: boolean;
525
+ /**
526
+ * default: `false`, if set to `true`, it will include MP4 chapters
527
+ */
528
+ includeChapters?: boolean;
529
+ /**
530
+ * Set observer for async callbacks to common or format.
531
+ */
532
+ observer?: Observer;
533
+ }
534
+ export interface IApeHeader extends IOptions {
535
+ /**
536
+ * Offset of APE-header
537
+ */
538
+ offset: number;
539
+ /**
540
+ * APEv1 / APEv2 header offset
541
+ */
542
+ footer: IFooter;
543
+ }
544
+ export interface IPrivateOptions extends IOptions {
545
+ apeHeader?: IApeHeader;
546
+ }
547
+ /**
548
+ * Event definition send after each change to common/format metadata change to observer.
549
+ */
550
+ export interface IMetadataEvent {
551
+ /**
552
+ * Tag which has been updated.
553
+ */
554
+ tag: {
555
+ /**
556
+ * Either 'common' if it a generic tag event, or 'format' for format related updates
557
+ */
558
+ type: 'common' | 'format';
559
+ /**
560
+ * Tag id
561
+ */
562
+ id: GenericTagId | FormatId;
563
+ /**
564
+ * Tag value
565
+ */
566
+ value: any;
567
+ };
568
+ /**
569
+ * Metadata model including the attached tag
570
+ */
571
+ metadata: IAudioMetadata;
572
+ }
573
+ export declare type Observer = (update: IMetadataEvent) => void;
574
+ /**
575
+ * Provides random data read access
576
+ * Used read operations on file of buffers
577
+ */
578
+ export interface IRandomReader {
579
+ /**
580
+ * Total length of file or buffer
581
+ */
582
+ fileSize: number;
583
+ /**
584
+ * Read from a given position of an abstracted file or buffer.
585
+ * @param buffer {Buffer} is the buffer that the data will be written to.
586
+ * @param offset {number} is the offset in the buffer to start writing at.
587
+ * @param length {number}is an integer specifying the number of bytes to read.
588
+ * @param position {number} is an argument specifying where to begin reading from in the file.
589
+ * @return {Promise<number>} bytes read
590
+ */
591
+ randomRead(buffer: Buffer, offset: number, length: number, position: number): Promise<number>;
592
+ }