• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

The Recreational Programming Challenge | #3: Do androids dream of electric beeps?

Status
Not open for further replies.

FillerB

Member
What's going on?
The short and sweet is: A regular topic, someone post a challenge, people code stuff, someone wins.

List of previous challenges
Challenge 1: Flora..............................Winner: lorebringer generates fractal-based plant life on your browser. (post) (solution) (source)
Challenge 2: Mazes. (vote breakdown) Winner: FillerB generates isometric mazes from whatever image you want. (post) (submission/source)

Rules

How does it work?
A programming challenge is posted. Any NeoGAF member, this means you, can take part in it and can use any programming language he or she wants. Once you're happy with your submission, you point us to either a compilate or the source code. How you do this exactly is up to you. Just a screenshot or a video won't suffice though.
The challenge runs until a time decided by the challenge poster but can not last longer than 4 weeks. When time runs out, voting starts and will last for 1 or 2 days. After voting is finished the winner makes a new topic with a new challenge and the circle repeats.

How does voting work?
Each NeoGAF member gets one vote. After voting is started with an appropriate post, challenge submissions are still accepted, but will probably get less votes. All challenge submissions are rounded up in a post to make it easy to find them. They are listed in order of submission post date.
It is okay to submit multiple times, as long as the submissions are dissimilar enough from each other.
Members vote for submissions, not for posters. They do this by saying "I vote for (some submission)" or similar.

What do I win?
That is for the challenge poster to decide. It might only be internets, it might be a Steam game, whatever. Of course it makes sense if the challenge poster has made sure he can actually produce the price when it's time. Also, remember that NeoGAF has a global audience, so things like iTunes codes only work if the region applies, for instance.
The person who has posted the challenge cannot claim the prize. If said person wins his own challenge, the prize goes to the next-best participant. The right to post a new challenge remains with the winner though, it is not attached to the prize.

What kind of challenges are okay?
Don't post overly hard challenges. Don't post challenges that would take a lot of time to complete. Don't post challenges that are actually your homework assignments or similar. Don't post challenges that need a lot of research. Apart from that, pretty much anything goes.
Preferably, you post challenges that are cool for non-programmers to experience. That includes audio- and video-related challenges, and ones that demand input and create output of some kind. But that's not really mandatory.

Do I have to write perfect code?
No. It's not about perfect code. It's about programming for entertainment, coming up with a cool thing, showing it off, and being proud of it. So there is nothing that can disqualify you. Just don't destroy stuff or delete files with your code.
So you can certainly write shitty code and get away with it in here. You might get lucky though insofar as others might give you pointers on what you might want to do differently.

What about copyright, trademarks and all that?

Use common sense. For example, if you invent a new collision detection algorithm that dwarfs all other algorithms out there while you're coding for a challenge, you might not want to publish it without making sure you're satisfied with the results of said publishing. Other than that, assume you're writing public domain code because noone on these boards can guarantee you rights to anything.
Of course, you cannot use trademarked content, and you have to respect the copyright of others. We're not above the law just because we're having a friendly coding challenge.

What are the go-to languages for this?
C, C++, Python, Java, C#, Objective C, Javascript.

Can I use custom frameworks, obscure platforms, esoteric programming languages?
If you do this, you need to be able to make it trivial for everyone to check your stuff out. For example, if you want to use LÖVE, then go ahead, but do it with the current release, and provide instructions on how to run your solution. If someone else has already posted run instructions, then it suffices to reference that post.

Where can I go to get help regarding all things programming?
Provided you've already used a search engine to dig for answers, you're of course welcome in the Programming |OT|
 

FillerB

Member
Challenge #3: Audio
Do something with the speakers and/or microphone on your PC. Whether it is a virtual instrument, a jukebox, a program that allows you to capture and visualize your attempts at singing or just something that reverses parts of a song to reveal satanic messages. It does not matter as long as it beeps, boops, burps, or plays Gustav Holst' "The Planets". Anything goes!

