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.
73
questions
1
vote
7
answers
476
views
Relations between interval and semitones
Output this table:
-2*
-1*
-
0
-
1
2
-1*
0
1
-
2
3
4
1
2
3
-
4
5
6
3
4
-
5
-
6
7
5
6
-
7
-
8
9
6
7
8
-
9
10
11
8
9
10
-
11
12
13
10
11
-
12
-
13
14
You can output one string with two types of ...
12
votes
2
answers
992
views
Can Bitshift Variations in C Minor be compressed down to less than 185 characters?
Bitshift Variations in C Minor by Robert Miles is a Code Golf music piece written in C (with some additional bash commands). It was originally presented in a 2016 Computerphile video Code Golf & ...
10
votes
4
answers
783
views
Identify 22-TET intervals
Objective
Given the distance between two keys in an octave, identify its name.
But there's a caveat. In this challenge, there are 22 keys in an octave, not usual 12.
Here, a porcupine[7] scale will be ...
8
votes
7
answers
534
views
Print the notes of an increasing octave-repeating scale
Challenge
To quote Wikipedia:
An octave-repeating scale can be represented as a circular arrangement
of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing ...
10
votes
6
answers
760
views
Counting Rhythms
The Narrative
You are a bad musician. You never bothered to learn how to count rhythms. To remedy this shortcoming, you decide to write a program that will tell you how to count in any given time ...
10
votes
7
answers
471
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, ...
21
votes
13
answers
2k
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 ...
1
vote
0
answers
117
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 ...
9
votes
8
answers
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 ...
7
votes
7
answers
861
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:
...
19
votes
13
answers
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 ...
14
votes
7
answers
592
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 ...
11
votes
7
answers
2k
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 ...
16
votes
9
answers
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 ...
14
votes
11
answers
623
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. ...
23
votes
12
answers
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:...
22
votes
3
answers
695
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 ...
20
votes
11
answers
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:
...
12
votes
7
answers
22k
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 ...
36
votes
18
answers
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" ...
32
votes
3
answers
4k
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 ...
6
votes
2
answers
489
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:
...
9
votes
5
answers
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, ...
20
votes
1
answer
430
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 ...
47
votes
16
answers
8k
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, ...
21
votes
4
answers
733
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 ...
7
votes
1
answer
507
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 (...
29
votes
8
answers
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 ...
17
votes
14
answers
1k
views
Translate number pairs to guitar notes
A guitar fretboard diagram looks like this:
...
12
votes
7
answers
603
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). ...
35
votes
27
answers
5k
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-...
21
votes
11
answers
4k
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 ...
7
votes
1
answer
245
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:
...
34
votes
17
answers
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 ...
11
votes
1
answer
214
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 ...
31
votes
10
answers
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 ...
11
votes
3
answers
542
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 ...
8
votes
2
answers
900
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 ...
7
votes
4
answers
515
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 ...
14
votes
5
answers
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 ...
42
votes
11
answers
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 ...
4
votes
3
answers
210
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 ...
28
votes
1
answer
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 ...
17
votes
4
answers
820
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 ...
9
votes
7
answers
506
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 ...
11
votes
4
answers
522
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 ...
6
votes
7
answers
615
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
votes
1
answer
388
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 <...
11
votes
3
answers
692
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.
...
9
votes
1
answer
488
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-...