WAVE文件扩展了fmt块的一部分 [英] WAVE file extended part of fmt chunk

查看:366
本文介绍了WAVE文件扩展了fmt块的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WAVE文件,一个 wFormatTag 是3( WAVE_FORMAT_IEEE_FLOAT )。 Firefox对待 WAVE_FORMAT_IEEE_FLOAT WAVE_FORMAT_EXTENSIBLE 这样的文件,这意味着它希望 WAVE_FORMAT_IEEE_FLOAT 文件包含fmt块的扩展部分。

I have a WAVE file with a wFormatTag that is 3 (WAVE_FORMAT_IEEE_FLOAT). Firefox treats WAVE_FORMAT_IEEE_FLOAT files like WAVE_FORMAT_EXTENSIBLE, which means that it expects that a WAVE_FORMAT_IEEE_FLOAT file contains the extended part of the fmt chunk.

我的文件不包含fmt块的扩展部分,这在解码时会导致错误Firefox中的文件:传递给decodeAudioData的缓冲区包含无效解码的无效内容。

My file doesn't contain the extended part of the fmt chunk, which results in an error when decoding the file in Firefox: The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully.

这意味着我必须在字节40, SubFormat 在字节44。应该为这三个头字段添加什么信息?这个信息的含义是什么,如何以8-16-32位整数的形式添加?

This means I have to add wValidBitsPerSample at byte 38, dwChannelMask at byte 40 and SubFormat at byte 44. What information should I be adding for those three header fields? What is the meaning of this information and how can I add them in the form of 8-16-32bits integers?

感谢您的帮助:)。

这是我的文件的标题信息:

Here is the header information of my file:

console.log('ckID', String.fromCharCode(dataView.getUint8(0))); // R
console.log('ckID', String.fromCharCode(dataView.getUint8(1))); // I
console.log('ckID', String.fromCharCode(dataView.getUint8(2))); // F
console.log('ckID', String.fromCharCode(dataView.getUint8(3))); // F

console.log('cksize', dataView.getUint32(4, true)); // 65623058

console.log('WAVEID', String.fromCharCode(dataView.getUint8(8))); // W
console.log('WAVEID', String.fromCharCode(dataView.getUint8(9))); // A
console.log('WAVEID', String.fromCharCode(dataView.getUint8(10))); // V
console.log('WAVEID', String.fromCharCode(dataView.getUint8(11))); // E

console.log('ckID', String.fromCharCode(dataView.getUint8(12))); // f
console.log('ckID', String.fromCharCode(dataView.getUint8(13))); // m
console.log('ckID', String.fromCharCode(dataView.getUint8(14))); // t
console.log('ckID', String.fromCharCode(dataView.getUint8(15))); //

console.log('cksize', (dataView.getUint32(16, true))); // 16

console.log('wFormatTag', (dataView.getUint16(20, true))); // 3

console.log('nChannels', (dataView.getUint16(22, true))); // 2

console.log('nSamplesPerSec', (dataView.getUint32(24, true))); // 44100

console.log('nAvgBytesPerSec', (dataView.getUint32(28, true))); // 352800

console.log('nBlockAlign', (dataView.getUint16(32, true))); // 8

console.log('wBitsPerSample', (dataView.getUint16(34, true))); // 32

console.log('cbSize', (dataView.getUint16(36, true))); // 0

console.log('ckID', String.fromCharCode(dataView.getUint8(38))); // f
console.log('ckID', String.fromCharCode(dataView.getUint8(39))); // a
console.log('ckID', String.fromCharCode(dataView.getUint8(40))); // c
console.log('ckID', String.fromCharCode(dataView.getUint8(41))); // t

console.log('cksize', (dataView.getUint16(42, true))); // 4

console.log('dwSampleLength', (dataView.getUint16(46, true))); // 10876

console.log('ckID', String.fromCharCode(dataView.getUint8(50))); // d
console.log('ckID', String.fromCharCode(dataView.getUint8(51))); // a
console.log('ckID', String.fromCharCode(dataView.getUint8(52))); // t
console.log('ckID', String.fromCharCode(dataView.getUint8(53))); // a


推荐答案

根据 https://bugzilla.mozilla.org/show_bug.cgi?id=1349658 ,Firefox不支持float32 WAV文件。

According to https://bugzilla.mozilla.org/show_bug.cgi?id=1349658, Firefox doesn't support float32 WAV files.

这篇关于WAVE文件扩展了fmt块的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