简体   繁体   中英

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. 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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