Audio to Image Conversion
Show older comments
Hello Friends, I keep getting errors with this code...please help me out...
%% Audio to Image
infilename = 'audio1.wav';
outfile = 'drums.jpg';
fid = fopen(infilename, 'r');
bytes = fread(fid, [1 inf], '*uint8');
fclose(fid);
numbytes = length(bytes);
f = factor(numbytes);
n = f(end);
m = numbytes/n;
img = reshape(bytes, n, m);
imwrite(img, outfile, 'mode', 'lossless', 'bitdepth', 12);
imshow(outfile)
The error I get is this
Error using matlab.internal.imagesci.wjpg12c
JPEG library error (12 bit), "Maximum supported image dimension is 65500 pixels".
Error in writejpg (line 127)
matlab.internal.imagesci.wjpg12c(data, filename, props);
Error in imwrite (line 566)
feval(fmt_s.write, data, map, filename, paramPairs{:});
Error in learningAudio (line 31)
imwrite(img, outfile, 'mode', 'lossless', 'bitdepth', 12);
I honestly don't know what to do next
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!