Tagged: bitmap audio
November 21, 2017 at 5:16 pm #2102
how does one generate such a bitmap from TrueRNG output?
Also, would it be possible to create an audio file from this output
to output it in real time as an audio stream?
I tested with GPG key generation, it’s at least is 10 times faster with TrueRNG than without.
Also, great product, fast shipping! And your support on these forums is absolutely ON POINT.
So I’ll thank you extra for those who forgot to thank you in other threads for looking through source code to answer their questions! Thank you!
What an amazing and dedicated team you have at ubld.it!November 21, 2017 at 8:58 pm #2103
(OS: Debian)December 20, 2017 at 12:02 pm #2118
Sorry, I didn’t see this post until now.
Creating bitmaps can be done in various ways. Most programs that will accept RAW you just import as a raw file and describe it to the program, such as 8 bit mono (would be 1 byte per pixel) or raw rgb would be 3 bytes per pixel (in rgb format).
Photoshop, the gimp, these programs should work fine.
For the easy button you can just use imagemagick which is available on most Linux platforms.
First the image size; lets say we want a 640×480 image. Thats 640×480 bytes, now if we want it in rgb format, thats 640x480x3.
So using your calculator (or bc on the commandline)
you can do
echo “640x480x3″ | bc
The response is 921600
So we need 921600 bytes to make a 640×480 image in rgb format.
Capture using ‘dd’
dd if=/dev/TrueRNG of=/tmp/image.raw bs=921600 count=1 iflag=fullblock
(iflag=fullblock is important)
This will capture 921600 bytes in the file /tmp/image.raw
Now using ‘convert’ from imagemagick
convert -depth 8 -interlace plane -size 640×480 rgb:/tmp/image.raw /tmp/image.jpg
Now we have a 640×480 jpeg of random rgb values.
For audio you can do similar things like using the program audacity you can import the audio as raw, and specify how many channels and bit depth. Same as the image, if you wanted 16khz audio 2 channels, you need 16k*2 bytes per second of audio.
You can also do funny things like catting /dev/TrueRNG to /dev/audio or piping it into sox or aplay to play the audio. Sox will accept raw input and convert to wav files based on your parameters.
Hope this helpsDecember 31, 2017 at 9:37 pm #2123
Thanks very much for the comprehensive explanation. It should have occurred to me to try to import raw data into GIMP.
I can’t post an image here but it worked great.
here’s a different command I found which passes the random directly to an image.
rawtoppm -rgb 512 512 < /dev/random| pnmtopng > random$(date +%Y%m%d%H%M%S).pngMay 28, 2018 at 6:27 pm #2145
To create a B&W image of the same size:
rawtopgm 512 512 < /dev/random | pnmtopng > random.pngJanuary 20, 2019 at 7:19 pm #2231
In Windows, GIF (and other) files are defined not only by their extensions but by certain leading and trailing bytes.
Searching the web (“GIYF”)* for the correct bytes to add to the beginning and end of a filetype, adding those bytes where needed, and then changing the file’s extension, would be enough to created a picture file out of the raw data!
Hope this helps…
*(“GIYF”) = “Google Is Your Friend.”
You must be logged in to reply to this topic.