Tone.js - "Mary Had a Little Lamb"
✓ Published1🌍 Public
This example plays the melody “Mary Had a Little Lamb” using the Tone.js library for Web Audio. It displays a Play button and a hidden “Playing” paragraph, toggled by button clicks. The code schedules individual notes with `Tone.Part` and `Tone.Transport`, using a polyphonic synth (`Tone.PolySynth`) to trigger note pairs and single notes at precise timing positions. The note sequence is hardcoded as an array of time–note pairs, based on the book "JavaScript Crash Course" by Nick Morgan.
AI-generated descriptionThis example is based on the book "JavaScript Crash Course: A Hands-On, Project-Based Introduction to Programming" by Nick Morgan, No Starch Press, 2024.
Visit also my repo https://github.com/ax-va/JavaScript-Crash-Course-Morgan-2024.
MIT Licensed