music-metadata 7.12.3 → 7.12.4

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 -9
  2. package/README.md +434 -434
  3. package/lib/ParserFactory.d.ts +48 -48
  4. package/lib/ParserFactory.js +252 -252
  5. package/lib/aiff/AiffParser.d.ts +14 -14
  6. package/lib/aiff/AiffParser.js +84 -84
  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 +164 -164
  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 +381 -381
  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 +38 -38
  23. package/lib/asf/GUID.d.ts +84 -84
  24. package/lib/asf/GUID.js +121 -121
  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 -22
  40. package/lib/common/RandomFileReader.js +34 -34
  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 -57
  44. package/lib/common/Util.js +157 -157
  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 +31 -31
  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 +28 -28
  70. package/lib/id3v2/ID3v2Parser.js +182 -182
  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 +32 -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 -524
  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 -69
  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 -592
  144. package/lib/type.js +5 -5
  145. package/lib/wav/BwfChunk.d.ts +17 -17
  146. package/lib/wav/BwfChunk.js +29 -28
  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 +158 -156
  151. package/lib/wavpack/WavPackParser.d.ts +14 -14
  152. package/lib/wavpack/WavPackParser.js +99 -99
  153. package/lib/wavpack/WavPackToken.d.ts +64 -64
  154. package/lib/wavpack/WavPackToken.js +76 -76
  155. package/package.json +150 -150
package/lib/type.d.ts CHANGED
@@ -1,592 +1,592 @@
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
- }
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
+ }