How to make a Simple Sound Synthesizer in Python

preview_player
Показать описание
A simple sound synthesizer made with Pygame and Numpy in Python.

0:00 Cringe Intro
0:33 What is a sound wave
1:28 Generating a digital signal
3:24 Generating a sample for each note in a piano keyboard
4:43 Keyboard input
5:18 Displaying the notes on the screen
6:08 Generating square and triangular waves
7:22 Saving a sound sequence
8:15 Replaying the text file
9:10 Creating sound tracks
10:13 Exporting a track to a wav file
Рекомендации по теме
Комментарии
Автор

Your mind is brilliant, your code is elegant and tutorial is to the point; easy enough to follow. THANKS!

NiVofHiR
Автор

I just thought and programmed this before 7 days now I got where was my mistake. Thnx for figuring it out bro.

ajtheprogrammer
Автор

It's incredible how you have managed to do things in pygame that seem impossible, you simply leave me speechless.

kyuchumimo
Автор

Very cool vidio. I've done a couple quick programs in pygame and am interested in a variety of audio stuff. Great short video!

arnielarson
Автор

Well normal people play music only OG's programme it

SolathPrime
Автор

Love this video! Another idea for ideal square waves, maybe try using a unitstep for the period of the tone and have it adjusted by a duty cycle ratio. The general square is u[n]-u[n-N], where the full period is 2x N for a 50% duty cycle where N is the period the signal is high for; easy in MATLAB but Ive never tried python, hence why Im watching this. Im not sure how to make it cyclical without it blocking the program though as you worked around with clipping the high gain sin waves, but you could map the input to a loop where as long as youre pressing the key it keeps increasing the n of the series use a modulus to repeat the series to make it cyclical. Thank you for this great video, I needed it for a school project. Also, you can make a triangle by convolving 2 squares, but you need to watch the length since convolution is length1+length2-1 so you would need to double your frequency... or you could just define your sequences as I suggested with the unitstep

iandwyer
Автор

Nice...

Good for video game development...

✅✅✅✅✅

SkyFly
Автор

thank you for the easy to follow video! just one thing that keeps driving my OCD crazy... it's fourty four thousand one hundredd (44100), not fourty one thousand! but that's just me being so, great video!

madisyn
Автор

1:28 Porquê o seu Audacity esta em português?

tatazinhogame
Автор

This is really cool. Is there a way to make it play like a guitar?

maverickivmoleko
Автор

Hi! I worked for a long time as a musician, but today I don't have the physical ability to do that anymore (I'm going blind), so I spend a lot of time at home. I tried to learn programming through C++ because I wanted to create a synth to suit my needs, but it was too much for my head (: So I'm trying Python and I'm understanding it quite well (for now)... I'm making good progress!

I liked your work, but the math part I understood approximately -6%!!! Is this possible? (:

Anyway, I was wondering if you could point me to some basic study material, indicate some direction to get to the point where I can program my own synth from scratch.

Thank you for your attention and kindness on sharing your work.

GabrielPerboni
Автор

Can I use part of this code for an open source synthesizer (will cite ofc)? Also, if you still peruse this comments section can you explain why the pygame mixer cannot interpret 32bit or 64bit arrays to make sin waves? Every time I try to generate a sine wave with a 32 or 64 bit array I get noise. Struggling with the math behind it. Would also welcome some resources to understand this better in a more basic way.

cees
Автор

I have a question. What is the RIGHT way to produce a waveform? Also how can you make it so that it doesn’t produce aliasing?
If you read from a table you need to “filter” the table to avoid aliasing. How?

michele
Автор

Hey, I'm trying to do this now for my class project since I think it would be really cool to work with, but I keep repeatedly getting an error back. The error says: ValueError: Array depth must match number of mixer channels

I've copied your code exactly and it still won't work. Do you have any ideas as to why this may not be working?

honeysstar
Автор

Btw, Jim Carrey is one of my favorite comedians...

😏

SkyFly
Автор

How can we use ChatGPT for sound making, at least in theory?

fustibal
Автор

I tried this code in Pycharm with no errors but no sound why?

freewheelburning
welcome to shbcf.ru