# Sound Waves Experiment #1756

This is a discussion for the Sound Waves Experiment. Feel free to connect with the Learning Team here, or to discuss experiment tips, ask questions, leave comments or suggest experiment variations here.

This was a lot of fun and challenging science concepts as well. I loved seeing the frequencies represented in waves and then comparing them to keys on the piano. My years of piano playing came in handy as I was able to code “Mary had a little lamb” through the Arduino at the end of the lesson. I also love the experimenting with the different frequencies by inputting values. The lesson was clear and focused and really showed me how you can modify the code to make music and learn about soundwaves at the same time!

1 Like

While I enjoyed this activity and actually programmed Twinkle, Twinkle before getting to the last coding challenge (I simply re-coded where we were asked to insert the flat and sharp keys), I found the last challenge unhelpful. The opening instruction text (not code) in the last activity was easy to understand and helpful, but I found that when I got down to the actual code, I didn’t see where the frequency of the notes had been coded - char notes[] = "cdfda ag cdfdg gf ";
Also, what is “i” in this string:
int i, duration;

for (i = 0; i < songLength; i++) // step through the song arrays
{
duration = beats[i] * tempo; // length of note/rest in ms

``````if (notes[i] == ' ')          // is this a rest?
{
delay(duration);            // then pause for a moment
}
else                          // otherwise, play the note
{
tone(buzzerPin, frequency(notes[i]), duration);
delay(duration);            // wait for tone to finish
}
delay(tempo/10);              // brief pause between notes
``````

}

As far as translating this lesson into something teach-able in our MakerSpace, I need to think on it. The concept of sound and how vibrations in the air actually translate through our sense of hearing is very challenging for young students. I do a lesson using LEGOs to build guitars with rubber bands so that they can actually see the bands moving. Then we build LEGO drums using cut balloons for the membranes and put sugar packets on them to “see” the sound (sugar) dancing on the drum. The concept of actually pushing particles to create various cycles of waves that translations into pitch requires the ability to make fairly high-level connections. This hearkens back to my 7th grade science fair project when I built a contraption to test length of guitar string, thickness of guitar string and tension and the affects of these variables on pitch - I almost lost my pubescent mind trying to wrap my head around it!!!

So… I like the idea of having the kids simply change numbers, see what happens and giving them the “how to” change pitch, duration, tempo, etc. and maybe not so much the “why” pitch changes. They could have some fun, especially those that can read music.

1 Like

Hi, I agree with you it was a fun activity. I think all age groups would enjoy creating different frequencies. I do not have any knowledge on playing any instrument but this would be great to see those students that have the music background shine creating songs with coding.

2 Likes

This was a very nice activity. This would fit perfectly in my precalculus class when I start to teach sine and cosine graphs which tie in a real-world example. We can discuss and compare the information of the period and amplitude (volume) of the sound waves. Have them create sound waves with high low notes. At first, the teacher’s role would be to provide vocabulary and give examples then facilitate as students are given different challenges, such as giving them certain parameters that the waves must-have. This would also be a great activity to give to the music teacher so they can introduce some coding in their curriculum.

2 Likes

Love the idea of using sugar on vibrating membrane to link particles and sound waves!

Regarding your question on what is “i” is in the string. The letter “i” is commonly used as the variable name for indexing a loop. The “i” is short for index, you could really use any letter, some people may use ‘x’ as their prefered indexing variable.

The frequencies are defined on lines 141 & 142. They are using arrays to store the note letter and corresponding frequency.
char names[] = { ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘a’, ‘b’, ‘C’ };
int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523};

These arrays are used in the function frequency. This allows any where in the code to call the function and pass the note letter and have the frequency returned i.e. frequency(‘c’) returns the frequency number(int - integer) 262.

There are many, many new programming concepts in this code that we have not covered and it’s quite a step from blinking an LED. I would not expect this code to be very understandable in our progression. I have seen many students read through the code comments and be able to try changing small parts and eventually change the song. One of the goals is to have a somewhat endless, hard challenge at the end page to engage students that might fly through lesson.

