Real-time sonification: Difference between revisions
David Sousa (talk | contribs) |
David Sousa (talk | contribs) No edit summary |
||
Line 20: | Line 20: | ||
[[File:Soundscapes makecode music.png |centre|800 px|alt=Makecode editor music category]] | [[File:Soundscapes makecode music.png |centre|800 px|alt=Makecode editor music category]] | ||
==== Generate a single tone ==== | |||
The following code generates a single tone with a pre-specified frequency and duration. It is possible to change the tone frequency by clicking the white input field with the value "Middle C". From the drop-down menu arrows, it is also possible to change the beat duration and whether the sound is played sequentially with other command blocks, in the background, or in loop.<ref group="footnotes"> Click the button "Simulator" on the top bar to interact with a virtual micro:bit and test the code. You can edit the code by clicking "Edit" on the top-right corner.</ref> | |||
<HTML> | |||
<div style="position:relative;height:0;padding-bottom:40%;overflow:hidden;"><iframe style="position:absolute;top:0;left:0;width:100%;height:100%;" src="https://makecode.microbit.org/#pub:_WTa7fyFxdJxz" frameborder="0" sandbox="allow-popups allow-forms allow-scripts allow-same-origin"></iframe></div> | |||
</html> | |||
==== Play a melody ==== | |||
The following code plays a melody. It is possible to the melody by clicking the white input field with the colorful music notes. From the drop-down menu arrows, it is also possible to change the beat duration and whether the sound is played sequentially with other command blocks, in the background, or in loop.<ref group="footnotes"> Click the button "Simulator" on the top bar to interact with a virtual micro:bit and test the code. You can edit the code by clicking "Edit" on the top-right corner.</ref> | |||
<HTML> | |||
<div style="position:relative;height:0;padding-bottom:40%;overflow:hidden;"><iframe style="position:absolute;top:0;left:0;width:100%;height:100%;" src="https://makecode.microbit.org/#pub:_2Wr9wR73zgk3" frameborder="0" sandbox="allow-popups allow-forms allow-scripts allow-same-origin"></iframe></div> | |||
</html> | |||
=== Sonification of a Boolean === | === Sonification of a Boolean === | ||
Line 28: | Line 46: | ||
=== Sonification via MIDI === | === Sonification via MIDI === | ||
==Notes== | |||
<references group="footnotes" /> |
Revision as of 11:00, 13 August 2024
Real-time sonification is an exciting technique that can strongly promote students' engagement in STEAM fields. Real-time sonification means that we are not able to perceive the time interval between the acquisition of the data and the respective sound produced by our sonification device because of the speed of the process. Moreover, the methods for creating sound representations of the data are defined simultaneously with data collection (in "real-time").
Real-time sonification devices
To create a real-time sonification device it is useful to use a microcontroller. These are like "small and simple computers" with a single processor unit. They are not computers though. Their architecture is much simpler and they cannot run an operating system. Still, they can be programmed to execute a single program at a time, which can perform multiple tasks but sequentially, according to the order of the instructions listed in the program. There are several types of microcontrollers, the Arduino (arduino.cc) being the most popular.
To begin with, the SoundScapes project suggests using the BBC micro:bit microcontroller. This tool is very simple to use, versatile, and includes several embedded sensors readily available to use, eliminating the requirement to build a specific electrical circuit for operation. The micro:bit can be programmed online with Makecode (using the Chrome browser for better compatibility) in python, javascript, or blocks.
Sonification with micro:bit
Before diving into sonification with the micro:bit you must first get familiarized with the Makecode programming environment. On the main page, there are various tutorials, like the "Flashing Heart", the "Name Tag", etc, between which you can choose to get started. If you sign up on the platform, your projects will be saved on your account and you can access them from any device as long as you sign in. Otherwise, they are anyway saved as cookies, however, you can loose them if you clear your browser cache.
Sound notions in micro:bit
In the Makecode editor, there is a useful and attractive library dedicated to music, especially for young students. This music library offers several commands/blocks that facilitate the generation of sounds and the creation of melodies. It is a good exercise to play with the different blocks and hear what happens to get familiar with them.
Generate a single tone
The following code generates a single tone with a pre-specified frequency and duration. It is possible to change the tone frequency by clicking the white input field with the value "Middle C". From the drop-down menu arrows, it is also possible to change the beat duration and whether the sound is played sequentially with other command blocks, in the background, or in loop.[footnotes 1]
Play a melody
The following code plays a melody. It is possible to the melody by clicking the white input field with the colorful music notes. From the drop-down menu arrows, it is also possible to change the beat duration and whether the sound is played sequentially with other command blocks, in the background, or in loop.[footnotes 2]
Sonification of a Boolean
Sonification of a range of values
Multiple inputs mapped to a single sound
Sonification via MIDI
Notes
- ↑ Click the button "Simulator" on the top bar to interact with a virtual micro:bit and test the code. You can edit the code by clicking "Edit" on the top-right corner.
- ↑ Click the button "Simulator" on the top bar to interact with a virtual micro:bit and test the code. You can edit the code by clicking "Edit" on the top-right corner.