# Questions tagged [music]

This tag indicates that the challenge involves music, e.g. taking music as input, producing music as output or handling musical notes.

68 questions
Filter by
Sorted by
Tagged with
437 views

### Sort musical pitches

Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest. Pitches will be given in scientific pitch notation, ...
• 10.3k
1k views

### Output the 12 Bar Blues

Note to those without experience in music: Through making an attempt to solve this problem, you may find that music and computer programming are similar in the ways that they implement rules and ...
• 757
1 vote
113 views

### Random musical harmonies [closed]

The challenge. Make a program that produces a random series of 8 notes in the scale of E minor, and then harmonizes them. Details. Notes must be represented in output as a 1-2 char string, which ...
• 37
2k views

### Music with pi and e

Because I forgot to celebrate Pi Day (14.3), let's celebrate with $\pi$, $e$ (Euler's number) and music! Challenge No, we don't have time to eat a pi-pizza, let's make a program. What you need is ...
• 3,585
794 views

### How predictable is popular music?

The McGill Billboard Project annotates various audio features of songs from a random sample of the Billboard charts. I scraped this data to produce the following file of chord progressions: ...
• 2,229
1k views

### Are the beams above or below the notes?

In musical notation, groups of notes shorter than one beat are joined together by a line at the bottom called a beam. Here are a few bars of music with the beams highlighted: (Taken from Second Suite ...
• 1,447
568 views

### Make a random drum loop

Do randomly generated drum loops sound good? A drum loop is a $5\times 32$ matrix $A$ of $1$s and $0$s such that $A_{1,1}=A_{1,17}=A_{2,9}=A_{2,25}=1$, for each $i$, the $i$th row has ...
• 2,229
1k views

### Approximate the perfect fifth

Starting at 1-TET, give equal temperaments that have better and better approximation of the perfect fifth(just ratio 3/2). (OEIS sequence A060528) The formal description of the sequence, copied from ...
• 4,151
2k views

### Is this a Major Scale (or equivalent)?

Sandbox The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of ...
611 views

### Help me play the Trumpet

The trumpet is a valved aerophone instrument, usually pitched in B♭. The sound is made when the player vibrates their lips to displace air inside the instrument. ...
• 3,373
2k views

### How many semitones

Guidelines Task Given two notes, inputted as strings or lists/arrays, calculate how many semitones apart they are (inclusive of the notes themselves), outputting as a number. Explanation of a semitone:...
• 1,297
649 views

### Draw an ASCII key signature

Given an input of a note, output an ASCII drawing of the corresponding major key on the treble clef. Here are all the major keys (that don't include double-sharps or double-flats) and their ...
• 70.5k
2k views

### Print me a scale

Oh no! I have a theory test soon and I don't remember the scales yet! Help me remember my major scales by printing the following: ...
• 2,273
9k views

### Convert between Music clefs

Before you leave, you do not have to understand much musical notation to do this challenge. EXPLANATION In standard sheet music, double clefs go across the page serving as reference points to the ...
• 1,514
3k views

### Consonance or dissonance?

Given two note names, you are to write a program that determines if the interval formed by these two notes is consonant or dissonant. Introduction In Western music, there are only 12 "different" ...
• 1,965
3k views

### Sheet music ASCII-art generator

Note: Anders Kaseorg warns me that this could be a duplicate of another previous question. It seems so, and I'm sorry I did not find that question before posting this one. Nonetheless, that question ...
• 12.6k
445 views

### Generate chord charts for ukulele

Your task is to write a function which outputs a ukulele chord chart in the following format for a given chord symbol. For instance, for input "G7", it must output: ...
• 2,651
4k views

### Piano Chords on White Keys

Backstory [which is not true] A piano is set up like this: However, on my piano, all of the black keys are broken! I still want to be able to play some chords on my broken piano though. In music, ...
• 40.1k
420 views

### Good Vibrations

The sound of the theremin has been immortalized in The Beach Boys song Good Vibrations. Many also associate its sound with the theme for the original series of Star Trek, though apparently it was a ...
• 3,532
7k views

### Attack, Decay, Sustain, Release

Sound synthesizers use envelope generators to control how certain parameters of the sound (such as overall loudness) change with time. In many synthesizers an envelope is defined by four parameters, ...
• 99.3k
709 views

### What did I just play? Translate guitar fingerings to chords

Related: Music: what's in this chord?, Notes to Tablature, Generating guitar tabs?, Translate number pairs to guitar notes Given a guitar fingering, output the chord it represents. You can use ...
• 533
482 views

### Compose a Song! [closed]

Preface The available keys are the keys of the A through G and A minor through G minor. The Challenge Create a program that creates and saves to a playable audio file a "song" of using (...
1k views

### Play some of Pachelbel's Canon

Output the following excerpt from Pachelbel's Canon in D as audio: Rules Any format/encoding may be used, so long as a codec existed prior to the creation of this challenge Any instrument (a real ...
1k views

### Translate number pairs to guitar notes

A guitar fretboard diagram looks like this: ...
• 44.9k
581 views

### Music Interval Solver

In music theory, an interval is the difference between two pitches. Each pitch is defined by the number of half-steps (The difference between C and C#) or whole steps (The difference between C and D). ...
• 57k
4k views

### Building a Metronome

Introduction Some days ago I needed a metronome for something. I had none available so I downloaded an app from the App Store. The app had a size of 71 MB!!! 71 MB for making tic-toc...?! So code-...
• 459
3k views

### What is the frequency of this note?

Quick musical refresher: The piano keyboard consists of 88 notes. On each octave, there are 12 notes, C, C♯/D♭, D, D♯/E♭, E, F, F♯/G♭, G, G♯/A♭, A, A♯/B♭ and ...
• 57k
238 views

### Brass Fingerings

For this challenge, you need to print out the fingerings for various brass instruments. The notes an instrument can play (as well as their fingerings) are listed below: ...
• 14.2k
1k views

### Find the syncopation

Given an input of a string consisting entirely of qs representing quarter notes and es representing eighth notes, output the ...
• 70.5k
210 views

### Unfold musical jumps

The Dal Segno and Da Capo are two very commonly used musical terms. They mean "from the sign" (𝄋) and "from the beginning" respectively. There is also the idea of the coda (𝄌), which is the very ...
• 70.5k
2k views

### Play "Taps"​​​​

Today, November 11, 2015, is Veterans Day in the United States. "Taps" is the bugle call played at U.S. military funerals: ("Taps" on SoundCloud from vtmiller) It is a ...
• 87.9k
510 views

### Let's Make Music!

Lots of people like to play music for fun and entertainment. Unfortunately, music is pretty difficult sometimes. That is why you're here! Task It's your job to make reading music much easier for those ...
• 399
719 views

### Play an RTTTL song

User quartata posted this challenge, but he neglected the fact that, for whatever reason, he's not able to play MIDI files on his computer. Let's help him out by writing a full program that reads a ...
512 views

### Code me a Jam!!

On occasion I get a little blue and need a little music to cheer me up, but clicking the start button and finding my media player takes sooooooo long. I want a faster way to play a song. The ...
• 4,988
2k views

### RTTTL Obfuscation

RTTTL, or Ring Tone Text Transfer Language is a music format that was invented by Nokia in the dawn of time when dinosaurs roamed the land. It allows for fairly crude pieces of music (no chords or ...
• 11.1k
4k views

### Let us play the ocarina

As we all know, the Zelda series are one of the best game series ever made. In honor of that, let us play some songs on the ocarina. Challenge: Write a program which, given a song, outputs the score ...
• 2,487
206 views

### Output optimal trill fingerings

Note: all array references in this post are zero-indexed. When playing the piano, two notes on the same key must be pressed with two different fingers. You could use the same finger, but it doesn't ...
• 994
1k views

### ASCII Scores ­­­­­

Digging around in the depths of your temp folder, you find some compositions for the piano. Unfortunately, these compositions were written with note names and durations only, and you only have access ...
• 9,165
796 views

### Display a MIDI Track

Background MIDI files are quite different from WAV or MP3 audio files. MP3 and WAV files contain bytes representing a "recording" of the audio, while MIDI files have a series of MIDI messages stored ...
• 2,462
495 views

### Find the longest musical substring

A musical string is any string that can be played on a piano keyboard. For those of us who weren't forced to learn the piano as kids, here is what the keyboard looks like. So the string ...
• 57k
506 views

### The Sound of Words

People have written many things allowing one thing to be visualized as another. Now I propose being able to translate letters to music! Its your job to write a program that takes a text file and ...
• 25.5k
590 views

### Black or white keys of jazz chords?

When playing the piano, I realized that to play a chord right, I usually need to remember just which tones of the chord are played on white and which on black keys. The rest is usually handled by the "...
• 4,352
376 views

### Print the fingering for the note on a saxophone

Your challenge is, given a series of notes, print the fingerings that minimize the amount of movements you need to make (explained below). My not standard way of transforming fingerings to text: The <...
• 4,404
675 views

### Music: What's the name of this chord?

This is the reverse of Music: what's in this chord?, which is to print the notes in a given chord. This time the input is a list of notes in a chord, and your task is to output which chord it is. ...
• 35.8k
479 views

### Notes to Tablature

Challenge Given a list a notes, you must return the corresponding tablature. Notes The notes must be in the range of A to G inclusive and the octave range being 2 to 6 inclusive. The format is note-...
• 22.7k
916 views

### Help Me Play My Harmonica

Yesterday, I bought a harmonica: Figure 1: The harmonica. However, my dreams of being able to play soulful blues harmonica that moves people and causes a grown man to cry were quickly dashed by two ...
• 8,599
1k views

### Musical Quines on an ASCII Piano

There are 88 keys on a standard piano and 95 printable ascii characters (hex codes 20 through 7E): ...
• 87.9k
926 views

### Organise the Gregorian Church's Music

The year is 930, and the Gregorian Church is having a problem. They have thousands of pages of chant music, but the problem is that all the sheet music was simply thrown onto a pile instead of having ...
• 8,599
469 views

### Tuning Strings­

Task Write a program to determine the note sounded, along with how many cents out of tune, of a string tuned to a given frequency and pressed down at a given point. For the sake of simplicity, ...
• 9,165
2k views

### Print the lyrics to "Twinkle Twinkle Little Star"

Your goal is to print the lyrics to the song "Twinkle Twinkle Little Star" as each note is played. The computer's microphone will hear notes. If the pitch (but not necessarily the length) of ...
• 10.8k