31
votes
Python decibel meter-accurate?
Indent your code with a PEP8-compliant IDE or linter; it's a perfect mess right now.
Move your global code into functions and maybe classes. There are two good use cases for classes here - one for a ...
20
votes
Python program to scramble MP3 audio
Consider what happens if a user closes the "Load MP3" dialog without picking a file. In that case, filepath would get set to ...
16
votes
Python program to scramble MP3 audio
There is quite some room for improvement, both in the overall architecture and style and in the logic that you use:
Architecture and style
Separate logic from presentation
You have a single class ...
13
votes
A struct for recording audio samples
This is very much C-style code: the only thing that qualifies it as C++ is the fact that you use new and delete[] rather than <...
11
votes
Python program to scramble MP3 audio
First off, this is quite an interesting project for a beginner, well done on getting it working. Other people have mentioned a lot of the issues with our code style, however to expand on a few points:
...
10
votes
Accepted
Speech Recognition Part 1: Generate Training Data
I have to admit that I have no idea what the purpose of the code is (never worked with speech recognition) but I know a little bit Python so I can give some advise on the code itself.
Performance
...
8
votes
Accepted
Split mp3 of album into individual tracks
I'll consider answering your last question (at least at the moment) about subprocess.run().
There's a similar method you can use for this kind of situations named ...
7
votes
Speech Recognition Part 1: Generate Training Data
PyAudio doesn't seem to have a with interface, however you should add that interface to your class. PEP 343 explains why it was added to Python, but it mostly comes ...
7
votes
Accepted
Python Sound visualizer
Nice.
Here are some observations:
consider using an IntEnum:
This helps remove "magic" numbers from the source code. (A year from now, will you remember that <...
6
votes
Accepted
Play audio files when buttons are clicked in Simon Says
Duplicate Code
Duplicate code is generally considered a bad practice since making a change to one version could require a change to all the versions. It's easier to maintain your code if design ...
6
votes
Play audio files when buttons are clicked in Simon Says
I recommend removing the inline onclick event handlers from your HTML document for a cleaner separation of markup and logic / JavaScript similarly to how you ...
6
votes
Accepted
Python Text-To-Speech program
DRY
Apply the DRY (Do not Repeat Yourself) method. For instance, the check to remove the file. Since it's being called in two places, we can make this a function. I've re-written your code in a more ...
6
votes
Accepted
Modulating an oscillator by gain, pitch, and offset
counting flops
Let's unpack the inner loop, where all the work is being done. I am repeating the whole thing here, wrapping to 80 columns and adding some indentation to make it easier to read.
...
6
votes
Accepted
Modular synthesizer framework for C++
This was fun code to play with and to review. I haven't played with a modular synth for about forty years. Here are some things that may help you improve your code.
Consider hiding data
Right now ...
5
votes
Accepted
Speech Recognition Part 2: Classifying Data
Most of your comments aren't that great. Commenting about PEP8 compliance shouldn't be needed, and saying you're instantiating an object before doing it duplicates the amount we have to read for no ...
5
votes
Accepted
Karplus Strong pluck generation
I was trying to improve your generate function and stumbled on a potential bug. You continuously update the buffer by adding two following values. This should be ...
5
votes
Karplus Strong pluck generation
Congratulations
You mostly follows standards which is good. You also have good documentation which is great. All in all the code reads well and is easily understandable.
Style-wise, I just have some ...
5
votes
Accepted
5
votes
Modulating an oscillator by gain, pitch, and offset
Don't define pi and twopi yourself. They should be available from math.h as M_PI and M_2_PI if you're in the GNU stack.
Defining ...
5
votes
Accepted
C++ WAVE file reader: library-like structure, safety, readability
Ensure correct order of constructor member initializers
My compiler warns me that in the constructors of Waveread, m_cachePos ...
4
votes
Karplus Strong pluck generation
for i in range(nsamples):
samples[i] = buf[i % N]
avg = damping * 0.5 * (buf[i % N] + buf[(1 + i) % N])
buf[i % N] = avg
There's some definite ...
4
votes
Music player written in Python using PyQt
It can be a pleasure to whip something up in an hour on the plane. This code could be improved by using pylint.
The most obvious improvements appear to be
minimize and structure the instance ...
4
votes
Accepted
Random MP3 Selector and Player
I would improve the following things:
move the parsing argument part into a separate function (extract method)
define descriptions and helps in multiline string constants
use ...
4
votes
A struct for recording audio samples
There's not very much difference between structs and classes in C++. structs can have ...
4
votes
Accepted
Convert FLAC files to MP3 in parallel on Ubuntu
shellcheck
It is always a good plan to run your code through shellcheck.net. This only reveals a couple of issues:
Your -j$(nproc) should be quoted to avoid word ...
4
votes
Convert FLAC files to MP3 in parallel on Ubuntu
Please tell me you aren't running ffmpeg and other commands habitually as root! As a regular user, you need sudo to install ...
4
votes
Hiding message within an audio file with entropy detection
If it is your first project, why choose an outdated version of Python to start with. Python 3 release was about 10 years ago and yet you chose to use Python 2. Anyway, there is not much you need to ...
4
votes
Accepted
The sheet music of Morning Mood
There's a lot of boilerplate in LilyPond to put all the parts together. In your case, you used:
...
4
votes
Modulating an oscillator by gain, pitch, and offset
General overview
I found this hard to follow. The logic is scattered across several coupled classes without a clear idea of a specific single responsibility for each class.
The class, function and ...
4
votes
Accepted
Terminal interface audio player based on VLC & Curses
Your code is pretty good.
You have some Pythonic style problems like on_press should have two blank lines before it, mypy probably would complain about ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
audio × 135python × 28
java × 26
javascript × 20
performance × 19
c++ × 17
c × 14
beginner × 12
c# × 10
music × 9
python-3.x × 8
signal-processing × 8
android × 7
object-oriented × 6
jquery × 6
file × 6
bash × 6
html5 × 6
swing × 6
algorithm × 5
multithreading × 5
swift × 5
linux × 5
html × 4
c++11 × 4