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.

1,455 comments:

«Oldest   ‹Older   1401 – 1455 of 1455
Aishwariya said...

Thanks for sharing a valuable blog. Keep sharing. AWS Certification Course in Chennai

Data Science Course in Varanasi - 360DigiTMG said...

Really wonderful blog completely enjoyed reading and learning to gain the vast knowledge. Eventually, this blog helps in developing certain skills which in turn helpful in implementing those skills. Thanking the blogger for delivering such a beautiful content and keep posting the contents in upcoming days.

data science training institute in bangalore

Anuradha Jadoun said...

I read this blog, Thanks for sharing this information.

Spoken English Classes in Mumbai

data analytics courses in bangalore with placement - 360DigiTMG said...

Highly appreciable regarding the uniqueness of the content. This perhaps makes the readers feels excited to get stick to the subject. Certainly, the learners would thank the blogger to come up with the innovative content which keeps the readers to be up to date to stand by the competition. Once again nice blog keep it up and keep sharing the content as always.

data analytics courses in bangalore with placement

salome said...

informative blog .useful for all
thank you
best-angular-training in chennai |

angular-Course in Chennai

https://www.credosystemz.com/training-in-chennai/best-angularjs-training-in-chennai//">

Spoken English Classes in Mumbai said...

I read this blog, keep sharing such type of interesting blog.

Pallavi reddy said...

i am glad to discover this page : i have to thank you for the time i spent on this especially great reading !! i really liked each part and also bookmarked you for new information on your site.
cyber security training in bangalore

rauhne said...

Be-ro-ma

Be-ro-ma

Be-ro-ma

Be-ro-ma

rauhne said...

Be-ro-ma

Be-ro-ma

Be-ro-ma

Be-ro-ma

rauhne said...

Be-ro-ma

Be-ro-ma

Be-ro-ma

Be-ro-ma

Addons said...

brochure design in los angeles
brand design company in los angeles
graphic design company in los angeles
cms web design company in los angeles
digital marketing company in los angeles

AchieversIT said...

Really nice and informative blog, keep it up. Thanks for sharing and I have some suggestions.
if you want to learn pyhton Programming, Join Now Python Training in Bangalore.
Here is a Website- Software Training in Bangalore | AchieversIT
This may help you to find something useful

designingcourses said...

Very Informative and useful... Keep it up the great work. I really appreciate your post.

https://designingcourses.in/graphic-designing-courses-in-bangalore/
https://designingcourses.in/web-designing-course-in-bangalore/

James said...

Thanks for sharing. Hotmail.com login

Unknown said...

Really nice post. Thank you for sharing amazing Blog information.
Yahoo Forgot Password - Change Password - Password Recovery Online

Pallavi reddy said...

i am glad to discover this page : i have to thank you for the time i spent on this especially great reading !! i really liked each part and also bookmarked you for new information on your site.
data scientist course in bangalore

BANDARQ said...

Cari Situs Judi Online yang fair ?
No BOT - No ADMIN dan murni PLAYER vs PLAYER
Solusinya hnya di CrownQQ Agen DominoQQ BandarQ dan Domino99 Online Terbesar
Bonus Rollingan 0,5% Setiap senin
Bonus Referal 20% Seumur hidup
Hanya dengan nominal deposit Rp 20.000 sudah bisa bermain 10 game.
Raih jackpot puluhan sampai ratusan juta setiap harinya..

Ayo gabung sekarang juga hanya dengan
mengklick Daftar CrownQQ

BACA JUGA BLOGSPORT KAMI:
CrownQQ
Agen BandarQ
Tips & Trik
Tentang Wanita
Berita dan Info Dunia

achieversit Training said...

It is very usefull blog. Thanks for sharing
UI Development Training In Bangalore
Angular Development Training In Bangalore
React Js Training Institute In Bangalore
Python Training In Bangalore

BtreeSystem Training said...

hadoop training in chennai
machine learning training chennai
aws training in chennai
IoT Training in Chennai
php training in chennai

BANDARQ said...

Suka uang? Suka game? Mau bonus?
Buruan join ke CrownQQ Agen DominoQQ BandarQ dan Domino99 Online Terbesar
Bonus Rollingan 0.5% setiap senin
Bonus Refferal 20% seumur hidup
Lumayan loh bisa nambah penghasilan ^_^
WHATSAPP : +6287771354805
LINE : CS CROWNQQ

