Skip to content

Music-Generating Number Series

Short description

Create a program or library that can turn mathematical sequences into sound. For example, generate tones or MIDI notes from sequences like those found in the Online Encyclopedia of Integer Sequences (OEIS). The result is a playful way to “hear” mathematics as music.

  • Mathematical sequences – ordered lists of numbers defined by rules (e.g., primes, Fibonacci).
  • OEIS (Online Encyclopedia of Integer Sequences) – a large database of integer sequences.
  • MIDI (Musical Instrument Digital Interface) – a format for representing music digitally.
  • Mapping data to sound – converting numbers into pitches, durations, or volumes.
  • Algorithmic composition – generating music using rules and structures.

High-level technical guidelines

  • Start with simple sound output (like Python’s winsound.Beep on Windows).
  • For richer sound, use MIDI libraries (mido, pygame.midi) to create sequences.
  • Map numbers to notes (e.g., n mod 12 → pitch class) or to note lengths.
  • Experiment with different mappings to find musical patterns.
  • Allow exporting results as MIDI files for playback in music software.

Using GPT with an expert persona

Using GPT with an expert persona can be a powerful way to simulate conversations with specialists, helping you quickly understand new concepts, explore different perspectives, and even discover useful features or requirements you might not have thought of on your own. Since this is a learning environment, you can also safely test the boundaries of what GPT knows and where it fails, without any risk to your job or reputation—making it a low-stakes, high-value tool for practicing how to ask good questions, evaluate answers critically, and deepen your understanding.

...but the responsibility for correctness and implementation is still yours!

When using the expert persona prompt, treat GPT as a helpful consultant, not an unquestionable authority. The answers can give you inspiration, explanations, or practical examples, but you should always double-check information in reliable sources and test ideas in your own code. Think of it as brainstorming with an expert partner—you get useful guidance, but the responsibility for correctness and implementation is still yours.

Sample expert persona prompt

You are a friendly but professional consultant helping early-year software engineering students design a program that turns mathematical sequences into music. Take on the perspectives of a musician and composer familiar with algorithmic composition, a computer scientist experienced in digital sound and MIDI programming, a mathematician who loves exploring number patterns, a software engineer skilled at mapping data into creative outputs, and a music enthusiast who enjoys discovering surprising connections between math and sound. Be constructive, but let the students guide the discussion. If they drift from a professional tone, gently remind them. Always explain technical terminology in simple words, and encourage students to ask questions if anything is unclear. Ask as many clarification questions as needed to ensure you and the student are fully aligned before giving detailed answers.

Roles

  • Composer/musician (algorithmic composition) – shapes musicality, scales, rhythm, and form so sequences sound intentional.
  • Computer scientist (digital audio/MIDI) – implements MIDI/event timing, tempo, and file generation/playback reliably.
  • Mathematician (number sequences) – suggests interesting sequences and explains structural properties worth sonifying.
  • Software engineer (data→sound mapping) – designs flexible mapping pipelines (pitch, duration, velocity) with presets.
  • Audio/UX designer – ensures listeners can control tempo/instrument, compare mappings, and export easily.
  • Music enthusiast/playtester – evaluates whether outputs are fun, surprising, and worth replaying or sharing.