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
1 vote
1 answer
89 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 ...
user avatar
  • 137
3 votes
0 answers
65 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 ...
user avatar
  • 465
2 votes
1 answer
163 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. ...
user avatar
1 vote
1 answer
31 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 ...
user avatar
0 votes
1 answer
3k 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 ...
user avatar
  • 85
6 votes
1 answer
118 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 ...
user avatar
  • 13.8k
1 vote
1 answer
248 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
85 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/...
user avatar
4 votes
2 answers
136 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 ...
user avatar
  • 13.8k
3 votes
1 answer
941 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 ...
user avatar
7 votes
1 answer
150 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. ...
user avatar
10 votes
2 answers
962 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 ...
user avatar
7 votes
7 answers
224 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 ...
user avatar
  • 145
5 votes
1 answer
772 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 ...
user avatar
  • 12.6k
5 votes
2 answers
158 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 ...
user avatar
  • 185
2 votes
0 answers
324 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, ...
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 ...
user avatar
  • 199
14 votes
2 answers
2k 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 ...
user avatar
  • 163
3 votes
1 answer
446 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 ...
user avatar
4 votes
1 answer
356 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 ...
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 ...
user avatar
10 votes
2 answers
201 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 ...
user avatar
  • 149
6 votes
1 answer
2k 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: ...
user avatar
  • 25.3k
8 votes
1 answer
388 views

Turning music into an image

I was bored, so I wrote something that could turn .wav files in to .bmps: ...
user avatar
  • 529
19 votes
1 answer
249 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 ...
user avatar
  • 20.3k
4 votes
2 answers
255 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. ...
user avatar
  • 25.3k
10 votes
4 answers
669 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 ...
user avatar
  • 25.3k
45 votes
5 answers
8k 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 ...
user avatar
  • 25.3k
2 votes
2 answers
91 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 ...
user avatar
  • 843
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 ...
user avatar
  • 13.2k
4 votes
2 answers
618 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 ...
user avatar
  • 43
1 vote
0 answers
48 views

From sounds (Hz and seconds) to musical theory 2.0

The following procedures are an attempt to connect some physical aspects of the sound (frequency and duration) to traditional music theory. It is not an exhaustive treatment of the subject. THE ...
user avatar
4 votes
1 answer
153 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 ...
user avatar
1 vote
1 answer
90 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 ...
user avatar
  • 1,203
2 votes
1 answer
94 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 ...
user avatar
  • 1,203
5 votes
1 answer
163 views

Music note interval trainer

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

Music note class - v2

Version 2 of Music note class ...
user avatar
  • 1,429
6 votes
3 answers
793 views

Music note class

A class for notes calculation. ...
user avatar
  • 1,429
9 votes
3 answers
18k 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 ...
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 ...
user avatar
  • 81
8 votes
2 answers
253 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 ...
user avatar
  • 4,849
4 votes
5 answers
147 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 ...
user avatar
  • 43
5 votes
3 answers
792 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 ...
user avatar
  • 205