Menyediakan Deposit Pulsa Telkomsel, OVO, DANA, GOPAY, & LINK AJA

Info Lebih lanjut Kunjungi :
CrownQQ
Daftar CrownQQ

BACA JUGA BLOGSPORT KAMI:
CrownQQ
Agen BandarQ
Tips & Trik
Tentang Wanita
Berita dan Info Dunia

AchieversIT said...

Really nice and informative blog, keep it up. Thanks for sharing and I have some suggestions.
if you want to learn pyhton Programming, Join Now Python Training in Bangalore.
Here is a Website- Software Training in Bangalore | AchieversIT
This may help you to find something useful

ManojchowdaryPORTFOLIO said...

AchieversIT- Best UI Development Training Institute in Bangalore

AchieversIT UI Development training in Bangalore provides a detailed explanation with real-world examples to make participants understand what is all about UI Development Course in Bangalore, benefits, scope, and future.

* They are responsible for RWD(Responsive Web Design)
*Performs a Key role in taking decisions
*Always Demand in the Market
*Best salaries

URL:https://www.achieversit.com/ui-development-training-course-institute-in-bangalore

Vijayakash said...

it was so good to read and useful to improve my knowledge as updated one, keep blogging…

German Classes in Tambaram
German Classes in Anna Nagar
German Classes in Velachery
German Classes in T Nagar
German Classes in Porur
German Classes in OMR
German Classes in chennai

Vijayakash said...

it was so good to read and useful to improve my knowledge as updated one, keep blogging…

German Classes in Tambaram
German Classes in Anna Nagar
German Classes in Velachery
German Classes in T Nagar
German Classes in Porur
German Classes in OMR
German Classes in chennai

EC Concept said...

Thanks for sharing the info Amazing write-up! Looking for more content

Unknown said...

This article will outline all the different strategies you should be aware of when it comes to soccer.

best ias coaching in india

Unknown said...

This article will outline all the different strategies you should be aware of when it comes to soccer.

best ias coaching in india

Nearlearn said...

very very informative post for me thanks for sharing

Best Machine Learning Classroom Training in Bangalore

suryakumar said...

This post is much helpful for us.
Hadoop Training Institute
AngularJS Online Training
SAS Training in T Nagar

KPR Night said...

This post is informative, and, we are launching an app and you can get it from here KPR Night Light Bluetooth Speaker.

AchieversIT said...


Really nice and informative blog, keep it up. Thanks for sharing and I have some suggestions.
if you want to learn pyhton Programming, Join Now Python Training in Bangalore.
Here is a Website- Software Training in Bangalore | AchieversIT
This may help you to find something useful

The Skill Pedia said...

RHCSA Certification Training online
RHCE Certification online Training
Oracle Performance Tuning Training
Perl Scripting Training online

Joe said...

Organic Chemistry tutor

Vijayakash said...

It is really a great work and the way in which u r sharing the knowledge is excellent

Android Training in Tambaram
Android Training in Anna Nagar
Android Training in Velachery
Android Training in T Nagar
Android Training in Porur
Android Training in OMR
Android Training in Chennai

AchieversIT said...



Really nice and informative blog, keep it up. Thanks for sharing and I have some suggestions.
if you want to learn Mobile App Development(android, iOS), Join Now Mobile App Training in Bangalore.
Visit a Website:- Android Training in Bangalore | AchieversIT
This may help you to find something useful

Home Improvement said...

Great post I must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more. Best PPC Management Tool

Asha24 said...

Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
rpa online training

Mallela said...

Thanks for posting the best information and the blog is very important.digital marketing institute in hyderabad

AchieversIT said...

Thank you so much for sharing all this amazing information, keep it up.
are you want to make a career in Full-Stack Development. check this Full-Stack Development Course in Bangalore.
Attend The Best Full-Stack development Certification Training In India From AchieversIT. Practical Training Sessions With Assured Placement Support From Experienced Faculty. and also proving live projects
AchieversIT Training Institution

arshiya fouzia said...

Awesome,I have gained more knowledge from your blog,keep sharing such blogs.
digital marketing training in chennai

AchieversIT said...

Thank you for your blog , it was usefull and informative "AchieversIT is the best Training institute for Full Stack development training. Full Stack developement training in bangalore "

