-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathWaveHeader.cs
More file actions
75 lines (62 loc) · 2.05 KB
/
Copy pathWaveHeader.cs
File metadata and controls
75 lines (62 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
namespace MusicalCSharp;
/// <summary>
/// Wave file header.
/// </summary>
internal readonly struct WaveHeader
{
/// <summary>
/// The magic string <c>"RIFF"</c> (UTF-8).
/// </summary>
public required WaveHeaderMagicString RiffMagicString { get; init; }
/// <summary>
/// The size of the file, minus 8.
/// </summary>
public required uint Size { get; init; }
/// <summary>
/// The magic string <c>"WAVE"</c> (UTF-8).
/// </summary>
public required WaveHeaderMagicString WaveMagicString { get; init; }
/// <summary>
/// The magic string <c>"fmt "</c> (UTF-8).
/// </summary>
public required WaveHeaderMagicString FormatMagicString { get; init; }
/// <summary>
/// The chunk size.
/// </summary>
public required uint ChunkSize { get; init; }
/// <summary>
/// The format of the audio samples.
/// </summary>
public required AudioFormat Format { get; init; }
/// <summary>
/// The number of audio channels.
/// </summary>
public required AudioChannels Channels { get; init; }
/// <summary>
/// The sample rate.
/// </summary>
/// <remarks>
/// Prefer using commonly known values (<c>8000</c>, <c>44100</c>, etc.), as unexpected values can result in invalid files.
/// </remarks>
public required uint SampleRate { get; init; }
/// <summary>
/// The number of bytes per second of audio.
/// </summary>
public required uint BytesPerSecond { get; init; }
/// <summary>
/// The number of bytes per block.
/// </summary>
public required ushort BytesPerBlock { get; init; }
/// <summary>
/// The number of bits per sample.
/// </summary>
public required ushort BitsPerSample { get; init; }
/// <summary>
/// The magic string <c>"data"</c> (UTF-8).
/// </summary>
public required WaveHeaderMagicString DataMagicString { get; init; }
/// <summary>
/// The total number of bytes worth of sample data.
/// </summary>
public required uint SamplesByteCount { get; init; }
}