Please note that your program does NOT have to generate the sounds from scratch. Using external files is completely acceptable as doing otherwise would severely limit the usability of several programming languages as well as make the challenge overly difficult. Be sure to either add a video (with sound!) of your program working and list for what/on which platform you developed it if you suspect potential cross-compatibility issues!

You've got one week.

t1343325600z0.png

(Deadline extended for one week)

Suggested reading:
C++/C#:
http://www.ambiera.com/irrklang/tutorials.html

Java:
http://www.jfugue.org/index.html

JavaScript:
http://gerrybeauregard.wordpress.com/2012/03/30/web-audio-sine-tone-generator/
https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
http://sergimansilla.com/blog/dinamically-generating-midi-in-javascript/

Python:
http://pymedia.org/
http://code.google.com/p/midiutil/

General:
http://www.phy.mtu.edu/~suits/notefreqs.html
http://pianochords.blogspot.nl/2009/03/free-piano-chord-samples.html

Vote Breakdown/Submissions
-> See post 61

Prizes:
Your choice of any one of the following:
A) A small USB-powered speaker in the form of a certain green robot to rock out to your creation. (link)
B) A "stylish" fan to keep cool during those long hot summer nights coding for the Recreational Programming Challenge. (link)
C) €10 to use as one sees fit whether this is on Steam Games, T-shirts in the NeoGAF-shop or anything else.
 

sinxtanx

Member
Bumping this, so more people see it.

Also, sound? This round is going to destroy our collective ears, isn't it? Deal.
 
Awesome challenge, gonna be a hard one to get right, I have 0 audio programming experience other than that 1 project I had to do during my undergrad. Got some ideas though and thanks for the links FillerB, JFugue looks like it might be pretty handy so I think I'll be submitting a Java one this time. (If I have time this week)
 
Congrats, FillerB.

Unfortunately for me I have some hectic life stuff coming up this week so I can't put in a whole lot of time on this cool challenge, but I should have something submitted by tomorrow.
 
Here is my Challenge #3 submission: Chuckles' Last Laugh. It's a game inspired by the old school Kaboom.

dItuh.png


Story
Chuckles the clown is fed up with being treated like a...well clown. To get revenge on those that laugh at him, he's stolen music from around town and plans to dump the notes into a river. As the circus mop bucket, your goal is to collect the notes of each melody so that they don't fall into the water.

Gameplay video for one of the levels found here:
http://www.youtube.com/watch?v=T1ezsfZvDRI

Tech
The project was built using Visual C++ 2010 Express. The graphics are drawn with Direct3D. The sounds are played using Winmm library that comes with VS.
I exported the notes individually using Anvil Studio. The melodies are simply hard-coded integer arrays where each integer corresponds to a note. A smarter way to do this would be to export the entire song as a midi and start/stop the music between notes, but I went brute force here.

Source And Assets here. The proper button to hit is the solid blue "Download" button with the white letters just above the "File URL" box.

Side Note
I don't know the name of the song in my video above. It's something I memorized as a kid taking piano lessons. If anyone knows, can you tell me?
 
Yeah that's cool, good work! I have something I've been poking at a bit but it still needs more work. Not sure if I'll have time to get it done before Thursday but we'll see how it goes over next few days.
 
Thanks! I regret not being able to do some interesting run-time processing on the sounds. I have some unfinished XAudio2 code that I'd like to use to revisit this challenge in the future.

Can't wait to see the interesting stuff everyone comes up with :)
 

Man

Member
Can we allow functional languages like Lisp and Haskell? I guess this goes under esoteric languages mentioned in OP.
 

FillerB

Member
Can we allow functional languages like Lisp and Haskell? I guess this goes under esoteric languages mentioned in OP.

As far as I care anything goes as long as you give instructions on how we can check the code (ie. install Lisp/Haskell)
 

wolfmat

Confirmed Asshole
I made an HTML5 sequencer: http://www.alice-dsl.net/wolf.mathwig/seq/

