Tag Archives: LEGO EV3

LEGO EV3COMPOS3R II improved version with supplied music packs

The New Education Set version starting screenEDDIISPLASH

The new Retail Set version starting screenRETIISPLASH

Having used the original EV3COMPOS3R extensively, I decided to improve the program in the light of various issues which came to light. I have also taken the opportunity to improve and update the documentation supplied with each version of the project.

First I found an issue with the timing of various tunes which didn’t play back accurately. This was because there is a finite overhead time to traverse the playback loop which presents the notes in turn to the sound module. This has a greater proportional impact on sequences of short notes compared to those of longer notes. This can give the impression that the longer notes are “hurrying” and playing too fast. After some experimentation I decided to subtract a small time value from every note played and this seems to give a better result, although perhaps not quite so good if you have very fast (short) notes, as they become a little clipped. The subtraction concerned is in the new bkPlayOneNote at the end, and you can alter the value, or set it to zero if you prefer that. I have it at 0.036

Secondly, I found that occasionally I inadvertently deleted the tune in memory (M button on the Menu Choices). This was exasperating If I hadn’t already saved the tune. I introduced a safety feature which required the Note Record Pushbutton on the model to be held down while the M button is pushed, so it is not possible to do this inadvertently. I made the same adjustment to the Note Delete function, but also changed this so that pressing the U button WITHOUT holding down the Note Record Push Button now plays the last note recorded. This is a useful addition if you can’t remember exactly where you got to in entering a tune.

Thirdly, although it works OK in the first version of EV3COMPOS3R I decided to remove the mechanism whereby moving one of the motor arms was used to exit the Menu loop. This was done in the bkBtnSkipLoop. When I started adding the extra features within the BtnMenuAction block inside that loop I started to get unpredicatable behaviour and some program crashing. It didn’t like jumping out of a loop when inside a fairly complex nested structure inside that loop. Instead I inserted the simpler bkButtonLoop, and I controlled the operation and interaction with the Recording and Note generation loops using the EnableRecBtn logic flag variable. Whilst in any part of the Menu System the motor arm note generation and the recording of notes is disabled. If you need to exit the Menu without taking any action you can use the M button without holding down the Note Record Push Button. You can as before stop tune playback by shading the Ultrasonic or Infra-Red sensor depending on which model you are using. The only other part of the menu system that required alteration was to provide a means to exit the File Load or Save sub-menu without taking any action. This was done by employing the brick Left button which was not otherwise used.

Finally I modified the documentation to take account of changed Menu screens, and updated the program description text to accommodate the changes made. I also reduced the size of the initial display screen to accommodate smaller laptop screens. (I use a large iMac screen). I also added a small video showing the EV3COMPOS3R playing back a tune. You can find this on the Project Properties page.

The Retail Set Project Properties pageRETIIPROP

The Education Set Project Properties pageEDIIPROP

I have considered and experimented with adding further editing features to the program, but it greatly increases the complexity of the program, and the complexity for the user with multiple menus to achieve the desired effects, and I have decided it is not effective to go further. It is in fact fairly straightforward to do some editing manually by transferring the tune to your PC and using a suitable text editor. Note although it says .rtf the file is just pure text, and you should use a text editor like notepad and NOT a word processor. I use TextWrangler on my Mac. Also make sure that the text editor saves with CR/LF at the end of lines and not the more usual LF used in Linux. The reason for using .rtf is that this works for Mac downloads, whilst .txt cannot be downloaded with the EV3 software interface on a Mac.
The editing I have done is to copy and paste repeated sections of a long tune rather than entering them twice with the motors. Also, a couple of pieces required transposition of the music, in one case to fit the note range on the brick, and in the other to transpose the Trumpet part in Bach’s 2nd Brandenberg last movement. It was written in C in the score but needed to sound up a fifth. To transpose I copy the tune to a spreadsheet and use a formula to add the offset to each note, having entered it at the pitch shown in the score. You can also of course adjust wrongly entered notes either in pitch or duration. Just remember to adjust the note count at the beginning of the piece. It should equal the number of lines in the file minus 1 all divided by 2.

The new versions of the project can be downloaded below:

Retail Set project for EV3COMPOS3R II

Education+plus Extension Set project for EV3COMPOS3R II

Download of 3 packs of 10 tunes for either version of the project here with instructions for use

I hope to add further videos of the new version to YouTube soon

 

Advertisements