Giter VIP home page Giter VIP logo

ultrasonickeyboardmelodies's Introduction

UltrasonicKeyboardMelodies

This project is closely related to the the UltrasonicKeyboard project. UltrasonicKeyboardMelodies demonstrates how to set up a melody to be played by a piezobuzzer using an Arduino microcontroller.

Schematic/Circuit

The schematic for this project is nearly identical to the schematic from UltrasonicKeyboard. The only difference is the exclusion of the HC-SR04 connection. The pins used by the HC-SR04 in UltrasonicKeyboard are not used in this project. Effectively, the same circuit can be used.

How It Works

We use the same underlying method as the Arduino ToneMelody sample. Refer to the sample project for a barebones example of playing a melody using a piezobuzzer.

Instead of a single melody, we define a 2D array of notes, with each subarray a collection of notes for one melody. Another 2D array holds the durations of each of the notes. Being able to play variable note durations enables a much closer representation of the melody if it were played on, say, a piano.

Pauses are introduced between each note emission, as it would be difficult to distinguish different notes otherwise. These pauses also simulate the concept of a "tempo" - longer pauses between notes means the delay between notes is longer. The duration of the pauses with each note (again, for musical timing reasons), so the easiest way to determine the pause durations is experimentally.

The pushbutton section of the circuit rotates through each of the hardcoded melodies, looping back to the first melody when all melodies have been exhausted. A "metronome melody" is played when switching between melodies to make the transition a little smoother.

How To Use

Open up the project in Arduino IDE and program your Arduino Nano.

ultrasonickeyboardmelodies's People

Contributors

nathanfu88 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.