It still lacks some samples and instruments, I gotta play around with Audacity at some point to produce more. Or steal stuff from freesounds.

Edit: <audio> tag support is key. The recent Chrome and Firefox seem to work fine. But the JS timer seems to hitch for me, not sure why that is, not doing tough things there.

Edit: Oh yeah, I'm gonna add import via JSON, just wanted to put it out there to catch early mistakes I didn't see by myself. Pls test.
 
I made an HTML5 sequencer: http://www.alice-dsl.net/wolf.mathwig/seq/

It still lacks some samples and instruments, I gotta play around with Audacity at some point to produce more. Or steal stuff from freesounds.

Edit: <audio> tag support is key. The recent Chrome and Firefox seem to work fine. But the JS timer seems to hitch for me, not sure why that is, not doing tough things there.

Edit: Oh yeah, I'm gonna add import via JSON, just wanted to put it out there to catch early mistakes I didn't see by myself. Pls test.

Very cool. I'm no Beethoven, but here's my very first composition with your program:

http://www.youtube.com/watch?v=tvRN6LK4np8

I'm gonna try and do the Spy Hunter theme with it later.
 

usea

Member
Okay, I've made significant changes. Fixed a number of bugs and stuff. Also added an instrument, expanded octaves, things like that. Please test! JSON stuff is next.

Hooray music!

Edit: It takes a while to load with so many samples. I guess I have to shut it down if too many people use it, and provide a downloadable version.
I played with the previous version and it was cool. Feature request: optionally add some lines to mark measures at X intervals? It was kind of difficult to keep track of the beats
 

wolfmat

Confirmed Asshole
I played with the previous version and it was cool. Feature request: optionally add some lines to mark measures at X intervals? It was kind of difficult to keep track of the beats

Yeah, I noticed that too. I use the click track for that, like with
x...-...y..._...y..._...y...-...=...-...y..._...y..._...y...-../
And then I mute it. But I already thought "why not let the user set a measure and then overlay the thing with lines". Might do it after JSON. Thanks for bugging me :)

Edit: It also needs an on-the-fly looping thing for subsections. And copypaste across tracks would also be cool. And custom instruments, cookies, user accounts, wav rendering, all that. (Not that I'm gonna implement those, but the mind wanders.)

Turns out it's an extremely productive topic. All these things to do.
 
I made an HTML5 sequencer: http://www.alice-dsl.net/wolf.mathwig/seq/

It still lacks some samples and instruments, I gotta play around with Audacity at some point to produce more. Or steal stuff from freesounds.

Edit: <audio> tag support is key. The recent Chrome and Firefox seem to work fine. But the JS timer seems to hitch for me, not sure why that is, not doing tough things there.

Edit: Oh yeah, I'm gonna add import via JSON, just wanted to put it out there to catch early mistakes I didn't see by myself. Pls test.

I know this is awesome but all I can make it do is make horrible horrible sounds at me, I'm really not a musician :(

Still, good work!
 

FillerB

Member
Turns out it's an extremely productive topic. All these things to do.

Very nice sequencer Wolf. I'm thinking about increasing the time limit a bit as we have (as of yet) only two entries. How long do you guys think I should add? Let it run until Monday 17:00 GMT?
 

wolfmat

Confirmed Asshole
Sure, more submissions would be good. Question is if others are actually working on it. But I won't get to anything this weekend anyway, so the later the next challenge starts, the better.

Morrowind Theme The link was for an older version.

Edit: The generated URL is LZW+Base64 of JSON stuff, but it's still superlong. Not sure what to do about that. I thought about writing the LZW stuff to pixels to generate an image, but that would make it harder to come up with a proper sharing scheme.

(Also, when keys are remapped, it ends up in the URL, but I haven't figured out how to properly re-apply the remapping yet. It's really important though. Lots of things to do still.)
 

Mondriaan

Member
Very nice sequencer Wolf. I'm thinking about increasing the time limit a bit as we have (as of yet) only two entries. How long do you guys think I should add? Let it run until Monday 17:00 GMT?
I'm all for making it run longer. I haven't started yet, though, but I will probably have some time this weekend.
 
The longer the better, I have a deadline for a paper submission coming up for next tuesday so I won't be able to work on my one until after then. If you want to push it till next thursday I can try to have a go at finishing I think.

If not though I'll probably try to crap someout out over the weekend but it will suck either way.
 

FillerB

Member
Right then. Added another week to the countdown. I've got a nice idea myself that'll I try to do over the weekend.
 

sinxtanx

Member
Oh my.

Oh my goodness.

What have I done?

I have created a monster.

A truly terrifying being from the very depths of Hell itself.

Forged in Fire, Blood, and Cherry Coke.



Extended deadline only means it will be even more terrifying upon arrival.
Have the base code finished, will start working on a nice demo tomorrow.
 

wolfmat

Confirmed Asshole
I've changed the URL compression scheme to ZIP (so old links don't work anymore), added a "Tinify" feature, key remappings are now stored in the URL, the UI is better and whatnot.

