Skip to content

An interactive music synthesizer that generates notes through probability distributions

License

Notifications You must be signed in to change notification settings

taeukkang/serendipitous-maestro

Repository files navigation

The Serendipitous Maestro

Taeuk Kang 2023-06-04

Introduction

The Serendipitous Maestro is an interactive music synthesizer that generates notes through probability distributions only. Each sequence contains 16 beats, and each note (frequency) can only be generated with a random number generated by probability distribution.

Note This project won the Bronze Award in Stanford's CS109 Challenge in Spring 2023.

Demonstration

Launch the web app to make your own music: https://projects.taeuk.net/serendipitous-maestro. A recorded video demonstration is also available.

Getting Started

Install necessary dependencies and run the development server:

npm install
npm run dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

Problem

There are a lot of existing methods where we can visualize a distribution through graphs, data tables, as well as art generation algorithms that are powered by probability distributions. However, we learn through different methods and visualization may not be accessible for everyone. The Serendipitous Maestro resolves allows us to interact and understand probability distributions through audio without relying on traditional methods of visualization. The app also supports keyboard navigation in order to make the site accessible to people with visual impairments.

Distributions

Normal

A normal distribution is a common distribution used to model a lot of real-life situations. In this app, the user can supply two parameters: mean and standard deviation. The app uses these parameters and seeds a random number generator that will output numbers so that it is distributed by a normal distribution.

Poisson

A Poisson distribution is a discrete distribution used to model a number of events occurring per time period. The rate parameter can be modified by the user.

Uniform

A uniform distribution is used to model a number uniformly from the minimum to the maximum. This allows a wide range of frequency to be generated with equal probability, adding interesting variations to the music.

Pareto

A Pareto distribution is used to model real-life observable events based on two parameters: the shape and scale.

Binomial

A binomial distribution is used to model the number of successes in an experiment with n trials. Here, the number of successes can be used as the frequency value by adjusting the number of trials and probability of success. A higher frequency indicates that there were more successes for a given experiment.

Bernoulli

The “Randomize Notes” button is powered by a Bernoulli distribution and acts as a fair coin flip. For each beat out of the 16 beats, if the coin lands on heads, the corresponding random function gets called and sets a beat. If not, the beat is removed.

“Distrument”

Each distribution is linked to an instrument (as of now, synthesizers). The pair of distribution and instrument is called a distrument (distribution + instrument), and each distrument can be customized by statistical parameters as well as the instrument (e.g. AM/FM/metal/pluck synthesizer).

Limitations

For continuous distributions that can provide a floating point number, the app rounds the generated number to the nearest integer for the ease of visualization and audio processing.

Technical Implementation

The project uses React and Next.js to render the web app. Tone.js is used as an abstraction over the Web Audio API. stdlib is used for random number generation. The Bing Image Creator was used to generate the logo, with the following prompt: Create a logo for "The Serendipitous Maestro" which is a web app that uses probability distributions (e.g. normal, poisson) to generate a [sic] music.

Future Work

There are some improvements that I would like to address in the future. Most importantly, there are some bugs that I would like to fix relating to performance. I would also expand the set of available instruments (e.g. drums, piano, etc.) so that a diverse harmony of sounds can be generated. Improving accessibility for screen readers will also benefit more users.

License

GNU GPLv3

About

An interactive music synthesizer that generates notes through probability distributions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published