local stores said...

This is an informative post, looking for more. Please find local stores on fyndhere ios and andriod app

local stores said...

This is an informative post, looking for more. Please find local stores on fyndhere ios and andriod app

Michael Oliver said...

Good blog,

Digital Marketing Companies in Chennai, Website Design Companies in Chennai, SEO Companies in Chennai, Digital Marketing Company Chennai, Web Design Company Chennai

https://wisewebtek.com

shakunthala said...

valid information
thanks for sharing this information
job guaranteed courses in bangalore
full stack developer course

Best Toys In USA said...

Best Adult Toys in USA We strive to have a positive impact on small to medium businesses, customers, employees, the economy, and communities. Surjmor bring together smart, passionate builders with different backgrounds and goals, who share a common desire to always be learning and inventing on behalf of our customers. With all the family of business that are a part of us, our goals is providing customers with the best service possible.

https://xxxtoys.top/product-category/adult-toys/

Girl said...

Great post. keep sharing such a worthy information

Big data training in chennai
Big Data Course in Chennai

Janardhan said...

Are you dreaming to a become a Farmer by learning advanced Agricultural practices?

Or the one who is trying to learn traditional Farming activities That are in trend space in 2021?


Are you dreaming to a become a Farmer by learning advanced Agricultural practices?

Or the one who is trying to learn traditional Farming activities That are in trend space in 2021?

Or the one looking for the best online platform shares information about the list of Agricultural activities?

Are you looking for the same?

Then you are not alone! There are Thousands of Farming enthusiasts like you.

We all aware that food is the most necessary for every human being on the earth cannot survive without food.

Our ancients were lived their lives by farming necessary crops in their farmlands without depending on others for food.

But in the current digital world, none of us know how to do agriculture, though we belong to farming families.

So, we thought of recalling the best sustainable Agricultural activities used by our ancients.

Are you excited? If your answer is wasting time is not a good practice.

Then, jump into real Farming fun.

Here is the list of different types of sustainable Indian agricultural practices. Our team has added detailed information about each Farming activity.

deliveryguru said...

Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live.
Fish and chips takeaway
Tartan Glasgow
Traditional Chippy
best fast food restaurants
fish supper near me
bite me sandwich bar
Glasgow Climbing centre

Michael Oliver said...

Good blog,

Digital Marketing, Digital Marketing Online Training, Digital Marketing Training Programs, Women Entrepreneurship, Women Entrepreneurship Training Programs, Digital marketing online video course, Women Entrepreneurship Online Certification Course, Business coaching, Training for Business owners, Business coaching for women, young entrepreneurs training

https://www.eminentdigitalacademy.com

AchieversIT said...

Really nice and informative blog, keep it up. Thanks for sharing and I have some suggestions.
if you want to learn Mobile App Development(android, iOS), Join Now Mobile App Training in Bangalore.
Visit a Website:- Android Training in Bangalore | AchieversIT
This may help you to find something useful

AchieversIT said...

Really nice and informative blog, keep it up. Thanks for sharing and I have some suggestions.
if you want to learn Mobile App Development(android, iOS), Join Now Mobile App Training in Bangalore.
Visit a Website:- Android Training in Bangalore | AchieversIT
This may help you to find something useful

fuel digita said...

Great article with excellent idea i appreciate your post thankyou so much and let keep on sharing your stuffs
Best woocommerce development company
best web designig company in chennai
best google adwords campaign agencies in chennai
Local SEO services in Chennai
google adwords service in chennai
best google adwords campaign agencies in chennai
Branding companies in Chennai

AchieversIT said...

Thank you so much for sharing all this amazing information, keep it up.
are you want to make a career in Full-Stack Development. check this Full-Stack Development Course in Bangalore.
Attend The Best Full-Stack development Certification Training In India From AchieversIT. Practical Training Sessions With Assured Placement Support From Experienced Faculty. and also proving live projects
AchieversIT Training Institution

Devi said...

Infycle Technologies, the No.1 software training institute in Chennai offers the best Oracle course in Chennai for tech professionals and students at the best offers. In addition to the Oracle training, other in-demand courses such as Python, Selenium, Big Data, Java, Python, Power BI, Digital Marketing will be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.Best Oracle Course in Chennai | Infycle Technologies

«Oldest ‹Older   1401 – 1455 of 1455   Newer› Newest»