Hacker News new | comments | ask | show | jobs | submit login
Show HN: Music for Geeks and Nerds (musicforgeeksandnerds.com)
221 points by kroger on July 26, 2012 | hide | past | web | favorite | 74 comments



Here are two related books that are freely available (and that I haven't read):

The Haskell School of Music — From Signals to Symphonies, by Paul Hudak (pdf available at http://www.cs.yale.edu/homes/hudak/Papers/HSoM.pdf).

Music: a Mathematical Offering, by David J. Benson (pdf available at http://homepages.abdn.ac.uk/mth192/pages/html/music.pdf)


Clicked it expecting another "list of mixtapes by deadmau5", ended up very surprised, and bought a copy! Very cool!

I know Ableton Live has python scripting support built in. I wonder how hard it'd be to integrate all this into composer tools in the DAW


Unfortunately I haven't seen an official Ableton Live python scripting support. I have tried to find it with no success.

Yes, the controllers are configured using precompiled python scripts and 3rd party users have been decompiling them and building their own bindings based on that. But liveapi.org / http://code.google.com/p/liveapi/ has been down for a while and was built for version 6.0.7 (current is version 8).

Currently official way to access Ableton API seems to be MAX [1] but I have no experience with that. At first sight it didn't seem to have any python reference. I could be wrong.

[1] http://cycling74.com/docs/max5/refpages/m4l-ref/m4l_live_api...


On a side note, Renoise is a terrific DAW/Tracker, and has built-in Lua scripting, plus native OSC support (something still lacking in Live).


Yes, Renoise is definitely a music program every geek should check out :D


Manipulating Ableton Live directly using python is tricky as you need to impersonate a proprietary device. However, there's a fairly there's a fairly straightforward Open Sound Control API here: http://livecontrol.q3f.org/ableton-liveapi/liveosc/

I few years back, I wrote Ruby and C wrappers to communicate with Live via OSC: https://github.com/tassock/ruby_4_live, https://github.com/tassock/ofxAbleton


Oh nice, thanks. I just wrote OSCPad for Android which I hope becomes the standard OSC controller for Android, I will look at some default templates supporting Ableton Live.


Not so fast, you only get the mixtape by deadmau5 if you buy 5 copies ;-)


If you're tired of deadmau5 mixtapes you can head to musicforprogramming.net for some new coding tunes :)


Clicky: http://musicforprogramming.net/ Discussion: http://news.ycombinator.com/item?id=3547694

Music during 'Notch live coding 0x10c': http://news.ycombinator.com/item?id=3811332

Found somewhere in there, a 290GB 'Essential Mix' archive: http://soundcloud.com/das-boy/sets/essential-mix


I purchased this with a credit card and got an error that starts off: "The request signature we calculated does not match the signature you provided. Check your key and signing method."

I waited a couple minutes and clicked the download link again and it worked. Wanted to let someone know, since the site doesn't appear to have any contact information.


Thanks for the report, I'll check what is the problem. I added a contact email.


Paypal didn't work for me, but gumroad worked just fine.


Wonderful! Is the codebase[1] using pyknon[2] or also csound [3]?

I'm asking this because http://musicforgeeksandnerds.com/resources.html lists csound as one of the resources.

Any ideas how pyknon API relates to csound API?

I was working with some programmatic sound generation and csound built-in python interpreter seemed to be one of the most advanced free solutions to get some python-based music generated. Csound is free for academic and research. Commercial license requires contacting MIT. But yes, csound itself is not python...

I even didn't find anything close to csound in terms of features, instruments available and community.

[1] https://s3.amazonaws.com/musicforgeeksandnerds.com/code.zip

[2] https://github.com/kroger/pyknon

[3] http://www.csounds.com/journal/issue14/realtimeCsoundPython....

EDIT: I just noticed that pyknon is generating a MIDI, not an audiofile. Pyknon is for building midi scores and is not meant for sound synthesis.


The codebase only uses Pyknon. Csound is used to generate the examples in chapter "A Look Inside the Primitives", that's why it's included on the resources page.


Oof, I think you just brought my open-source[0] project to its end! This is quite nice.

[0]: http://github.com/prezjordan/Melopy


And the documentation page is even nicer:

http://prezjordan.github.com/Melopy/


Hey, your project is nice! I'll check it out later.


Hopefully, Kroger sees this and has a bit of time to reply.

I excelled in music. Is there anything in particular in programming that you teach differently so musicians can understand it better? If so, do you have any ebooks, PDFs or other resources of this? Just wondering because I've only recently taken up programming and I'm looking to pull information from various resources. Thank you!


Good question. When I teach programming to musicians I find that they can learn programming from a functional perspective very quickly and they take a long time to "get" object oriented programming (or maybe I'm not good at teaching OOP ;-).

Usually I start with a SICP-like [1] approach, but focused on musical, instead of mathematical problems. I show them some basics of the language and ask them to implement musical operations they already know, such as transposition and inversion. Then, I show how they can simplify their code.

If you want to learn programming, I suggest SICP [1]. The videos [2] are also very good.

[1] http://mitpress.mit.edu/sicp/

[2] http://ocw.mit.edu/courses/electrical-engineering-and-comput...


That's an interesting observation - as a musician, functional programming has somehow always felt more intuitive to me than OOP. What characteristics of functional programming do you think are similar to music?


To be honest, I think both paradigms are good for music. You can have a Note as an object with attributes such as pitch, octave, name, etc. Maybe musicians like FP at first because it's somewhat simpler (I'm not talking about Monads here ;-). They already know about functions from high school and function composition translates directly to how they may think about music operations:

    retrogradation(transposition(inversion([0, 4, 7])))


Do the musical terms in this analogy:

retrogradation(transposition(inversion([0, 4, 7])))

also explain the relationship between each part of this function as retrogradation does with transposition and inversion? E.g., if you start with a triad, transpose it to another key, and then create an inverted chord out of it? Or were the musical terms chosen merely to indicate that they can be a "subset" of a particular general idea ("chord" or "function"?)?


You have no idea how helpful you've been. :)

Thank you for taking the time for this.


This is extremely interesting in concept; I know essentially nothing about music theory and have been interested in learning more about it, and a logical/mathematical approach sounds perfect.

But is the book suitable for someone seeking to acquire a foundational knowledge of music theory, or does it require some level of pre-existing understanding?

I ask because most of the material on the page refers to learning "more" about music, and the sample material does seem to assume some background knowledge in musical notation, etc.

If this isn't suitable as an entry-level primer on music theory, can anyone recommend some other works to read first?


In theory you should be fine but it's hard for me to tell. You could use the book and supplement the things you don't know with Wikipedia (I even recommend a few articles in the book). Have you tried the sample?


I've looked at the sample, and found some of it to rely on prior knowledge, but perhaps it will be fine if I have appropriate reference material handy. I'll go ahead and get a copy.


Perfect, just what the doctor ordered. May I suggest you create a forum / subreddit for the readers to discuss the book?


Good idea, I created a subreddit: http://www.reddit.com/r/mfgan/


Perfect. I'd add a link to the list of resources :)

Thank you for the awesome work! I'll try and leave feedback on the subreddit once I get started.


> Perfect. I'd add a link to the list of resources :)

done. :)


Pure Data is awesome! It's a "patcher" language which makes it pretty approachable for musicians, who are already used to the "plugging in wires" paradigm --

Also with (http://libpd.cc/) you can embed your Pd code almost anywhere!

I'm using Pd/libpd for an audio-focused mobile project --- so far it's a great architecture, perfect separation of concerns, keeps the audio guts cross-platform. Plus everything is permissively licensed.

Supercollider seems to have a lot of traction with the improvisational community, folks who do "live coding", i.e. hacking at curly-bracket syntax in a performance setting. But it's GPL and not easily embeddable in mobile devices afaik ---

P.S. Custom python scripts against Ableton work great if you are using a hardware controller that supports the Framework classes. You can access pretty much the entire Max for Live object model, via python. It's definitely an unsupported back door though.

Here's a tutorial: http://remotescripts.blogspot.com/2010_03_01_archive.html



I love this as a pedagogical tool. Composers and hackers have a lot more in common than many folks realize, so to teach the basics of composing in a familiar language makes a lot of sense.

That said, where do we go from here? Many of the challenges in writing contemporary music are in fact notational challenges. We have a system of music notation that developed largely alongside the musical styles of the baroque and early classical eras, which tends to emphasize discrete pitches and a "divisional" model of time. (That is, the only allowable note lengths are those that can be expressed roughly as multiples of powers of 2.)

This book seems like a great way to get your toes wet, but what is the geek or nerd to do when their compositional ideas begin to butt up against what is possible within western notation and, indeed, pyknon?


haliax is right, although I don't cover Csound much.

If you want to compose for instruments, you may want to learn more about what contemporary classical composers are doing (or have done) [1] to address the notational challenges.

On the other hand, if you want to have completely freedom, computer generated music [2] can give you that, specially if you use something like Csound, Supercollider [3], Chuck [4], or PD [5].

[1] http://en.wikipedia.org/wiki/Contemporary_classical_music

[2] http://en.wikipedia.org/wiki/Computer_music#Computer-generat...

[3] http://supercollider.sourceforge.net

[4] http://chuck.cs.princeton.edu

[5] http://puredata.info


+1 for ChucK. Learned that this past year in school. Was my first time programming, definitely wasn't as difficult as I always envisioned it being... (:


I think that that's what the chapter on primitives -- introducing csound is for. Also, I think that experimenting with musical conventions and the like is really interesting. If you want to talk about this sort of thing further, my email's in my profile.


FYI, since it isn't mentioned on the OP, the Amazon version only costs $9.99. The downside is that it's Kindle only, though with no restriction on number of Kindle devices. http://www.amazon.com/dp/B008NSO6SI


I so want to buy this book but I don't know if it's right for me yet even after reading the sample.

Is there anything practical I can expect to use as a result of reading it and going through the exercises?


A better understanding of music theory?


Perfect! I've often wished for such a book.

Note - It's also available on Amazon priced at 9.99, though that would be DRM encumbered and (probably?) not include the sound samples.


You can download the code and sound examples at: http://musicforgeeksandnerds.com/resources.html

The kindle version at amazon shouldn't have DRM (I hate DRM).

Just keep in mind that some (older) kindle readers may not display some formatting properly, such as code blocks and tables (gasp!) that's why I sell a package with 3 formats. It looks good on my kindle3, but your mileage may very.

Unfortunately this is a limitation of the format (modi) and readers (it should get better with the kindle format 8).

I bought some programming books from Amazon for the kindle that I end up buying again from the publisher just to have a pdf copy and be able to read the source code better. It's still convenient to have some programming books on the kindle, though.


So the extra $5 just gets you a broader choice of file formats?

I'm interested in buying it, and I'm pretty sure my kindle show be able to handle the format. That said, I think I'd rather buy from your website than from Amazon (assuming more of the money ends up in your pocket) - but not at a markup of 50%!


Out of curiosity, are the examples intended for python 3? I noticed in the sample you're passing around 1/4, 1/2, etc. which doesn't do a whole lot in 2.x. :)


They should work with 2.7 and 3.x. I the book I use from __future__ import division.


Gotcha, thanks! I forgot about __future__.


Great stuff. Bought myself a copy after reading that you're strongly influenced by SICP - good enough for me :)

Edit: Forgot to mention, I spent a weekend writing a bunch of similar music manipulation tools in clojure if anybody is interested in checking it out: https://github.com/dmansen/composition-assistant


Musicnovatory.com presents quite a few interesting music theory concepts, though it is quite opaque and off-putting in parts. For example, they present a generative binary theory of rhythm, a 'tetrad' theory of chords (by fifths and 'metamorphoses'), and a whole array of binary open/close 'entities' (rhythm, harmony, and 'melolines' (the chord tones of the melody)).


This seems like a great read! I have wished for years to dive into music theory and this would suit me great. I would prefer a physical copy though, any chance of seeing an e-mail list where you can get back to people that want to wait for the paper version? I signed up for notifications for volume 2 but I didn't see anything similar regarding the paper version.


I have to say, just skimming through on the Kindle version (on iPad), the book looks beautiful and well laid-out. Can't wait to dig in.


This could be perfect for me. I studied guitar in high school and played trombone for 8 years, but I've all but abandoned both and haven't looked at sheet music for years. I'll admit that I never got the structures of chords and why they sounded like what they sounded like and what types of sounds should logically proceed another.

@kroger Will this help?


I think it may help. I don't cover chord progressions in the book (that's for volume 2 ;-), but it should give you a good foundation.