Please try it out again and report bugs: http://www.alice-dsl.net/wolf.mathwig/seq/

Note: You still have to wait until the site is loaded completely, otherwise, you won't hear samples that aren't loaded yet. The <audio> event handlers for that don't work right for some reason.
Thankfully, your browser buffers the wavs. And they're pretty small, so it's no biggie.

Edit: As an example, here's the US keyboard layout: http://tinyurl.com/chm85na
Edit: Turns out this doesn't work right yet. *sigh* Hang on.
Edit: Trivial mistake. Fixed.
 

usea

Member
I created something dreamy...
Marching to GAF
The "v" and "c" noisedrum samples didn't load for me. Not the first time it happened. I refreshed several times (clearing cache) and they still wouldn't load.

They load in opera, but the whole thing is a little laggy and I think the timing gets screwed up.

How come you used different characters as spacers on the different channels? . # and _
 

wolfmat

Confirmed Asshole
The "v" and "c" noisedrum samples didn't load for me. Not the first time it happened. I refreshed several times (clearing cache) and they still wouldn't load.

They load in opera, but the whole thing is a little laggy and I think the timing gets screwed up.

Browser? The samples are really short, so that might be why. (FF on WinXP here, works, same for Chrome)
 

wolfmat

Confirmed Asshole
The tracker now has a song mode, and you can set patterns that you then type down in song mode. Also, in song mode, there's now a volume input for a track as well. And it looks way cooler. And a couple of other things are cooler or new. I've lost track haha

Unfortunately, I've gotta bounce. Please break it and heckle me in here. Thanks!

Edit: Of course, the song is part of the URL.
 

Naka

Member
Was this linked in the old thread and I missed if? Should we link to the new topic in the old thread so people that sub can easily find it? If this was done I'm sorry for missing it.
 
Yeah I think it was linked in the other thread. I wouldn't be that concerned with smaller number of replies, it takes a certain kind of madman to enjoy participating in these things. :p It's just a shame there's no easy way to keep it visible, since I think a lot of people enjoy looking at these or playing with submissions but maybe don't have all that much to say or don't realise this is here.

Anyway, like I said I'll try to get mine in this week as well but I can't work on it until Wednesday really.
 

Chris R

Member
I didn't reply because I didn't have an idea of something that I could do.

But I didn't see why it needed to be in a new thread either.


Whoever the winner was, post the next challenge!!!
 

FillerB

Member
I didn't reply because I didn't have an idea of something that I could do.

But I didn't see why it needed to be in a new thread either.


Whoever the winner was, post the next challenge!!!

Reading is an art mate. Still 4 days left and we agreed in the previous thread that each challenge would have it's own thread for easier tracking.
 

sinxtanx

Member
Well, here's my submission:

I call it MAKEHAPEN

