我正在尝试使用fs.writeFile编写.wav文件.该文件已成功创建,但它只有8-13个字节长,所以很明显我没有做正确的事情.
如果blob已经是audio/wav,我可以写入磁盘还是需要将其转换为Base 64?
我在这里几乎不知所措,我找到了另一个没有答案的类似线程 - 这里
任何输入将不胜感激.
routerApp.controller('audiotest', function($scope) {
$scope.saveToDisk = function(){
var nw = require('nw.gui');
var fs = require('fs');
var path = require('path');
fs.writeFileSync('test.wav', $scope.recordedInput)
};
}
Run Code Online (Sandbox Code Playgroud)
console.log($scope.recordedInput) 回报 Blob {size: 294956, type: "audio/wav"}
这不是真的相关,但这是我的HTML
<div class="row" ng-controller="audiotest">
<div class="row">
<button type="button" ng-click="saveToDisk()"> Write this sucker to disk </button>
</div>
<ng-audio-recorder id='audioInput' audio-model='recordedInput'>
<!-- Start controls, exposed via recorder-->
<div ng-if="recorder.isAvailable">
<button ng-click="recorder.startRecord()" type="button" ng-disabled="recorder.status.isRecording">
Start Record
</button>
<button ng-click="recorder.stopRecord()" type="button" ng-disabled="recorder.status.isRecording === false">
Stop Record
</button>
</ng-audio-recorder> …Run Code Online (Sandbox Code Playgroud)