Is there some mailing list we can sign up for, to get volume 2 news? I just bought volume 1, browsed it, and it seems like an excellent fit for my way of thinking.

I'd love to see some more advanced topics covered in much the same way!


Thanks for the interest! I added a mailing list for volume 2 (at the bottom of the page).


Looks great! Now we need an edition using Overtone...

http://overtone.github.com/


The site says a paperback edition is coming... is there a way we can sign up to be notified when it's available?


I added a mailing list at the end of the page.


Thanks!


Kudos for Steve Reich on the very front!


Thanks!


Will grab it and read when I next have some space on my reading list, but as a former professional musician and occasional amateur coder, I'm pretty much the exact opposite of the target audience, so will be interesting to see how it reads for me.


Interesting! Please let me know how it works for you. You may find "Learn Python the Hard Way" a good complement:

http://learnpythonthehardway.org


This is great, Pedro. Just bought a copy. I've tried ---and failed--- many times to learn music: I hope this will be the one. Now if you just found the way to include a couple of properly tuned ears in the package...


For those curious, here are a few of the author's musical compositions: http://pedrokroger.net/compositions/


This is EXCELLENT!

I'm currently Yale's free online course, Listening to Music. Should be a great complement.

http://oyc.yale.edu/music/musi-112


exactly what I was looking for, just bought it, thanks!


So, If I want to just learn the guitar and to be able to play classics like wonderwall, will this book help me?


Maybe not. If you are a programmer the book may help you to understand music better and if you understand music better you may be able to play better. But to be a good performer you need to work on many other skills.


Bet someone could generate the Art of the Fugue from a few functions...


What a beautiful idea. Will a physical copy be available at some time?


Yes, it should be available in a few weeks at Amazon.


Can't you just submit a manuscript to CreateSpace and get it live tomorrow?


I could, but I want to make sure the resulting quality is good (I need to have high resolution images, make B&W images, etc.). Unfortunately it takes weeks until they send you the printed review and I don't feel comfortable selling something without seeing it first.


Speaking of which, who's going to be at Nerdapalooza next weekend?




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: