Sunday, 2 October 2011

Algorithmic symphonies from one line of code -- how and why?

Lately, there has been a lot of experimentation with very short programs that synthesize something that sounds like music. I now want to share some information and thoughts about these experiments.

First, some background. On 2011-09-26, I released the following video on Youtube, presenting seven programs and their musical output:


This video gathered a lot of interest, inspiring many programmers to experiment on their own and share their findings. This was further boosted by Bemmu's on-line Javascript utility that made it easy for anyone (even non-programmers, I guess) to jump in the bandwagon. In just a couple of days, people had found so many new formulas that I just had to release another video to show them off.


Edit 2011-10-10: note that there's now a third video as well! http://www.youtube.com/watch?v=tCRPUv8V22o

It all started a couple of months ago, when I encountered a 23-byte C-64 demo, Wallflower by 4mat of Ate Bit, that was like nothing I had ever seen on that size class on any platform. Glitchy, yes, but it had a musical structure that vastly outgrew its size. I started to experiment on my own and came up with a 16-byte VIC-20 program whose musical output totally blew my mind. My earlier blog post, "The 16-byte frontier", reports these findings and speculates why they work.

Some time later, I resumed the experimentation with a slightly more scientific mindset. In order to better understand what was going on, I needed a simpler and "purer" environment. Something that lacked the arbitrary quirks and hidden complexities of 8-bit soundchips and processors. I chose to experiment with short C programs that dump raw PCM audio data. I had written tiny "/dev/dsp softsynths" before, and I had even had one in my email/usenet signature in the late 1990s. However, the programs I would now be experimenting with would be shorter and less planned than my previous ones.

I chose to replicate the essentials of my earlier 8-bit experiments: a wave generator whose pitch is controlled by a function consisting of shifts and logical operators. The simplest waveform for /dev/dsp programs is sawtooth. A simple for(;;)putchar(t++) generates a sawtooth wave with a cycle length of 256 bytes, resulting in a frequency of 31.25 Hz when using the the default sample rate of 8000 Hz. The pitch can be changed with multiplication. t++*2 is an octave higher, t++*3 goes up by 7 semitones from there, t++*(t>>8) produces a rising sound. After a couple of trials, I came up with something that I wanted to share on an IRC channel:

main(t){for(t=0;;t++)putchar(t*(((t>>12)|(t>>8))&(63&(t>>4))));}

