/srv/irclogs.ubuntu.com/2013/08/12/#ubuntuone.txt

=== eu is now known as Guest24989
JamesTaitGood morning all, happy Youth Day! :-D08:44
=== karni_ is now known as karni
=== karni is now known as Guest5198
=== Guest5198 is now known as karni_
=== karni_ is now known as karni
=== wedgwood is now known as Guest52531
=== eu is now known as Guest74187
=== pedronis_ is now known as pedronis
=== Guest52531 is now known as wedgwood
aquariuso hai dobey :)14:25
dobeyhey14:25
aquariushow's it going?14:26
dobeyok14:26
dobeyyou?14:26
aquariusactually, pretty well, modulo annoyance that porting C to JS is harder than I was hoping it would be :)14:26
dobeyyou're rewriting some C code in JS?14:27
aquariusya. Echonest's song recogniser, echoprint, is open source, which is rather nice. But I don't want native code; I figured it'd be doable to port the recogniser to pure client-side JavaScript; then I could have something shazamish without compilation and cross-platform.14:28
aquarius(ignore, for the moment, how you get the song data *into* the browser; that's doable with the web audio API)14:28
aquariusI could use emscripten or something to compile the C to JS, but that seems massively overkill; it's just doing manipulation on arrays of numbers, so I thought I'd reimplement it in JS.14:29
aquarius(also, emscripten assumes you know a lot more about C than I do.)14:29
dobeyis there a C lib too? i thought it was C++14:29
aquariusC++, sorry14:30
aquariusthe recogniser has three stages: whiten, subband analysis, and creating the fingerprint. The first two stages were fine -- the meat of the code is practically unchanged between C and JS (as I say, it's just doing operations on a big array of numbers, even if that big array in C++ is actually a block of memory)14:30
aquariusthe third stage, fingerprinting... it's confusing me, 'cos the code does C-ish things like index into an array with a negative index...which is obviously fine in C, where it's all just pointers under the covers, but not at all fine in JS, where arrays are a real thing rather than just syntactic sugar for memory access.14:31
aquariusthat means I have to understand what the code's doing, not just blindly port it...and that's hard. Or it's hard for me, anyway :)14:31
dobeyuh, negative index in C is not fine14:33
aquariusdobey, I invite you to consider https://github.com/echonest/echoprint-codegen/blob/master/src/Fingerprint.cxx#L11514:33
dobeyaquarius: negative index in C results in undefined behavior14:34
aquariusj loops from 0 up to SUBBANDS. k loops from 0 up to nbn. Thus, pE[j-SUBBANDS*k] is pE[ (a number smaller than SUBBANDS) - SUBBANDS * (a positive number) ].14:35
dobeya[-1] /may/ give you the last element of a[], but i don't think it is guaranteed to do so14:35
aquariusI can't see how that's anything other than negative?14:35
dobeyright. i didn't say that the code wasn't doing that. i said it's undefined. i also don't know what SUBBANDS is.14:36
aquariusdefined as 814:36
aquariusthis sort of thing is why I'm finding this difficult :)14:36
aquariusoriginally I was pinging you about the whole call-this-library-from-ctypes-so-I-can-write-a-test-suite thing14:38
dobeyright14:38
aquariusbut in the end you convinced me that that was either hard or impossible, so I just dropped a load of print statements into the executable and ran the executable and piped the output to a text file, and then parsed the text file from js to write the test suite :)14:39
dobeyhttp://stackoverflow.com/questions/4006736/c-negative-array-index14:40
dobeyi don't think c++ defines arrays differently, but it might14:40
aquariusright.14:43
dobeyso that code in echoprint is buggy14:43
aquariusI have tweeted at the echonest people to whine at them14:43
aquariusfor extra hilarity, JS appears to be treating floating point stuff with different precision than C++ does, but I have decided to ignore that for now -- the numbers come up pretty close to being the same, and I'm secretly hoping that that means that the fingerprints will be the same14:44
aquariusif it doesn't mean that, then I get to cry and go back and fix that, but that sounds like major hassle :)14:44
dobeyoh yeah, floating point. fun times that14:45
dobeyyou're probably going to be crying :)14:45
aquariusright :)14:48
aquariusbut the fingerprint code is what's killing me right now. I was really hoping to not have to walk through it line-by-line by hand and understand it all :(14:49
aquariusall the variables being called stuff like Eb and pE is not helping, I have to say.14:49
dobeyi don't see any other way. especially given their variable names14:49
dobeyheh14:49
* aquarius grins14:49
dobeyI presume Eb is some sort of class though14:49
aquariustbh the goal was to have something shazamish on Ubuntu, but it's not clear to me whether the Touch browser will support modern stuff like the web audio API anyway; the Qt WebKit implementation is quite a way behind on this sort of thing14:50
aquariusmeaning that this little project is very rapidly approaching the tipover point away from "that'd be a fun little hack" into "the hell with this hard work, I have paid things to do" :)14:51
dobeyi suppose it wouldn't be terribly hard to write an echoprint app in C++ though14:51
dobeyaside from the fact that code is apparently buggy14:52
dobeydoes echoprint-codegen have a testsuite itself that's easy to run from "make test" or something?14:53
aquariushahahahahaha14:57
dobeywas afraid of that14:57
aquariusaquarius@faith:~/Programs/Others/echoprint/echoprint-codegen/src$ grep test *14:57
aquariusAudioStreamInput.cxx:        // Not an exhaustive list. ogg and rm could be added if tested.14:57
aquariusgrep: echoprint-codegen-ios: Is a directory14:57
aquariusno. :-)14:57
dobeyi got that much from the maniacal laughter14:58
aquariusit wouldn't be hard to write a C++ app -- just use the library14:59
aquariusbut I'm not interested in C++ :-)14:59
aquariussomeone else could do that, though15:00
aquariuselleomea wrote "eyrie" for the N9 a while back which does this, so that should be even easier to port.15:00
dobeya test suite would be nice though; then i could set up a daily build which runs the tests on arm, i386, and amd6415:02
=== eu is now known as Guest41424

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!