I don’t see sound fitting into the chemistry curriculum well at all unless we talk about movement of the medium in relation to the Kinetic Molecular Theory of gases. Coming from a Chemistry, non-coding, non-circuits background I found identifying the pieces of my kit and following the diagram, especially determining exactly where the left end of the resistor was, a little challenging. My students would equally need support with this.

Because they come from many different grade school science curriucula and only take Biology at our school before coming to me, they would need as much help with the frequency concepts as with the building and coding. Some may find the relationships between frequencies and notes less challenging.

2 Likes

This sounds like a fun maker-space. If my students come through a space like yours before arriving at my chemistry class incorporating concepts such as these into my class would be easier even though they would be enrichment not part of the course of study for credit in Chemistry.

2 Likes

We have some chemistry lessons that you’re more than welcome to try! If you go to https://lessons.becauselearning.com/ then click on subject and then select “chemistry”.

1 Like

This was a fun, but also a very challenging activity. My 3rd graders enjoyed changing the variables to find what frequencies they could hear and what they couldn’t hear. Great discussion on why some people can hear some frequencies and others cannot. I do not have a music background at all, but enjoyed “trying” to come up with another tune. My students kept trying to come up with lyrics to match the tunes being played.

2 Likes

This was a really fun lesson that translates well to my curriculum. With middle school physical science we have a chapter on waves and this would be an awesome activity to add in. There are several modifications to do with tone and frequency. Students could here a sound and be asked to explain what exactly is happening to the frequency based on the way that it sounds. I love the idea of having students code their own song. You could incorporate this as part of a larger design challenge where each group has to design a product and they have to code a unique song/jingle that would be used to advertise their product.

I think that students would struggle with the part coding their own song, however it is a really fun and engaging activity that students would enjoy the creative aspect so this would help them work through their problems.

Sounds like fun - but is the lesson doable in a k-6 Innovation Lab?

This was a fun experiment but I am not sure I would offer it in the Innovation Lab. It took me a while to figure out how to put all the pieces together, but once I did that, the sound coming out of the piezo was music to my ears.

My classes are usually 30-45 minutes long. I could see some of our 5th and 6th-grade students have fun with this. But I would need to have our science specialist spearhead the theory lessons.

1 Like

One option to consider is to have them not do the set up, but more experiments about understanding the phenomenon or even vice-versa depending on what you want them to focus on.

1 Like

They can also look online for Arduino sketches of music that people have already done. I’ve heard it all in the classroom to the classic holiday songs to Star Wars theme songs. The students love it!

2 Likes

This was really fun making music, at least until the dog went nuts. My kids could hear sounds I could not and although i didn’t spend enough time to compose a long song, I did have alot of fun making 80’s video game songs. Really fun to easily see what a few changes could do.

2 Likes

This was another fun activity and one we could use with our groups of summer camp students. I thought the graphics for the waves in the intro were helpful and it was short enough that the background info would keep the student’s interest. I used a similar activity without code in one of our camps last year and the students loved making the circuit play a tune - though the other facilitators might have not found it as fun!
I would challenge the students to create their own song in groups and then share it with the class.

1 Like

Well, this one is fighting me. All I get is a constant tone. Still haven’t given up…ideas?

This one has been challenging! I’m stuck on the last part of having it play a song and then changing it to a new song. Last year, when programming EV 3 robots, my students did a similar activity. They wrote the code to play different tunes. My band students especially enjoyed this. Someone even programmed their robot to play Fur Elise and Seven Nation Army - different students!

2 Likes

Not sure. At first I got nothing because I had the speakers in e instead of d. Recheck placement? I’m sure you’ve tried that!

I think your students that some experience in reading music could have some fun on the last challenge. Don’t worry about editing an entirely new song for this PD, I think just changing a note or two and listing for the change is enough. This code block can be intimidating (long, many new concepts). Very much an optional challenge.