music-metadata 8.0.0 → 8.0.1

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