Questions tagged [arraybuffer]

ArrayBuffer is a Javascript data type used to represent a generic, fixed-length binary data buffer.

597 questions
14
votes
2 answers

Does interleaving in VBOs speed up performance when using VAOs

You usually get a speed up when you use interleaved VBOs instead of using multiple VBOs. Is this also valid when using VAOs? Because it's much more convenient to have a VBO for the positions, and one for the normals etc. And you can use one VBO in…
Merni
  • 2,842
  • 5
  • 36
  • 42
13
votes
2 answers

Extracting the song frequency of an mp3 file using HTML5 web audio API

I am using the HTML5 web audio API to analyse a song and create markers when the average sound frequency drops below a certain value. Using the existing AudioNode infrastructure, I managed to do this but the sound is analyzed only and only when the…
Preslav Rachev
  • 3,983
  • 6
  • 39
  • 63
12
votes
3 answers

How to convert a hexadecimal string of data to an ArrayBuffer in JavaScript

How do I convert the string 'AA5504B10000B5' to an ArrayBuffer?
lidong1665
  • 163
  • 1
  • 1
  • 6
12
votes
2 answers

How to pass custom class instances through Web-Workers?

Since Web-Worker JSON serialize data between threads, something like this doesn't work: worker.js function Animal() {} Animal.prototype.foobar = function() {} self.onmessage = function(e) { self.postMessage({animal: new Animal()}) …
11
votes
2 answers

javascript readAsArrayBuffer returns empty Array Buffer

I am trying to read a local file using the FileReader readAsArrayBuffer property. The read is success and in the "onload" callback, I see the Array Buffer object in reader.result. But the Array Buffer is just empty. The length is set, but not the…
Anand N
  • 380
  • 1
  • 4
  • 12
10
votes
2 answers

Convert AudioBuffer to ArrayBuffer / Blob for WAV Download

I'd like to convert an AudioBuffer to a Blob so that I can create an ObjectURL from it and then download the audio file. let rec = new Recorder(async(chunks) => { var blob = new Blob(chunks, { type: 'audio/mp3' }); var arrayBuffer =…
10
votes
3 answers

How to receive a byte array inside a JSON

I'm trying to receive a PDF from server that will be wrapped inside a JSON. If I am only sending a byte array of the pdf to the front-end, I can read it properly by setting responseType to arraybuffer, then I can download the PDF by: var blob = new…
user1294510
  • 419
  • 2
  • 4
  • 19
10
votes
2 answers

"RangeError: Invalid typed array length" for seemingly-valid inputs

I have the following snippet: new Uint16Array( arraybuffer, 0, 18108 ); I know that arraybuffer is an instance of ArrayBuffer, and that arraybuffer.byteLength is 31984. The content of the arraybuffer is a black box to me. Because the buffer's…
Don McCurdy
  • 10,975
  • 2
  • 37
  • 75
10
votes
2 answers

Get Byte Position during Upload Loop

I am working on a function that will write data to a remote server in chunks using a 3rd party API. Through some help on Stack Overflow I was able to accomplish this, where it is now working as expected. The problem is that I can only get a single…
user470760
10
votes
2 answers

How to decrypt an ArrayBuffer?

I've been trying to decrypt an ArrayBuffer object using CryptoJS, but so far it always returns a blank WordArray. The files (images) are encrypted in an iOS and Android app, sent to a server, and downloaded in this web app to be decrypted and…
jjv360
  • 4,120
  • 3
  • 23
  • 37
10
votes
1 answer

Javascript - get data out of ArrayBuffer?

I've got a drag and drop script that uses readAsArrayBuffer(). The length of the buffer is perfect, but I can't seem to figure out how to pull the data out of the buffer. Apparently I've got to make a DataView or an Uint8Array or something, then…
Ben
  • 54,723
  • 49
  • 178
  • 224
9
votes
2 answers

Using emscripten how to get C++ uint8_t array to JS Blob or UInt8Array

In emscripten C++, I have class MyClass { public: MyClass() {} std::shared_ptr> buffer; int getPtr() { return (int)(buffer->data()); } int getLength() { return buffer->size(); …
Glenn
  • 1,996
  • 2
  • 24
  • 32
9
votes
2 answers

How to send array buffer data along with string/json to NodeJS server

I need to send image data (read as array buffer) from client page, along with additional string/json information generated by page, to NodeJS server in one request. I need both parts to be processed in one request as further image processing by…
okram
  • 810
  • 3
  • 11
  • 17
9
votes
2 answers

How do I access the indices of an ArrayBuffer created from a Blob?

I do not consider myself a programmer, so I have found many, many answers to my questions by searching this site. I have been unable to figure this one out, though. Using Javascript (really the only language I can even attempt right now), I am…
Floydman
  • 111
  • 1
  • 1
  • 4
9
votes
2 answers

Uint16Array to Uint8Array

I have a basic question. Say I have a Uint16Array and I have number 4 in it. data_16=new Uint16Array([4]); Now I have a length 1 and byteLength 2; how do i convert this to Uint8Array. I do not want to create a new view. data_8 = new…
Evren Bingøl
  • 1,306
  • 1
  • 20
  • 32
1 2
3
39 40