5 ms·
Oops, the artist's source code has a bug making the 233 DVDs contain not what he thinks they contain... All his source files [1][2][3] attempt to generate the r
by mrb 12y ago
Oops, the artist's source code has a bug making the 233 DVDs contain not what he thinks they contain... All his source files [1][2][3] attempt to generate the random noise with:
// basically no wimpy numbers - only fat ones
if (s > 0 & s < 30000) {s = (short) (s + 30000);}
if (s < 0 & s > -30000) {s = (short) (s - 30000);}
s is a Java 16-bit signed short initialized to a random value. His intent is apparently to modify s to generate sound samples in the ranges [-32768,-30000] and [30000,32767] to make the noise "harsh" (no samples close to 0). But because shorts wrap around the boundaries -32768 and 32767, most samples will in fact be in the range [5537,32767]. See for yourself: if s=5537, he adds 30000, s wraps to -29999, he subtracts 30000, s wraps again back to 5537. s will end up in the ranges [-32768,-30000], [0] and [5537,32767], making the noise less harsh than it should have been.
Damn I would hate to have to re-burn 233 DVDs, or this set of 510(!) he produced later: http://www.jliat.com/HNW510/index.html http://www.jliat.com/HNW510/index.html
This type of bug, an integer overflow, is one of the many types of bugs I look for when I review source code as part of my job in info sec.
[1] http://jliat.com/HNW/HNW.java http://jliat.com/HNW/HNW.java
[2] http://jliat.com/HNW/HNW90.java http://jliat.com/HNW/HNW90.java
[3] http://jliat.com/HNW/hnwfile.java http://jliat.com/HNW/hnwfile.java
- jewel 12y ago> ... I would hate to have to re-burn 233 DVDs... Burning 233 DVDs is easy if you have the right equipment. At my workplace we used to use units from rimage.com and now use units from microboards.com. The units have built-in inkjet printers so that each disc can have its own label. The software that will let you queue up lots of jobs at once. (You don't want a disk duplicator, those will typically burn you 10-at-once of the same image.)
- matachi 12y agoDid you notice that there aren't logical and in the if statements' expressions, but bitwise and? Wouldn't it result in something like `if (true & true) {...}` being evaluated, which seems weird?
- evilkrow 12y agoI sent this to jliat and he had this to say: "Oops indeed! but not me! :-) they have confused THREE! works. The 1 TB set of disks was not made using the Java code! but made from samples of Harsh noise.... as MP3 files = 1 TB - Harsh Noise not HNW! Each MP3 being made of random chunks of MP3s spliced together using a VBnet program. The other piece 510 disks is HNW but again not made using the JAVA code he refers to, and this uses .WAV files.... not .AU !!! (it layers randomly HNW noise to create a .WAV) Now as to the JAVA code - I wrote this must be 6 - 7 years ago as an exercise- but i've just run the program which creates the .AU file of HNW... max value in the file is +32729 minimum -32720... were found in a small chunk of the .AU file.... so? here is a sample of the .AU file actually produced by the code to which he refers... -12248 -30299 5627 -12218 6453 6684 6991 6832 6059 -30395 -30301 -30188 -30270 -12141 -30911 -32020 -32664 32208 Now i'm ready to admit i'm no JAVA expert...!!! which is why i use .Net! But this was an exercise in seeing how to make HNW using Java. It was never released as a piece. I used some code I found for making sine waves and plugged in my random algorithm... nothing smart. But it did work! Why it seems IDK. As a rule of thumb i tend to look at the output of any programs... Feel free to post this response as i'm not a member of the group, but would think as the code and program is there a simple test run would show its harsh. That my attempt to not use wimpy numbers doesnt seem to work as it should is besides the point. From memory i probably just tweaked these numbers until the results were harsh - that in the above data set (only a small number of samples above) gives a standard deviation of 29101.09796... http://www.jliat.com/pics/graph.JPG http://www.jliat.com/pics/graph.JPG If you look at this you can see a plot for the output of the JAVA HNW.... its high! I gave the source so anyone into JAVA could play with this... as i say its not a piece but a by-product on seeing how HNW / Noise has large Standard Deviation and low SNR and as one might expect produces HNW. The harshness being a product of sudden and large changes in values... In fact i like the fact that in spite of the (MY) mistake it still works - can you fail in noise? :-) best James P.S. The JAVA HNW is way too slow to make these big terrabyte files... it would take much longer to write them than they sound when played!!!"