• What Are You Working On? April 2015
    1,741 replies, posted
So I ran into a problem building sine waves. I'm 100% sure it's a math error. I'm trying to construct a 2400hz tone, and I have this: [code] for(int i = 0; i < BUFSIZE; i++){ //amplitude is 0.8 frequency is 2400hz mydata[i] = ((pow(2,15)-1) * 0.8) * sin(((i * (2*PI))/BUFSIZE) * 2400); } [/code] where BUFSIZE is 256 (as in 256 samples). But this amounts to a massive loss of information, and I'm not sure why... Here's a picture of the wave [img]http://i.imgur.com/TCosaN6.png[/img] From what I understand, (i * (2 * pi))/BUFSIZE should result in the range of 0 to pi, with a step of 1/256. how can I increase my precision to, say, 1/44100. I guess this is just really basic for-loop arithmetic but I can't exactly figure it out and oh my god as I'm typing this I realize i just have to divide by 44100 instead of BUFSIZE holy crap I'm retarded. Fixed code: [code] for(int i = 0; i < BUFSIZE; i++){ //amplitude is 0.8 frequency is 2400hz mydata[i] = ((pow(2,15)-1) * 0.8) * sin(((i * (2*PI))/44100) * 2400); } [/code] I'm posting this now just in case some googler later on has the same problem, even though I solved it before I even posted it.
[QUOTE=proboardslol;47545220]So I ran into a problem building sine waves. I'm 100% sure it's a math error. I'm trying to construct a 2400hz tone, and I have this: [code] for(int i = 0; i < BUFSIZE; i++){ //amplitude is 0.8 frequency is 2400hz mydata[i] = ((pow(2,15)-1) * 0.8) * sin(((i * (2*PI))/BUFSIZE) * 2400); } [/code] where BUFSIZE is 256 (as in 256 samples). But this amounts to a massive loss of information, and I'm not sure why... Here's a picture of the wave [img]http://i.imgur.com/TCosaN6.png[/img] From what I understand, (i * (2 * pi))/BUFSIZE should result in the range of 0 to pi, with a step of 1/256. how can I increase my precision to, say, 1/44100. I guess this is just really basic for-loop arithmetic but I can't exactly figure it out and oh my god as I'm typing this I realize i just have to divide by 44100 instead of BUFSIZE holy crap I'm retarded. Fixed code: [code] for(int i = 0; i < BUFSIZE; i++){ //amplitude is 0.8 frequency is 2400hz mydata[i] = ((pow(2,15)-1) * 0.8) * sin(((i * (2*PI))/44100) * 2400); } [/code] I'm posting this now just in case some googler later on has the same problem, even though I solved it before I even posted it.[/QUOTE] The power of [url=http://en.wikipedia.org/wiki/Rubber_duck_debugging]rubber duck debugging[/url] in action.
Alright so I've got the sample size down to 32. It's still distinguishable by the human eye, but I wonder if a tape deck will be able to accurately record it at the right rate so that the demodulator can tell the difference between a 1 or a 0. here's a sample: [img]http://i.imgur.com/Hs34qwl.png[/img] The fatter ones (ones that cross the x-axis twice) are zeros (1200hz). The skinnier ones (ones that cross the x-axis 4 times) are ones (2400hz). this format is ~1200 baud, or 1200 bits/s (150 bytes/sec, or 0.15kb/s). This, by the way, is the kansas city standard. I wonder if there's a theoretical limit to how much data can be represented by sound waves. I'm sure MY only limitation is the precision of my hardware in recording sounds.
[QUOTE=proboardslol;47545220]So I ran into a problem building sine waves. I'm 100% sure it's a math error. I'm trying to construct a 2400hz tone, and I have this: [code] for(int i = 0; i < BUFSIZE; i++){ //amplitude is 0.8 frequency is 2400hz mydata[i] = ((pow(2,15)-1) * 0.8) * sin(((i * (2*PI))/BUFSIZE) * 2400); } [/code] where BUFSIZE is 256 (as in 256 samples). But this amounts to a massive loss of information, and I'm not sure why... Here's a picture of the wave From what I understand, (i * (2 * pi))/BUFSIZE should result in the range of 0 to pi, with a step of 1/256. how can I increase my precision to, say, 1/44100. I guess this is just really basic for-loop arithmetic but I can't exactly figure it out and oh my god as I'm typing this I realize i just have to divide by 44100 instead of BUFSIZE holy crap I'm retarded. Fixed code: [code] for(int i = 0; i < BUFSIZE; i++){ //amplitude is 0.8 frequency is 2400hz mydata[i] = ((pow(2,15)-1) * 0.8) * sin(((i * (2*PI))/44100) * 2400); } [/code] I'm posting this now just in case some googler later on has the same problem, even though I solved it before I even posted it.[/QUOTE] It felt like I was there.
[img]http://i.imgur.com/4L3pG5n.png[/img] Yesterday, I shared with folks that I had been featured on [url=http://expo.getbootstrap.com/]Bootstrap Expo,[/url] and that Polkm will be doing stuff with Planimeter software. Today, I've been telling folks that I'm moving forward with submitting my sites to [url=http://www.awwwards.com/]Awwwards.[/url] I know this is web development-esque, but I look at it as a way of moving myself, my projects (which span far more than just web development), and those working with me forward. By the end of the year, I'd like us to develop a presence on Reddit, and LÖVE's forums. Maybe more, if I can think of other relevant channels. Maybe TIGSource. I'm very passionate about doing this, but the software backing the presence I want to develop isn't quite there yet. Grid tutorials still need to be written, and that will hopefully open floodgates to a formal alpha for Grid. I'm pretty slow, but I think I can get there, and certainly with help. Planimeter is now made up of 6 volunteer contributors and myself. 6 software developers, 1 of which is also a musician, and 1 who is a designer. I probably spam this a bit by now, so I'm sorry if I do, but if you're interested in helping write some of the documentation and being a volunteer contributor, I'd love your help. I've recently moved all Planimeter-related projects to our organization page on [url=https://github.com/Planimeter]GitHub,[/url] so contributors have direct access to the codebases, and no longer have to pass through me to contribute, unless working with Grid Edge which exists in the form of Vertex Adventure. We then do code drops to the public engine repository. We also have some other projects in the pipeline further down the road, so if you have a particular interest in Lua, scripting language integration in C and C++, and 3d game development, you might be interested in our project to replace LÖVE as the underlying framework for Grid.
[img]http://imgs.xkcd.com/comics/code_quality.png[/img] [I]"I honestly didn't think you could even USE emoji in variable names. Or that there were so many different crying ones."[/I] figured this would be relevant
[video=youtube;Gw1u8XVMsRc]http://www.youtube.com/watch?v=Gw1u8XVMsRc[/video] This supports VPK addon just like Left 4 Dead 2 does, same campaign script as well! Small mods like a map-pack can use this right away.
Finally got some time to work more on my game. Bug fixes and making it abundantly clear if a course is locked. [img]http://i.imgur.com/7vqZLpd.png[/img]
[QUOTE=andrewmcwatters;47545954][...] I probably spam this a bit by now, so I'm sorry if I do, but if you're interested in helping write some of the documentation and being a volunteer contributor, I'd love your help. [...][/QUOTE] Don't worry about it, seeing someone do public relations in action is a great resource. (I've got my hands full with my own projects, but I'll look into yours when I have time, at the very least for the simple reason that we're doing very similar things on different platforms.)
I've made a lot of progress with my LISPish language. [B]A parser (finally!) and a REPL[/B] [code] Crispy REPL > (+ "lol" " wut") lol wut >[/code] The parser fires OnTokensDepleted-event if it happens to run out of tokens while parsing. The official REPL supports said event: [IMG]https://i.imgur.com/zjAr3Lm.png[/IMG] [B]Support for multiple kinds of number literals[/B] When I wrote my first version of the parser, it only supported positive long integers. Last sunday I added support for negative longs, BigIntegers, doubles, and Clojure-style ratios (e.g -1/1886). Integer literals bigger than long.MaxValue are automatically expanded into BigIntegers. Additionally, all number literals (except ratios) support exponents (12e64, 2.4e-7). Handling all of these types and arithmetic operations between them was surprisingly tricky, and I spent a fair bit of time fixing bugs and inconsistencies. [B]Quoting[/B] [code] > ['(+ 4) '(- 4)] [(+ 4) (- 4)] > [(+ 4) (- 4)] [4 4] >[/code] In traditional LISP-style, values and lists can be quoted by prefixing them with a single 'quote or calling the [I]quote[/I] function. A quoted value evaluates to itself. While you can't do much with just that, it's the first step to metaprogramming. [B]Single-linked lists and cons[/B] Before this change lists used to be nearly identical to vectors (which are implemented with immutable lists), differing only in evaluation behaviour. I changed lists to be single-linked like they should be, which made implementing [URL="https://en.wikipedia.org/wiki/Cons"]cons[/URL] (which is arguably the most useful LISP function) extremely easy. The change also makes it easier to implement lazy, cyclic and/or infinite lists, which is something I might implement in the future. [B]Tail calls*[/B] Tail calls are syntactically identical to Clojure's. Tail call targets can be defined with [I]loop list-of-bindings[/I], and you can jump to the previous target with [I]recur list-of-new-values[/I]. Tail recursive functions are usually a lot faster than their recursive equivalents. [I][B]*[/B]They are not really proper tail calls, because they still use the call stack. I'm not sure if they can be properly implemented without a compiler.[/I] [B]Better native function support[/B] The interpreter can now load external .NET assemblies. Classes marked with [BindOnLoad] are scanned for methods with [FunctionBinding("name", preEvaluteArgs = true)], which are automatically bound to the root scope. [B]Runtime code evaluation with eval-string[/B] The new [i]eval-string[/i] function takes a string and lexes, parses and evaluates it. It allows simplistic metaprogramming, although macros (which I've not yet implemented) are far better for that. [B]Experimental new lexer, written in F#[/B] I wanted to learn F#, so I decided the reimplement the lexer. It took me half a day to learn enough F# and write the implementation, but much to my surprise it actually worked, bug free, the first time I tested it. The new lexer is more type safe, a bit more efficient and ~40% shorter. Discriminated unions and pattern matching are awesome.
Since I want to make a static website, but mix it up so it works both without JS and also with Ajax, I'm making a small library for writing HTML in C# with (relatively) reasonable syntax: [code]var wr = new AddableTextWriter(Console.Out) { Newline = "\n" }; wr += "<!DOCTYPE html>"; // The nested initializers break the autoformatter, so I thought I might as well use a compact bracket style. wr += new Html { {"lang", "en"}, new Head { new Meta("charset", "utf-8"), new Meta { {"http-equiv", "X-UA-Compatible"}, {"content", "IE=edge"}}, new Meta("viewport", "width=device-width, initial-scale=1"), new ShortComment("The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags"), new Comment { "etc."} }, new Body { {"role", "document"}}};[/code][code]<!DOCTYPE html> <html lang="en"> <head> <meta name="charset" content="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <!-- etc. --> </head> <body role="document" /> </html>[/code] The [I]AddableTextWriter[/I] is from my [I]Effektor[/I] project. I know it's technically syntax abuse but it's by far the nicest way of efficiently formatting text into an output stream I've seen so far. (It also supports concatenation without line break using [I]-[/I]/[I]-=[/I], line feeds with [I]++[/I] and indentation with [I]using[/I] blocks.) I'll probably break a few more conventions and overload the [I]Add[/I] methods with [I]params[/I] array parameters to quickly add a bunch of nodes from a variable to the document structure in the initializer or append them later. It's not planned to be quite commercial grade software, so I'm definitely favouring convenience as long as it doesn't lead to unexpected behaviour.
[QUOTE=LuaChobo;47543391]oh no im fucked!!!!![/QUOTE] Did you pay for it in full or defer it? I'm worried that I won't be able to fully pay for it if I get one
Have any of you ever sold a product that includes the source code? What way could you give people restricted access to a git repository based on if someone has bought your product or not?
[QUOTE=Richy19;47547393]Have any of you ever sold a product that includes the source code? What way could you give people restricted access to a git repository based on if someone has bought your product or not?[/QUOTE] Forget it. It can/will be cracked or leaked.
[QUOTE=geel9;47547410]Forget it. It can/will be cracked or leaked.[/QUOTE] I was thinking of something like using gitolite, the user uploads their ssh key once they have purchased and have access to the admin page, then the server could modify the gitolite config.. Thats one way i can think of doing it like unreal did, ie. whilst you pay you have access to updates
[QUOTE=geel9;47547410]Forget it. It can/will be cracked or leaked.[/QUOTE] That's true, but in any case Epic did it somehow with Unreal. I think they used a business account collaboration group or something similar, if I'm not mistaken. (You should be able to automatically manage them if clients give you their GitHub user names.)
[QUOTE=Richy19;47547443]I was thinking of something like using gitolite, the user uploads their ssh key once they have purchased and have access to the admin page, then the server could modify the gitolite config.. Thats one way i can think of doing it like unreal did, ie. whilst you pay you have access to updates[/QUOTE] people could just clone the repo and reupload somewhere else though?
[QUOTE=Richy19;47547393]Have any of you ever sold a product that includes the source code? What way could you give people restricted access to a git repository based on if someone has bought your product or not?[/QUOTE] Just make it a private repostory and invite people to it when they input their github username when they are logged into the application.
So I applied to a startup for an internship last week via their site. Filled out their application and haven't heard back from them since. Should I call them after Monday? Or did I just not get the job? What's the operating procedure on following up on jobs, do you wait to be contacted or do you contact them?
Here's something curious (in C#): [code]// base class public void Add(string attributeName, string attributeValue) { ... } // derived class public void Add(params Node[] contents) { ... } // Node public static implicit operator Node(string text) { ... }[/code] If you do this, the method in the derived class will completely hide the one in the base class even though that would be a perfect match for two [I]string[/I] parameters. To prevent it you have to add something like [code]new public void Add(string attributeName, string attributeValue) { base.Add(attributeName, attributeValue); }[/code] to the derived class.
[QUOTE=Richy19;47547393]Have any of you ever sold a product that includes the source code? What way could you give people restricted access to a git repository based on if someone has bought your product or not?[/QUOTE] Pull a quake: Open source the product, and require use of the purchased application's data.
[QUOTE=Map in a box;47547734]Pull a quake: Open source the product, and require use of the purchased application's data.[/QUOTE] Same goes for Half-Life 2 and it's party of games. It's basically the only good way that seems to have worked out well.
[QUOTE=geel9;47547410]Forget it. It can/will be cracked or leaked.[/QUOTE] Any product that that costs a significant amount of money, has no problems getting away with it. It really depends what kind of product you're selling. if it comes combined with services, and how expensive it is. And just like with binary products, based on those services, you can provide a better experience then the people who work off the leak. For example by providing frequent updates, or support. [editline]17th April 2015[/editline] [QUOTE=polkm;47547556]people could just clone the repo and reupload somewhere else though?[/QUOTE] They could do the same with any data not just code, yet we still bother selling data.
[QUOTE=blacksam;47547623]So I applied to a startup for an internship last week via their site. Filled out their application and haven't heard back from them since. Should I call them after Monday? Or did I just not get the job? What's the operating procedure on following up on jobs, do you wait to be contacted or do you contact them?[/QUOTE] I personally feel awkward following it up, but it's pretty standard to expect at least some form of acknowledgement, and to follow up if you don't. Just a polite call to restate your interest and to inquire as to when you could expect to hear up is perfectly acceptable. As long as you're polite and considerate, you're not going to hinder your chances of being considered. Some people also feel that following up shows you're keen, too.
I feel terrible for this bit of code: [img]http://i.imgur.com/I49xIEd.png[/img] in my rails config/routes.rb file
[QUOTE=Tamschi;47547245][...] I'll probably break a few more conventions and overload the [I]Add[/I] methods with [I]params[/I] array parameters to quickly add a bunch of nodes from a variable to the document structure in the initializer or append them later. It's not planned to be quite commercial grade software, so I'm definitely favouring convenience as long as it doesn't lead to unexpected behaviour.[/QUOTE] This idea was veering dangerously close to PHP, so I ended up only adding an overload for [I]KeyValuePair<string, string>[][/I] (to add multiple attributes). Multiple nodes can be added via [I]ProxyNode[/I], which prints only its contents without indentation. There are essentially three reasons why I want to use static templating to create this site: - I want something custom that I can tweak as much as I want, so I'm not sure an existing static CMS would help me that much. - The site should be accessible without JS since this is going to be a portfolio, but always reloading is clunky too so I have to duplicate some content. (It's annoying if a page ends up blank without JS in general though.) - English is not my first language, so while you generally can expect people working in software development around here to be fluent in it I'd like to provide the site in German too. As an added bonus it's going to be pretty easy to format more complex data into websites with this too. I plan to try to set up online documentation for some of my projects this way, maybe even with automated code sample/output insertion.
[QUOTE=Richy19;47547393]Have any of you ever sold a product that includes the source code? What way could you give people restricted access to a git repository based on if someone has bought your product or not?[/QUOTE] A lot of indie games were distributed like this - the free version was nagware or something similar, and the full version included the source code. Though I don't know if that's still true these days at all.
[QUOTE=ThePuska;47548335]A lot of indie games were distributed like this - the free version was nagware or something similar, and the full version included the source code. Though I don't know if that's still true these days at all.[/QUOTE] Just out of curiosity, could you name any indie games that did that? Not doubting, just interested to know.
A good amount of Humble Indie Bundle games do this.
[QUOTE=Cold;47547747] They could do the same with any data not just code, yet we still bother selling data.[/QUOTE] I'm not saying he shouldn't sell it. He totally should. Just don't expect it to be pirate proof.
Sorry, you need to Log In to post a reply to this thread.