Synthesizer
- 4 Devlogs
- 12 Total hours
The idea behind this is project is to create a virtual synthesizer by having an .wav of a single note, in this case C Major, and with it, by scaling the pitch, creating all the other notes.
The idea behind this is project is to create a virtual synthesizer by having an .wav of a single note, in this case C Major, and with it, by scaling the pitch, creating all the other notes.
So, in the last week I’ve been trying to make this synth into and executable binary, but python being python made problems with the libraries such as librosa, which I can’t replace because there aren’t any other suitable libraries like that that work for me in this case. I’ve been breaking my back with libraries like nuitka and pyinstaller which had problems of their own (pyinstaller not wanting to work because of flexiblas and nuitk because of librosa). But I finally think I did the job and It’s available on the itch.io page of the game.
I’m finally done with the idea of this synthesizer. From the last update I have tried to implement a different approach to the pitch change. I have tried, instead of the librosa pitch_shift, to use the sound made using a FFT. That ended up not sounding better, even though I though it would.
I basically just turned my audio info into a complex array using a FFT, where I mover the frequency bins higher or lower depending on if the sound should be lower or higher. There I also calculate how much the sound should be moved based on how many semitones you want.
In the end, the full project consists of a notebook (where you can see the FFT) where there are some tests with the audio. There are also the input audio: C_Major_Piano and the output audio(Only used in testing): Output_Note. Other than that, there are two GUIs, where on one you play with the C Major note and change it’s pitch and on the other you just play the frequency of the wanted note.
From the last devlog, I have been working on the GUI of the synthesizer. For now it looks pretty promising and I lile how it is going. I have made the synthesizer work and now you click on the notes and the sound lasts two seconds.
The high pitched sounds don’t sound like the piano though…but I’m not sure how to work that out yet.
What was the hard part from the last update wasd making the buttons change colour once clicked. Since they are not part of any class or struct, I have to draw them again in different colour once they are clicked and again in the original colour two seconds later. For that I use a matrix which serves as a memory, which works fine for now, which holds the time when the button was clicked and its position so it can be drawn again.
Currently I have imported the .mp3 file of the C major note onto python and have read it’s contents. And here is the plot of the sound itself.
One part of the code currently reads from your terminal which note you want to play, for example “A4”, and it scales the C major note to that pitch and plays it. After that there is a low-pass filter to clear the frequencies over 4500Hz, mainly to make the notes of higher octaves sound cleaner and like piano notes and not banjo.
I have started to copy the final products from a jupyter notebook to a python file because I want to create a GUI so the user can actually click the note to play, like a little piano.