MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / WavHeader

Function WavHeader

tensorflow/contrib/ffmpeg/default/ffmpeg_lib.cc:184–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184string WavHeader(int32 samples_per_second, int32 channel_count,
185 const std::vector<float>& samples) {
186 string header = "RIFF";
187 header += LittleEndianDataInt(36U + samples.size() * sizeof(int16));
188 header += "WAVEfmt ";
189 header += LittleEndianDataInt(16);
190 header += LittleEndianDataShort(1);
191 header += LittleEndianDataShort(channel_count);
192 header += LittleEndianDataInt(samples_per_second);
193 header +=
194 LittleEndianDataInt(samples_per_second * channel_count * sizeof(int16));
195 header += LittleEndianDataShort(channel_count * sizeof(int16));
196 header += LittleEndianDataShort(16);
197 header += "data";
198 header += LittleEndianDataInt(samples.size() * sizeof(int16));
199 CHECK_EQ(header.size(), 44);
200 return header;
201}
202
203// Creates the contents of a .wav file using pcm_s16le format (signed 16 bit
204// little endian integers).

Callers 1

BuildWavFileFunction · 0.85

Calls 3

LittleEndianDataIntFunction · 0.85
LittleEndianDataShortFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected