Lab build

AI music composer

Turns a text description and mood into melody, harmony and rhythm, then synthesises it to WAV.

Role
Builder, end to end
Group
LLMOps and AIOps
Services
AI & LLM systems · MLOps & cloud

What it does

Chained Groq Llama 3.1 prompts generate space-separated melody notes, harmony chords, rhythm durations and a style summary. music21 converts note names to frequencies and a sine-wave synthesizer renders them into a WAV file played in Streamlit. GitLab CI builds the image in Docker-in-Docker, pushes it to Google Artifact Registry and applies the Kubernetes manifest on GKE.

What was built

  1. 01

    Separate prompts produce melody notes, chord progressions and beat durations, then adapt them to the chosen style.

  2. 02

    music21 parses note names such as C4 into pitch frequencies; unparseable notes are skipped.

  3. 03

    Sine-wave synthesizer renders 0.5-second tones at 44.1 kHz into an in-memory WAV for playback.

  4. 04

    GitLab pipeline has checkout, build and deploy stages, authenticating to GCP with a service-account key variable.

The pipeline, layer by layer

Five layers, one pipeline.

  1. L1UI

    • Streamlit prompt and style
  2. L2Composition

    • Chained Groq prompts
    • Melody, harmony, rhythm
  3. L3Audio

    • music21 note parsing
    • Sine synthesizer to WAV
  4. L4CI/CD

    • GitLab CI
    • Artifact Registry
  5. L5Runtime

    • GKE deployment

Stack

  • LangChain
  • Groq
  • Llama 3.1
  • music21
  • synthesizer
  • SciPy
  • NumPy
  • Streamlit
  • Docker
  • GitLab CI/CD
  • Google Artifact Registry
  • GKE

Next lab build · 09 / 46

Falcon-40B on a SageMaker endpoint

Deploys Falcon-40B-Instruct to a GPU SageMaker endpoint using the Hugging Face LLM container.

Previous: Celebrity detector and Q&A

Need a system like this in production? Tell us about it.