A Voice-Controlled Music Pong Game: Luke's music256 Final Project
12/13/08
This work in progress, tentatively titled "zhong", is a voice
controlled pong-like game that generates music. The basic idea is
that each side of the field represents a repeating musical loop, whose
segments get turned on and off by the puck as it bounces off the
different segments of each side. The paddle can be steered with
the voice, with up/down controlled by noisiness of the input signal and
left/right controlled by pitch. The goal, if one is needed, is to
get all segments of all four loops playing at once.
How to install Zhong:
- Download and unzip zhong.zip .
- Open a terminal, navigate to the unzipped folder, and type
'make'.
- If everything looks good, rejoice. If not, gnash
teeth and curse the programmer.
How to run it:
- Type "./Zhong" on the command line to start it.
- At the moment input is not yet working, so all you can do is:
- Watch the puck and paddle bounce around turning on and off music segments.
- Currently only the top and bottom are actually playing audio.
- To quit the application type 'q'.
General Feedback on this project:
I coded most of this at the last minute, but I did spend some time
before the process writing out my idea and requirements (see pic at
top) and sketching up a design document:
I
found that referencing this document was crucual when coding under time
pressure. In fact through these processes I discovered a number
of principles and practices I found useful when making code that will
only be used by yourself in a smallish size project. I do not
necessarily condone these techniques, but I did find them useful.
I call them....
Luke's last-minute, sleep-deprived, OO-coding hints:
- Design beforehand and reference your design docs often.
- Before starting each coding session make a list of the next steps. That way when you get lost in the code details and lose perspective you can remember what you need to accomplish given the time available.
- If
you design an object well you can minize the size of code. This
is nice, but the complexity of design necessary may be too great.
Thereore you may find that sometimes copy and paste is faster! (see my edge::draw() method.)
- You can think of this as considering time cost vs. reward.
- Make everything public!
- no need to write accessors/setters
- write member functions when it saves debugging time.
- This last one falls under the question of when to use procedural techniques vs. when to use object-oriented. If you make everything an object with public members you can decide on the fly.
If
you follow any of my advice I accept no responsibility for what kind of
trouble you may get yourself in, especially when you try to revise your
code later!