简体   繁体   English

录制音频..切断

[英]Recording audio .. cut off

Reluctantly, I am asking you guys here to help me overcome my brain freeze. 我很不情愿地请你们在这里帮助我克服大脑僵硬的情况。 I am recording audio but I have a problem with not being able to get the recorded audio without half of it missing. 我正在录制音频,但是我无法在不丢失一半的情况下获取录制的音频。

recAudioInput = recAudioContext.createMediaStreamSource(stream); 
recorder= recAudioContext.createScriptProcessor(theBufferSize, 2, 2); // (or 1,1, no difference)
recAudioInput.connect(recorder);
recorder.connect(recAudioContext.destination);

Recording for let's say 5 seconds and speaking 1 2 3 4 5 gives me about 200K of data containing 1 2 3 ... I will have to wait (and continue to record) the same amount of time (in this case 5 seconds) to get the rest. 假设录制了5秒钟,然后说出1 2 3 4 5,我得到了大约200K包含1 2 3的数据...我将不得不等待(并继续记录)相同的时间(在这种情况下为5秒钟)得到其余的。 Quite frankly, that doesn't seem right. 坦率地说,这似乎不正确。

But I don't see the error. 但是我看不到错误。 Shouldn't the inputbuffer return a total of about 400K of data per channel (44.1 * (16/8) * 5) after 5 seconds? 5秒钟后,输入缓冲区是否不应该为每个通道返回总计约400K的数据(44.1 *(16/8)* 5)?

Thanks for your help. 谢谢你的帮助。

Michaela 麦克拉

I am sorry. 对不起。 It was my own stupid mistake. 这是我自己的愚蠢错误。 I made a miscalculation of the expected wav file length which in turn lead to a shortened wav file missing a few seconds. 我对预期的wav文件长度进行了错误的计算,从而导致缩短的wav文件缺少几秒钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM