I'm working in Meteor.js with the recorderJs library, and trying to store stereo audio buffers to MongoDB.
On the client, console.log(buffers)
gives an array of the form
[Float32Array, Float32Array]
But after passing it to Meteor.methods with Meteor.call('newSound', buffers)
with the method
Meteor.methods({
newSound: function(buffers) {
console.log(buffers);
}
}
I get an array like this:
[Object, Object]
Why is Meteor converting the arrays to objects? Upon retrieval, I need to work with the data as array buffers, and can re-convert them with
var buffers = new Array(
_.toArray(buffers[0]),
_.toArray(buffers[1])
);
but I'm concerned about performance. Should I be converting the buffers to blobs before storing them to the database, then reconverting when I retrieve them?