Close

Audio output

A project log for Classroom music teaching aid

An interactive device for helping a kindergarten class learn to play harmonica.

shlonkinshlonkin 02/17/2016 at 01:250 Comments

The first aspect I'll consider is the audio output. How convenient that Adafruit recently made that video about audio output. I'll be using the simple filtered PWM technique that was outlined in the video. I'll amplify it using a salvaged audio amplifier chip and potentiometer volume control. The circuit will look something like this:

These basic harmonicas are relatively simple instruments to work with because they are single-note(at a time), fixed intensity instruments with no complex harmonics.

There are various ways I could play audio samples. A resource minimizing approach would be using a short sample of one note, looping for duration, and shifting sample frequency for pitch. An effort minimizing approach would be recording long samples of each note and just playing the desired sample for the desired duration. I will most likely choose the second method because it will be easier to code and I'll have plenty of storage space on the SD card.

As for playing songs, That's just a matter of making a list of what notes to play, including silent "notes" in between, and for how long. The tempo could be set by varying the "how long" part.

Why not just use a standard format like MIDI? Because I'm using custom audio samples and it is such a simple task.

Note:

Until I get my hands on a Pi, I'll be testing the hardware with an Arduino. Something as simple as playing an audio sample from an SD card using PWM is well within Arduino capabilities. I even have it all coded up from a previous project, Educational keyboard toy.

Discussions