At first I was like: "I'll make a program that writes music!"

But then I was like: "What have I done?"

The program generates something that is unmistakably music. Or, unmistakably the sound of an entire orchestra in severe pain. I'm not sure which.

Made in Unity 3.5.3:

qLJf4.png


--> DOWNLOAD HERE <--
 
Well, here's my submission:

I call it MAKEHAPEN

At first I was like: "I'll make a program that writes music!"

But then I was like: "What have I done?"

The program generates something that is unmistakably music. Or, unmistakably the sound of an entire orchestra in severe pain. I'm not sure which.

Made in Unity 3.5.3:

qLJf4.png


--> DOWNLOAD HERE <--

This is completely incredible and also absolutely horrifying at the same time. Super impressive well done! The music has this unnatural discordant timbre that almost seems intentional. It's like a David Lynch movie or something.

Out of curiosity, which way did you generate your music? It's quite a good blending effect even if it does make me feel like a maniac is about to torture me before devouring my still beating heart.
 

sinxtanx

Member
This is completely incredible and also absolutely horrifying at the same time. Super impressive well done! The music has this unnatural discordant timbre that almost seems intentional. It's like a David Lynch movie or something.

Out of curiosity, which way did you generate your music? It's quite a good blending effect even if it does make me feel like a maniac is about to torture me before devouring my still beating heart.

Thanks! The David Lynch effect is completely unintentional, and is probably an effect of the composer not knowing anything about chord progression and stuff.
The way it works is this:
  • The Composer generates a set of Melody Figmas (a smaller set of notes on a timeline)
  • It then sorts the Figmas into several Styles (just a collection of Figmas, nothing special)
  • The Composer then storyboards a song by assigning Styles to Sections of the song (in the case of the demo: four Styles per Section)
  • It then renders the storyboard to as many Notesheets as the maximum amount of Styles in any section, and also assigns Instruments to each Notesheet.
  • Passes the Notesheets to the Conductor.
  • Who passes them to the Orchestra (a collection of Musicians) and tells the Orchestra to start playing.
  • Each individual Musician plays an Instrument according to a Notesheet.
  • asjdhfuikwvfieuvhskdhukduc

I really like this general solution, and I do think it could generate music that is not as creepy with some more code work (chord progression and stuff).

Any chance of a youtube (or some other) demonstration for those of us that can't check it out right away?

I'll see what I can do.

EDIT: Screen capture programs are a pain in the ass. Uploaded to Kongregate instead: http://www.kongregate.com/games/sinxtanx/makehapen

Wow. Just. Wow. That is completely horrifying in all the right ways.

And that's without the program generating any actual Chords at all. There's support for that, but I decided against it.
 
Thanks! The David Lynch effect is completely unintentional, and is probably an effect of the composer not knowing anything about chord progression and stuff.
The way it works is this:
  • The Composer generates a set of Melody Figmas (a smaller set of notes on a timeline)
  • It then sorts the Figmas into several Styles (just a collection of Figmas, nothing special)
  • The Composer then storyboards a song by assigning Styles to Sections of the song (in the case of the demo: four Styles per Section)
  • It then renders the storyboard to as many Notesheets as the maximum amount of Styles in any section, and also assigns Instruments to each Notesheet.
  • Passes the Notesheets to the Conductor.
  • Who passes them to the Orchestra (a collection of Musicians) and tells the Orchestra to start playing.
  • Each individual Musician plays an Instrument according to a Notesheet.
  • asjdhfuikwvfieuvhskdhukduc

I really like this general solution, and I do think it could generate music that is not as creepy with some more code work (chord progression and stuff).

Yeah I think it's very effective. I don't know anything at all about musical theory really but I'd imagine you could get some decent sounding atmospheric pieces to fit certain emotional requirements by adding in the right rules and constraints?

Very impressive stuff anyway, making my submission look bad before I even get it finished. :p
 
Status
Not open for further replies.
Top Bottom