Python is one of the most popular and progressive languages in today’s era of technology. It includes several flexibilities in it’s libraries that make this language use in every human fields. We can build very interesting musical notes with proper pitch and scale using it. As a result, we can say a technical programming language can also help us in multi-purpose things.
Earsketch is an online platform which helps us to build our notes using Python and JavaScript. But in today’s blog we are gonna only see how can we achieve it using this.
![Music Payer in Python](https://mechomotive.com/wp-content/uploads/2021/07/I1-1-1024x576.png)
But which Python libraries make this possible ?
- Abjad
- PYmserv
- Magenta
- Pygtk and gconf
- Pytone
- EighthBit
- LilyPond
- Pygame
![Gif for musical beats](https://mechomotive.com/wp-content/uploads/2021/07/I2.gif)
Let’s create our first music!
So excited! Let’s create our first music with good bashing beats
![Python Excited bots](https://mechomotive.com/wp-content/uploads/2021/07/I3.gif)
For this challenge we have to check how Python can help us create effective musical notes.
If you don’t have account on Earsketch you can go and just get it created here.
We are using here some programming piece of code to decide the musical beats of the complete track.
![setTempo image](https://mechomotive.com/wp-content/uploads/2021/07/I4-1.jpg)
As a result, you have created a very good piece of code now it’s time to run your code on the EarSketch platform
Test this code on EarSketch
You can test this code.
It demonstrates some of the key and basic features of EarSketch:
- Set the tempo
- Import audio clips (on different tracks and at specified times)
- Add audio clips to the timeline
- Add effects (including fade in, fade out and delay effects)
- Use a loop to repeat a clip
To add a background soundtrack, download a wav file or mp3 file into a folder called “Sounds”.
![Adding Sound Effects using Pygame](https://mechomotive.com/wp-content/uploads/2021/07/image-4-1024x548.png)
You will definitely feel surprised when you will listen the music designed. But this music is totally based on the script written above. A hassle-free way to create a song lyrics dataset for training generative language models. And this writeup will revolve around the use-case of constructing a training dataset for a generative language model, like GPT. To be clear, this will not include steps to actually build a model. We’ll walk through the process of setting up the API client and then writing a function to fetch song lyrics of k songs and save the lyrics to a .txt file
Here’s all the code I used above to connect to the API and write song lyrics to the .txt file.
Please refer here for more help!
Enjoy Tech stuffs 😄