Coder Social home page Coder Social logo

musicfromsmallprograms's Introduction

musicfromsmallprograms

A helper script for writing music in the form of small c programs

Inspired by this blog post: http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html

There are already several online implementations of this, mostly in javascript. However, none of them allow you to download the resulting file, and using the online version requires you to be online. Since it's already so easy to do this from the command line, I figured -- why not write a helper script, in good UNIX style, to provide the means to listen to and record these experiments?

Requirements:

  • zsh
  • sox (with soxplay)
  • a c compiler with support for the -o flag

Usage: ./smallprogram.sh -cc compiler -rate bitrate -duration seconds script filename.wav

If you provide an output filename, the script will produce a file with that filename, whether or not one already exists. If you do not provide an output filename, it will use sox to play the result.

Examples:

./smallprogram.sh 't&t>>8' # play the plain vanilla 'sierpinski harmony'

./smallprogram.sh -rate 8000 '((t\*(t>>8|t>>9)&46&t>>8))^(t&t>>13|t>>6)' # play xpansive's 'Lost in Space' from http://pouet.net/topic.php?which=8357&page=2

For a lot of interesting examples, try viznut's collection of notable one-line music formulas. To try to build your own more scientifically, take a look at his blog post, analysing the attributes of these formulas.

musicfromsmallprograms's People

Contributors

enkiv2 avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.