In just over an hour, Visy and Tejeez had contributed six more programs on the channel, mostly varying the constants and changing some parts of the function. On the following day, Visy shared our discoveries on Google+. I reshared them. A surprising flood of interested comments came up. Some people wanted to hear an MP3 rendering, so I produced one. All these reactions eventually led me to release the MP3 rendering on Youtube with some accompanying text screens. (In case you are wondering, I generated the screens with an old piece of code that simulates a non-existing text mode device, so it's just as "fakebit" as the sounds are).

When the first video was released, I was still unsure whether it would be possible for one line of C code to reach the sophistication of the earlier 8-bit experiments. Simultaneities, percussions, where are they? It would also have been great to find nice basslines and progressions as well, as those would be useful for tiny demoscene productions.

At some point of time, some people noticed that by getting rid of the t* part altogether and just applying logical operators on shifted time values one could get percussion patterns as well as some harmonies. Even a formula as simple as t&t>>8, an aural corollary of "munching squares", has interesting harmonic properties. Some small features can be made loud by adding a constant to the output. A simple logical operator is enough for combining two good-sounding formulas together (often with interesting artifacts that add to the richness of the sound). All this provided material for the "second iteration" video.

If the experimentation continues at this pace, it won't take many weeks until we have found the grail: a very short program, maybe even shorter than a Spotify link, that synthesizes all the elements commonly associated with a pop song: rhythm, melody, bassline, harmonic progression, macrostructure. Perhaps even something that sounds a little bit like vocals? We'll see.

Hasn't this been done before?

We've had the technology for all this for decades. People have been building musical circuits that operate on digital logic, creating short pieces of software that output music, experimenting with chaotic audiovisual programs and trying out various algorithms for musical composition. Mathematical theory of music has a history of over two millennia. Based on this, I find it quite mind-boggling that I have never before encountered anything similar to our discoveries despite my very long interest in computing and algorithmic sound synthesis. I've made some Google Scholar searches for related papers but haven't find anything. Still, I'm quite sure that at many individuals have come up with these formulas before, but, for some reason, their discoveries remained in obscurity.

Maybe it's just about technological mismatch: to builders of digital musical circuits, things like LFSRs may have been more appealing than very wide sequential counters. In the early days of the microcomputer, there was already enough RAM available to hold some musical structure, so there was never a real urge to simulate it with simple logic. Or maybe it's about the problems of an avant-garde mindset: if you're someone who likes to experiment with random circuit configurations or strange bit-shifting formulas, you're likely someone who has learned to appreciate the glitch esthetics and never really wants to go far beyond that.

Demoscene is in a special position here, as technological mismatch is irrelevant there. In the era of gigabytes and terabytes, demoscene coders are exploring the potential of ever shorter program sizes. And despite this, the sense of esthetics is more traditional than with circuit-benders and avant-garde artists. The hack value of a tiny softsynth depends on how much its output resembles "real, big music" such as Italo disco.

The softsynths used in the 4-kilobyte size class are still quite engineered. They often use tight code to simulate the construction of an analog synthesizer controlled by a stored sequence of musical events. However, as 256 bytes is becoming the new 4K, there has been ever more need to play decent music in the 256-byte size class. It is still possible to follow the constructivist approach in this size class -- for example, I've coded some simple 128-byte players for the VIC-20 when I had very little memory left. However, since the recent findings suggest that an approach with a lot of random experimentation may give better results than deterministic hacking, people have been competing in finding more and more impressive musical formulas. Perhaps all this was something that just had to come out of the demoscene and nowhere else.

Something I particularly like in this "movement" is its immediate, hands-on collaborative nature, with people sharing the source code of their findings and basing their own experimentation on other people's efforts. Anyone can participate in it and discover new, mind-boggling stuff, even with very little programming expertise. I don't know how long this exploration phase is going to last, but things like this might be useful for a "Pan-Hacker movement" that advocates hands-on hard-core hacking to greater masses. I definitely want to see more projects like this.

How profound is this?

Apart from some deterministic efforts that quickly bloat the code up to hundreds of source-code characters, the exploration process so far has been mostly trial-and-error. Some trial-and-error experimenters, however, seem to have been gradually developing an intuitive sense of what kind of formulas can serve as ingredients for something greater. Perhaps, at some time in the future, someone will release some enlightening mathematical and music-theoretical analysis that will explain why and how our algorithms work.

It already seems apparent, however, that stuff like this stuff works in contexts far beyond PCM audio. The earlier 8-bit experiments, such as the C-64 Wallflower, quite blindly write values to sound and video chip registers and still manage to produce interesting output. Media artist Kyle McDonald has rendered the first bunch of sounds into monochrome bitmaps that show an interesting, "glitchy" structure. Usually, music looks quite bad when rendered as bitmaps -- and this applies even to small chiptunes that sound a lot like our experiments, so it was interesting to notice the visual potential as well.


I envision that, in the context of generative audiovisual works, simple bitwise formulas could generate source data not only for the musical output but also drive various visual parameters as a function of time. This would make it possible, for example, for a 256-byte demoscene production to have an interesting and varying audiovisual structure with a strong, inherent synchronization between the effects and the music. As the formulas we've been experimenting with can produce both microstructure and macrostructure, we might assume that they can be used to drive low-level and high-level parameters equally well. From wave amplitudes and pixel colors to layer selection, camera paths, and 3D scene construction. But so far, this is mere speculation, until someone extends the experimentation to these parameters.

I can't really tell if there's anything very profound in this stuff -- after all, we already have fractals and chaos theory. But at least it's great for the kind of art I'm involved with, and that's what matters to me. I'll probably be exploring and embracing the audiovisual potential for some time, and you can expect me to blog about it as well.

Edit 2011-10-29: There's now a more detailed analysis available of some formulas and techniques.

245 comments:

«Oldest   ‹Older   201 – 245 of 245
Ananya Krishnan said...

Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

Good to learn about DevOps at this time.


devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

Shivani Yuvanjalin said...

Excellent post. Thank you for sharing.
SAP R3 Support in Chennai
SAP Hana Support in Chennai
SAP Support in India
SAP R3 in India
HR Payroll Software
Leave Management Software

lekha mathan said...

Such an excellent and interesting blog, do post like this more with more information, this was very useful, Thank you.
Aviation Academy in Chennai
Aviation Courses in Chennai
best aviation academy in chennai
aviation training in chennai

nivatha said...

This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
Data Science course in Chennai | Best Data Science course in Chennai
Data science course in bangalore | Best Data Science course in Bangalore
Data science course in pune | Data Science Course institute in Pune
Data science online course | Online Data Science certification course-Gangboard
Data Science Interview questions and answers

john jersy said...

This is beyond doubt a blog significant to follow. You’ve dig up a great deal to say about this topic, and so much awareness. I believe that you recognize how to construct people pay attention to what you have to pronounce, particularly with a concern that’s so vital. I am pleased to suggest this blog.
python training Course in chennai
python training in Bangalore
Python training institute in bangalore

Afiah B said...

This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 

Java interview questions and answers

Core Java interview questions and answers

Java training in Chennai | Java training in Tambaram

Java training in Chennai | Java training in Velachery

Praylin S said...

Great post. I was looking for this type of posts for a while. I'm glad that I came across this. Regards.
C C++ Training in Chennai | C Training in Chennai | C++ Training in Chennai | C++ Training | C Language Training | C++ Programming Course | C and C++ Institute | C C++ Training in Chennai | C Language Training in Chennai

Praylin S said...

Great post! Such an informative article written in a clear and precise manner. Expecting more posts from you.
Placement Training in Chennai | Training institutes in Chennai with Placement | Best Training and Placement institutes in Chennai | Placement Training institutes | Placement Training Centres in Chennai | Placement Training institutes in Chennai | Best Placement Training institutes in Chennai | Training and Job Placement in Chennai | Training come Placement in Chennai | Placement Courses in Chennai | Training and Placement institutes in Chennai

Anjali Siva said...

Good to see this blog admin, really helpful to me. Share more like this.
UiPath Training in Chennai
UiPath Training
UiPath Training near me
RPA UiPath Training
UiPath Course
UiPath Training Institutes in Chennai

Nadeem Malik said...

hi, nice information is given in this blog. Thanks for sharing this type of information, it is so useful for me. nice work keep it up.digital marketing company in delhi

Nadeem Malik said...

visa immigration service in delhi

sachin.ogeninfo said...

cattle feed bags supplier

Ram priya said...

All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.


Data Science course in Chennai | Best Data Science course in Chennai
Data science course in bangalore | Best Data Science course in Bangalore
Data science course in pune | Data Science Course institute in Pune
Data science online course | Online Data Science certification course-Gangboard
Data Science Interview questions and answers

Riya Raj said...

The blog which you have shared is very useful for us. Thanks for your information.
Software Testing in Coimbatore
Software Testing Training in Coimbatore
Software Testing Course in Coimbatore with placement
Best Software Testing Training Institute in Coimbatore
Software Testing Training Center in Coimbatore

Infocampus said...

Nice post with much information

selenium training in Bangalore
selenium courses in Bangalore
selenium training in Marathahalli
selenium training institute in bangalore


best web development training in Bangalore
web development course in bangalore
best web development training in Bangalore
web development training in Marathahalli

techbindhu

Daniel Vesely said...

People usually try to find out Gray Hair Treatment on different sites. But i will provide you with a special solution right here, right now. Getting a proper color Gray Hair Dye is very tough task. But you dont have to worry about it. Reparex provie a large variety of products including Reparex For Mustache and Reparex for men too. Feel free to share this information with other friends too.

Vikash Kumar said...

tile bonder manufacturer in delhi

Splendid Interiors said...

Ah,so beautiful and wonderful post!An opportunity to read a fantastic and imaginary blogs.It gives me lots of pleasure and interest.Thanks for sharing.
Find the Interior Designers in Vijayawada

Akash Thakur said...

Laminated Doors manufacturer in hubli

Ananya Krishnan said...

Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

Good to learn about DevOps at this time.


devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

Amase LED Lighting said...

led lawn lights in delhi
Thanks for giving great kind of information. So useful and practical for me. Thanks for your excellent blog, nice work keep it up thanks for sharing the knowledge.

Rithi Rawat said...

Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's. machine learning course fees in chennai

machine learning training center in chennai

machine learning with python course in chennai

Praylin S said...

Awesome post with valid information. Thanks for sharing this great post. Keep blogging. Regards.
Corporate Training in Chennai | Corporate Training institute in Chennai | Corporate Training Companies in Chennai | Corporate Training Companies | Corporate Training Courses | Corporate Training

ananthinfo said...

nice post..
SAP BUSINESS ONE for leather solution
ERP for leather solution
ERP leather garment solution
SAP BUSINESS ONE for leather garment solution
ERP for footwear solution

Unknown said...

Awesome post! Thanks for sharing this valuable information.
LINUX Training in Chennai | LINUX Course in Chennai | Best LINUX Training institute in Chennai | Best LINUX Training in Chennai | Learn LINUX | LINUX Certification | LINUX Course | LINUX Certification Courses in Chennai | LINUX Training

rekha said...

Goyal packers and movers in Panchkula is highly known for their professional and genuine packing and moving services. We are top leading and certified relocation services providers in Chandigarh deals all over India. To get more information, call us.
Packers and movers in Chandigarh
Packers and movers in Panchkula
Packers and movers in Mohali
Packers and movers in Zirakpur
Packers and movers in Patiala
Packers and movers in Ambala
Packers and movers in Ambala cantt
Packers and movers in Pathankot
Packers and movers in Jalandhar
Packers and movers in Ludhiana


aruna ram said...

This is very great thinks. It was very comprehensive post and powerful concept. Thanks for your sharing with as. Keep it up....
Web Designing Course in Bangalore
Web Designing Training in Bangalore
Web Designing Training in Tnagar
Web Designing Training in Velachery
Web Designing Course in Omr
Web Designing Training in Tambaram

Allan Shan said...

The best way to find the best Best Online Dj Equipment is to go to google and then search the term Dj Supplies. You can get details about any kind of DJ Equipment, DJ Gears DJ filters and DJ Lighting on our official website.

lather said...

Goyal packers and movers in Panchkula is highly known for their professional and genuine packing and moving services. We are top leading and certified relocation services providers in Chandigarh deals all over India. To get more information, call us.


Packers and movers in Chandigarh
Packers and movers in Panchkula
Packers and movers in Mohali
Packers and movers in Zirakpur
Packers and movers in Patiala
Packers and movers in Ambala
Packers and movers in Ambala cantt
Packers and movers in Pathankot
Packers and movers in Jalandhar
Packers and movers in Ludhiana

lather said...

If you live in Delhi and looking for a good and reliable vashikaran specialist in Delhi to solve all your life problems, then you are at right place. 
love marriage specialist in delhi

vashikaran specialist in delhi

love vashikaran specialist molvi ji

get love back by vashikaran

black magic specialist in Delhi

husband wife problem solution

lather said...

Thinking of growing as best packers and movers in Mohali? Just click on click track india, and you are ready for the skyrocket sales.

Packers and movers in Chandigarh

Packers and movers in Mohali

Packers and movers in Noida

Packers and movers in Gurgaon

Packers and movers in Delhi NCR

Nadeem Malik said...

hello sir,
thanks for giving that type of information.
digital marketing company in delhi
Hp Plotter Dealer in Delhi
Best Ways to Optimize Your Website for Lead Generation

REKHA PUNIA said...

If you live in Delhi and looking for a good and reliable vashikaran specialist in Delhi to solve all your life problems, then you are at right place. 
love marriage specialist in delhi

vashikaran specialist in delhi

love vashikaran specialist molvi ji

get love back by vashikaran

black magic specialist in Delhi

husband wife problem solution

lekha mathan said...

I have gone through your blog, it was very much useful for me and because of your blog, and also I gained many unknown information, the way you have clearly explained is really fantastic. Kindly post more like this, Thank You.
Aviation Academy in Chennai
Aviation Courses in Chennai
best aviation academy in chennai
aviation institute in chennai

neha said...

Thinking of growing as best packers and movers in Mohali? Just click on click track india, and you are ready for the skyrocket sales.

Packers and movers in Chandigarh

Packers and movers in Mohali

Packers and movers in Noida

Packers and movers in Gurgaon

Packers and movers in Delhi NCR

Packers and movers in Bangalore

Shivani Yuvanjalin said...

Thanks for Sharing..
ERP in Chennai
ERP Software in Chennai
SAP Business One implementation Chennai
SAP Hana implementation Chennai
SAP r3 implementation Chennai

sakthi said...

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

rpa training in chennai
Best rpa training in bangalore
rpa course in bangalore
rpa training in marathahalli
rpa training in btm
best rpa training in chennai

jenifer irene said...

Very good information provided, Thanks a lot for sharing such useful information.
air hostess training in Bangalore
air hostess academy Bangalore
cabin crew course in Bangalore
cabin crew training in Bangalore

Praylin S said...

It takes a lot of effort to write such a great content. I appreciate your talent. Thanks for sharing. Looking forward for more from you.
Microsoft Dynamics CRM Training in Chennai | Microsoft Dynamics Training in Chennai | Microsoft Dynamics CRM Training | Microsoft Dynamics CRM Training institutes in Chennai | Microsoft Dynamics Training | Microsoft CRM Training | Microsoft Dynamics CRM Training Courses | CRM Training in Chennai

aruna ram said...

This blog is very interesting and powerful content. I got more important information and it's very useful for improve my knowledge.
Tableau Certification in Bangalore
Tableau Training Institutes in Bangalore
Tableau Classes in Bangalore
Tableau Coaching in Bangalore
Tableau Training in Bangalore

Vignesh said...

Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
angularjs Training in chennai

angularjs-Training in pune

angularjs-Training in chennai

angularjs Training in chennai

angularjs Training in chennai

angularjs-Training in tambaram

Rithi Rawat said...

Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.

Machine learning training in chennai

machine learning course fees in chennai

machine learning training center in chennai

SANDY said...

Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
AWS Training in Chennai |Amazon Web Services Training in Chennai
AWS Training in Rajaji Nagar |Best Amazon Web Services Training in Rajaji Nagar
AWS Amazon Web Services Training in Chennai | AWS Training and Certification for Solution Architect in Chennai
AWS Training Institute in Bangalore | AWS Course in Bangalore



Riya Raj said...

Blog is really great!!! Thanks for the sharing…
Angularjs Training in Chennai
Angularjs Training in Bangalore
Angularjs course in Chennai
Angularjs Training Institute in Bangalore

Vijay Sethupathi said...

Great Posting…
Keep doing it…
Thanks

Digital Marketing Certification Course in Chennai - Eminent Digital Academy

«Oldest ‹Older   201 – 245 of 245   Newer› Newest»