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
4
votes
2answers
66 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 ...
3
votes
1answer
112 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 ...
7
votes
1answer
80 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. ...
10
votes
2answers
550 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 ...
7
votes
7answers
192 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 ...
4
votes
1answer
316 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 ...
6
votes
2answers
125 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 ...
2
votes
0answers
181 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, ...
7
votes
2answers
570 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 ...
14
votes
2answers
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 ...
4
votes
1answer
128 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 ...
4
votes
1answer
205 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 ...
14
votes
3answers
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 ...
8
votes
2answers
163 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 ...
6
votes
1answer
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: ...
7
votes
1answer
382 views

Turning music into an image

I was bored, so I wrote something that could turn .wav files in to .bmps: ...
18
votes
1answer
205 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 ...
4
votes
2answers
159 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. ...
10
votes
4answers
450 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 ...
42
votes
5answers
6k 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 ...
2
votes
2answers
73 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 ...
10
votes
1answer
3k 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 ...
4
votes
2answers
436 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 ...
1
vote
0answers
44 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 ...
4
votes
1answer
144 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 ...
1
vote
1answer
88 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 ...
2
votes
1answer
93 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 ...
5
votes
1answer
149 views

Music note interval trainer

This gives you one note and asks you go up or down the scale for a certain number: ...
0
votes
1answer
103 views

Music note class - v2

Version 2 of Music note class ...
6
votes
3answers
742 views

Music note class

A class for notes calculation. ...
9
votes
3answers
15k 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 ...
8
votes
3answers
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 ...
8
votes
2answers
204 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 ...
4
votes
5answers
122 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 ...
5
votes
3answers
716 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 ...