i dealing raw pcm audio data (the audio data of pcm file without header).
this data provided me in form of vector of double.
i pass data function, , function expects audio data in form of byte vector.
i tried
dim nbytes() byte = ndoubles.selectmany(function(d) bitconverter.getbytes(d)).toarray()
but wouldn't give expected results.
i guess have deal conversion manually, unsure how should done.
can help?
thank you.
since required format other function 16-bit, 48 khz, same source data, it's simple case of converting source array of short, serializing byte array.
the problem code suggest first step missed, serializes double array. however, can re-use second step. so, can like:
dim nshorts() short = new short(ndoubles.length - 1) {} = 0 ndoubles.length - 1 nshorts(i) = convert.toint16(ndoubles(i)) next dim nbytes() byte = nshorts.selectmany(function(s) bitconverter.getbytes(s)).toarray()
Comments
Post a Comment