19.  Melody generation with transformers - Generative Music AI @ValerioVelardoTheSoundofAI
19.  Melody generation with transformers - Generative Music AI  @ValerioVelardoTheSoundofAI
Uploaded December 2023 | Updated September 2026, 2 weeks ago
Learn how to implement a transformer architecture in TensorFlow to generate melodies end to end. You’ll learn about melody encoding, dataset preprocessing, model building, training, and inference.

Get code:
github.com/musikalkemist/generativemusicaicourse/tree/main/19.%20Melody%20generation%20with%20transformers/Code

Get the lecture slides:
github.com/musikalkemist/generativemusicaicourse/blob/main/19.%20Melody%20generation%20with%20transformers/Slides/19.%20Melody%20generation%20with%20transformers.pdf

Website of the Generative Music AI Workshop in Barcelona:
https://www.upf.edu/web/mtg/generative-music-ai-workshop

Sign up to The Sound of AI Slack Community to join the discussion:
valeriovelardo.com/the-sound-of-ai-community

======================================

Interested in music AI consulting?
thesoundofai.com/consulting.html

Interested in music AI recruitment?
thesoundofai.com/recruitment.html

Become a Python ninja with my Advanced Python Programming course:
the-sound-of-ai-academy.teachable.com/p/advanced-python-programming

Connect with Valerio on LinkedIn:
linkedin.com/in/valeriovelardo

Follow Valerio on Twitter:
twitter.com/musikalkemist

======================================

Content
0:00 Intro
0:48 What we'll build
7:13 Code overview
7:29 Melody dataset
9:03 MelodyPreprocessor
19:57 Transformer
28:12 Encoder
36:34 EncoderLayer
40:28 Decoder
43:25 DecoderLayer
48:30 MelodyGenerator
54:54 Train script
1:06:19 Runing the train script
1:08:48 Experimenting with the code
1:11:25
What's up next?
19.  Melody generation with transformers - Generative Music AIExtracting Spectral Centroid and Bandwidth with Python and LibrosaTHANK YOU and first book update3 Must-Read Books to Start with AI MusicSingle Responsibility Principle for Machine Learning Engineers: Theory and PracticeFrom Autoencoders to Variational Autoencoders: Improving the Loss FunctionExtracting Mel Spectrograms with Pytorch and Torchaudio5 Tips to Improve your AI (Audio) Job ApplicationsDeploying the Speech Recognition System on Docker with NGINXInterface Segregation Principle for Machine Learning: Theory and PracticeOpenSource Research Project: Post-Mortem Analysis10.  Chord Generation with Generative Grammars - Generative Music AI
Valerio Velardo - The Sound of AI |

19. Melody generation with transformers - Generative Music AI

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER