Skip to main content

Questions tagged [music]

In programming, music refers to sound that follows properties distinct from speech or noise, or the symbolic representation, manipulation, and representation (display or audio) of musical objects, or for the metadata of these objects.

Filter by
Sorted by
Tagged with
5 votes
2 answers
2k views

Simple virtual piano

The application is a virtual piano with only one octave for simplicity. What can I improve with this code? ...
Isaí's user avatar
  • 51
1 vote
1 answer
195 views

Python MP3 player with pygame.mixer and tkinter for MacOS

I made a Tkinter MP3 Player with Pygame and am looking for tips to improve. Explanation offered in comments in code, but it generally works by getting all the files in a folder. (Have censored ...
cold10's user avatar
  • 469
3 votes
0 answers
100 views

MIDI editor application

Source I made a project for a class, a MIDI editor written with Java 8 and Swing, and continued working on it on my own. However, I ran into a problem I couldn't solve and gave up. I'd like feedback ...
ShokoN's user avatar
  • 465
2 votes
1 answer
230 views

Converting musical notes to WAV

So, here is my code for converting musical notes stored in a text file to WAV. You can see an example of its output here. ...
FlatAssembler's user avatar
1 vote
1 answer
36 views

Sequences of given addenda whose sum is equal to a given number

Utility to generate sequences of predetermined addenda that add up to a given number. There is also a function for orderly printing and one for converting list of lists in sequence of sequences. The ...
Alberto Capitani's user avatar
0 votes
1 answer
4k views

simple python music quiz [closed]

I'm currently learning python and created a simple music quiz. the rules of the game are as follows: The user has two chances to guess the name of the song If the user guesses the answer correctly ...
Krishna's user avatar
  • 85
6 votes
1 answer
348 views

Generate music notes by specified key and scale

As a follow-up on isosceles' question, I have created a small API to generate the notes of a scale given the pitch class set and key note. I've added the reinventhing-the-wheel tag because I know ...
dfhwze's user avatar
  • 13.9k
1 vote
1 answer
549 views

Script to transpose chords in a song sheet

I'd like to write a script that receives text input from the clipboard that will be from a song lyric sheet with chords. The goal is for the function to return the text to the clipboard after ...
user avatar
7 votes
1 answer
88 views

Haskell PitchClass Algebra, in which notes have various names

I am an OOP programmer by trade (Java) who is extremely new to Haskell and the world of purely functional languages. To get my feet wet, I decided to try and write a little musical interval translator/...
William Oliver's user avatar
4 votes
2 answers
225 views

Music Theory: The Basics - a Ring

I've recently started building an API that allows a consumer to create and manipulate musical entities such as notes, intervals, scales and chords. The first step is to create a a foundation of base ...
dfhwze's user avatar
  • 13.9k
3 votes
1 answer
1k views

Swift function to find a specific set of combinations of 3 digits within a larger integer array

I asked this question on Stack Overflow and was directed here. I'm working on a function that will help me quickly find all the upper structure triads (3-note chord) that I can add to a 4-note 7th ...
Jacob Smolowe's user avatar
7 votes
1 answer
192 views

Warped Audio Sample

I was asked this question and got no feedback, so I'd like to ask you for any feedback on my solution, Thanks! Think of an audio sample as a rubber-band that you want to pin to a musical time ruler. ...
Andrew G's user avatar
  • 195
10 votes
2 answers
1k views

Generating a musical scale from a root note

I'm looking to improve my coding skills. I am new to programming, and after weeks of research and trial and error - I have successfully wrote this basic program to find a music scale by inputting a ...
Richard Christopher's user avatar
7 votes
7 answers
273 views

Calculating frequency of a note from a string

I've been working on a solution to Pset3 of CS50 Harvard course for last couple of hours and managed to finish it. Although it works as intended I'm unhappy with how clean this code is, mostly because ...
Karim's user avatar
  • 145
5 votes
1 answer
941 views

The sheet music of Morning Mood

While learning to play the keyboard, I find it helpful to write down the score of the pieces I play, regardless of whether a score already exists. The code is written using Frescobaldi as IDE and ...
Mast's user avatar
  • 13.4k
5 votes
2 answers
202 views

Dictionary of key signatures for various major and minor scales

I've been working on a simple program that matches a scale with its key signature. It's fairly simple, but I feel there is redundancy in the dict I created since I don't know how I could assign two ...
Jfelix's user avatar
  • 185
2 votes
0 answers
415 views

Find MIDI devices with certain names and make them usable

I'm working on a Swift app for macOS, where I take input from MIDI devices and transform that input. The MIDI devices being supported come in for flavors. What my code does is scan for MIDI devices, ...
Wesley Peeters's user avatar
8 votes
2 answers
1k views

Piano, output all the keys and give a scale

I've two snippets below, the first one output all the keys of a piano and the second one give me a scale when given a starting note. For those who don't know how a piano is structured here is an image ...
Ced's user avatar
  • 199
14 votes
2 answers
3k views

Song lyric generator using Markov Chains - Python

I have written a pop song generator which uses the Markovify library to produce lyrics based on (just for testing purposes) songs by Avril Lavigne. In order to make the generator a bit more ...
ggordon's user avatar
  • 163
3 votes
1 answer
540 views

Generating sinusoidal music as WAV output in JavaScript ES6

This is a single isomorphic class in ES6, written with the intention of generating a full WAV file given note names and durations in seconds. In JavaScript it can ...
Patrick Roberts's user avatar
4 votes
1 answer
385 views

Musical Note Length Calculator in C

This is my first ever program in C and I was just tinkering around with this idea, as I'm on a music based course and the synth plugins all use milliseconds as its time. Any improvements to make it ...
Corey Ford's user avatar
14 votes
3 answers
1k views

Using Fibonacci sequence to generate musical melodies

I recently started picking up the Haskell programming language. I've managed to learn other languages rather quickly, but I'm still having a difficult time grasping some of the basics of Haskell. I ...
Jake Rieger's user avatar
10 votes
2 answers
229 views

Associating degrees with notes of scales

I have a JS file that creates an object with notes from a music scale when given a key (aka tonic/ note). The code works and does what I want it to do. I need a critique on the way it's written, what ...
isosceles's user avatar
  • 149
6 votes
1 answer
3k views

Playing MIDI instruments in Java

This program offers 8 notes C, D, ..., A, B, C on keyboard keys 1, 2, ..., 8. Also, by typing Left or Right, you can cycle over MIDI instruments. KeyboardPiano.java: ...
coderodde's user avatar
  • 28.7k
8 votes
1 answer
396 views

Turning music into an image

I was bored, so I wrote something that could turn .wav files in to .bmps: ...
insanikov's user avatar
  • 539
19 votes
1 answer
256 views

Musical Fizzbuzz

I wrote some code using ChucK : Strongly-timed, Concurrent, and On-the-fly Music Programming Language and would like a review. I broke down the logic into a number of classes, all of which are shown ...
Phrancis's user avatar
  • 20.4k
4 votes
2 answers
327 views

Writing computer generated music to a wav.file in C - follow-up 2

See the previous iteration. What's new: endianness is now handled more gracefully (only one endianness check, and convertion if need be) and music is more funky. ...
coderodde's user avatar
  • 28.7k
10 votes
4 answers
878 views

Writing computer generated music to a .wav file in C - follow-up

See the previous and initial iteration. See the next iteration. Now I have refactored the code according to many suggestions made in the first iteration. What's new: I attempted to deal with ...
coderodde's user avatar
  • 28.7k
45 votes
5 answers
10k views

Writing computer generated music to a .wav file in C

See the next iteration. I wrote this simple C program for writing computer generated music to a WAV file over three years ago. I refactored it a little, but it does not look good to me. Any ...
coderodde's user avatar
  • 28.7k
2 votes
2 answers
101 views

Simple Bash Music Player - follow-up

This question is a follow-up to this question. This is a year later, but it has the same context: I wanted new reviews for the updated code from the original question, but this time I wrote the code ...
Amr Ayman's user avatar
  • 853
10 votes
1 answer
4k views

A Virtual Piano

I have created a virtual piano that turns the home row (excluding 'g' and 'h') and the top row (excluding 'y' and 'u') of the user's keyboard in a piano's keyboard. The home row is used for white ...
SirPython's user avatar
  • 13.3k
4 votes
2 answers
872 views

Creating lists of events (pitches, velocities, delta-times, durations) from a MIDI track

I am trying to understand good design patterns in Python and I cannot think of a way to break this huge function into smaller parts without making the code cluttered, overly complex or plain ugly. I ...
kureta's user avatar
  • 143
4 votes
1 answer
160 views

From sounds (Hz and seconds) to musical theory

The following procedures are an attempt to connect some physical aspects of the sound (frequency and duration) to traditional music theory. Each procedure is accompanied by one or more examples. The ...
Alberto Capitani's user avatar
1 vote
1 answer
93 views

Beat count-to-time converter (task #2)

About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of ...
barak manos's user avatar
  • 1,223
2 votes
1 answer
102 views

Rhythm notation converter (task #1)

About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of ...
barak manos's user avatar
  • 1,223
5 votes
1 answer
184 views

Music note interval trainer

This gives you one note and asks you go up or down the scale for a certain number: ...
qed's user avatar
  • 1,419
0 votes
1 answer
141 views

Music note class - v2

Version 2 of Music note class ...
qed's user avatar
  • 1,419
6 votes
3 answers
815 views

Music note class

A class for notes calculation. ...
qed's user avatar
  • 1,419
9 votes
3 answers
19k views

Very Basic Java Piano

I've been reading "Head First Java" and some of the early projects surround basic swing and basic MIDI. So I've put the two together and written a basic "Synthesiser"/"Piano" using what I have ...
ggle's user avatar
  • 369
8 votes
3 answers
21k views

Factory design pattern with music classes

I found a definition of the factory design pattern as: Define an interface for creating an object, but let the subclasses decide which class to instantiate. I understood the first part "defining ...
bhr's user avatar
  • 81
8 votes
2 answers
293 views

Python script to test music sight reading

I decided to write a program to test music theory, and, while it would've been much easier for me to make it elegant and perfect in Java, I thought I'd take the opportunity to get more familiar with ...
asteri's user avatar
  • 4,899
4 votes
5 answers
171 views

Transposing notes by one whole step

I am currently writing an app that converts musical keys. In a nutshell the conversion part of the script, is one giant if / then statement (if the user selected A then display B, etc etc.). While ...
Nick's user avatar
  • 43
5 votes
3 answers
801 views

Note class for managing information on various musical notes

I just finished (re)reading Clean Code, and one of the ideas I learned was the SRP. However, I am not quite sure on what defines a "Single Responsibility." In the piece of code below, I have a ...
Russell's user avatar
  • 205