Wixie Blog
Wixie Blog
Wixie Blog
Wixie Blog

Coding music in Wixie with Text-to-Speech

Posted by Melinda Kolk on Mar 17, 2021 11:06:23 AM

You can use the text-to-speech feature in Wixie to code and play music. When objects in Wixie are selected, you use the yellow text-to-speech (TTS) icon to have the computer say the contents of a text box or the alt text for an image. 


In Wixie, you can use brackets and code in the alt text of an image to tell TTS to play a tone for a specified duration. For example, if you add [tone: C4, .25] to the alt text of an image, the TTS plays a middle C tone for a quarter beat.

You can also string together tones to play music. When you add multiple tones, separated by a comma, like [tone: D4 0.5, D4 0.5, E4 1, D4 1, G4 1, F#4 1], you can play a song. For example, click the birthday cake.

How to add music code to an object in Wixie

To code music to an object, select the object. Go to the Edit menu and choose Edit Alt Text.

Add an open bracket, followed by tone: and then add in tones and durations separated by commas and completed by a closed bracket.


Each tone is defined as the note name and an octave similar to what you will find on a piano keyboard. 

The range is C0 - B8 (C0 being a C note at the lowest octave, B8 being a B note at the highest octave), followed by the duration in beats in a 4/4 timescale (4 beats is one measure).

The available notes are:  C, C#, D, Eb, E, F, F#, G, G#, A, Bb, B

Simple melodies can be done by including multiple notes and durations separated by commas. For example, the first few measures of Three Blind Mice would be coded as:

 [tone: E4 1, D4 1, C4 1, R 1, E4 1, D4 0.5, D4 0.5, C4 1]

You will notice that beats can be decimals. .5 is a half note and .25 is a quarter note.

Rests are set just like notes, just with an 'R' and the number of beats to rest for.

Code objects to create your own music assignments

You can use this feature to create custom Wixie templates that help students learn to read music, practice with virtual percussion tubes, or play songs by ear. For example, click the keys on the piano below to play a song.

Normally, you listen to the TTS for an object by clicking the yellow TTS handle. But in the sample above, you simply click the keys. To set an entire object to play the tones, select it, go to the Edit menu, choose Properties, and select Whole Object Plays TTS.

Use to build entry-level, text-based programming skills

You can also use this feature to help students learn entry-level, text-based coding skills. While not a programming language, coding music in the alt tag requires students to apply values like tone and duration along with proper syntax brackets and commas to get their music to function as they intend.

Select the image below to assign this music coding cheat sheet to students or add it as a page in a Wixie assignment.



Topics: text-to-speech, music

Popular Posts

Subscribe via email

Posts by Topic

see all