musicblocks icon indicating copy to clipboard operation
musicblocks copied to clipboard

Morse Code rhythms

Open walterbender opened this issue 1 year ago • 63 comments

In the overture of the movie Mission Impossible (MI), the rhythm begins with a mapping of the Morse Code for MI.

dah dah (M) dit dit (I) --> 1/4 1/4 1/8 1/8

It would be fun to have a MB project that lets you generate Rhythms by typing in letters that generate rhythmic patterns.

walterbender avatar Jan 24 '24 13:01 walterbender

That's Interesting. I want to work on this. The project aims to translate alphabets to Morse code right?

richardshaju avatar Jan 25 '24 18:01 richardshaju

The goal is to use Morse code to generate rhythmic patterns.

walterbender avatar Jan 25 '24 20:01 walterbender

Hello @walterbender for this year gsoc how can we proceed for adding the games in the sugar,means how can we start with it. I am bit confused..

AviGawande avatar Jan 26 '24 11:01 AviGawande

For this particular issue, I think it would be a Music Blocks project. That said, we have developed a lot of games in Music Blocks. It might be a cool project to port some of them to Sugar activities. (This would involve essentially rewriting them from scratch in Python, but it would be a nice addition to the Sugar activity collection.)

walterbender avatar Jan 26 '24 13:01 walterbender

Where can we find the sugar activities?

richardshaju avatar Jan 26 '24 18:01 richardshaju

GitHub com/sugarlabs

walterbender avatar Jan 26 '24 20:01 walterbender

@walterbender We only have to use the existing components(Notes,pitches etc...) for generating rhythms right? ,Should I have to create a new project and publish it in global of planet? . And also when i type M we should listen dah and when i type I we should listen dit ,Then I have to add eventlistener and where should i make changes ,Should i create a new file in the repo like MI.js?

falgun143 avatar Jan 27 '24 05:01 falgun143

GitHub com/sugarlabs

Should I add an issue at help-activity or submit a PR directly?

richardshaju avatar Jan 27 '24 14:01 richardshaju

Feel free to create issues directly

walterbender avatar Jan 27 '24 16:01 walterbender

A project on the planet would make the most sense. I think there are adequate existing blocks to make this app.

walterbender avatar Jan 27 '24 16:01 walterbender

@walterbender I am under work see the below video

https://github.com/sugarlabs/musicblocks/assets/105922142/3e7c03d0-4612-4082-a10a-1f08c1b3b218

i have a small doubt i have created this using simple blocks(Will make changes for better quality).Now i will add keyboard event letters for M and I .When users press these letters music should come up,Please tell me should i create a new js file which will handle this evenlisteners and then publish this on the global ,And then make a pr or anything else?

falgun143 avatar Jan 27 '24 17:01 falgun143

I would approach this differently:

make a set of actions named by the alphabet, where each action plays a rhythmic pattern defined by that letter's code. then in a loop, use the input block to get letters to use with the do block.

walterbender avatar Jan 27 '24 20:01 walterbender

@walterbender like this? https://github.com/sugarlabs/musicblocks/assets/105922142/b5d48b2b-1f58-4afb-a213-ed2f4242eee7

falgun143 avatar Jan 29 '24 07:01 falgun143

That is a good start. I think it might be more obvious if there were a bigger difference between the note values as well. And you'll want to accumulate the letters onto a heap so that you can play back a rhythmic pattern. (This might even be a case of where we want to use the make block block, but that can be a separate step.)

walterbender avatar Jan 29 '24 14:01 walterbender

@walterbender what about this sir?

https://github.com/sugarlabs/musicblocks/assets/105922142/20fea362-a628-4aa4-a18b-e1825df9170b

falgun143 avatar Jan 31 '24 16:01 falgun143

That is more fun. But we'll want to define an action for each letter of the alphabet, not just M and I. You probably want to use the "do" block, using the input as the name of the action.

walterbender avatar Jan 31 '24 16:01 walterbender

@walterbender morse code is mapped to MI ,So why we will need to assign each letter of the alphabet to a particular action ,And even if we do that what should each letter of the alphabet be mapped as an action?

falgun143 avatar Jan 31 '24 17:01 falgun143

Screenshot from 2024-01-31 14-01-00

Something like this...

walterbender avatar Jan 31 '24 19:01 walterbender

image @walterbender As you can see in the above picture that M is mapped to a action which reprsents long note with certain pitch.And I is mapped to a action which seems complex as compared to action of M.

The the rythm pattern is image

Now the logic which i used is that when, I I comes for the first time the pitch is high then low in one way and again when ,I I comes for the second time the pitch is high then low in other way.

See the below video for reference.

https://github.com/sugarlabs/musicblocks/assets/105922142/57894e7a-7877-4d4d-8fff-4de1810c49d5

As shown in the rhythm pattern picture first two I's comes at index 2,3 and the second two I's comes at index 6,7 .So we need a counter to identiy these index's.And by listening to original music we want the music to be same at index 2 and 6,And a bit lower pitch at index 3 (As compared at index 2).And lower pitch at index 7 (As compared to index 6).

Initially the box1 value is set to zero and heap is empty.(As there might be a value already store in the box1 due to previous actions) So i used a box.And as the loop run's we incremet the box value ,And when the user types I for the first time the value of box is 2 ,For the second time value is 3 ,For the 3rd time value is 6 ,For the third time value is 7.So according to the requirements i have set the action for I.And also I have stored the action values in the heap.And again set block's value to zero.

Now when we play the whole pattern using heap .First we have to reverse the heap as to get the original sequence.,As to run the I action correctly we again have to increment the value of box (As we have done in the start block).

If there are any suggestions please let me know.

falgun143 avatar Feb 01 '24 04:02 falgun143

The goal is not to transcribe the Mission Impossible theme music. That as just the inspiration for the project idea. The goal is to be able to type ASCII and have it converted into a rhythmic Morse code.

walterbender avatar Feb 01 '24 14:02 walterbender

@walterbender so each letter of the alphabet should have to mapped to a action ,And i should assign action to each letter of the alphabet so that a rhythm is generated right?

falgun143 avatar Feb 01 '24 16:02 falgun143

Yes. My example is one simple approach. There are other ways as well.

walterbender avatar Feb 01 '24 17:02 walterbender

@walterbender please review it ,Then i will publish it in global section

https://github.com/sugarlabs/musicblocks/assets/105922142/b1c5c9bf-23d6-4cd2-a53e-8deac00a159b

falgun143 avatar Feb 02 '24 06:02 falgun143

This is getting pretty good. Can you add a button play back the heap? When you play it back, since it is a FILO, you'll need to reverse it first. And the instructions on the input could be a bit more to the point... type in a character. Perhaps some message at the start to explain what is going on?

walterbender avatar Feb 02 '24 14:02 walterbender

@walterbender plz review it.

https://github.com/sugarlabs/musicblocks/assets/105922142/28b2d6e3-c224-4e8a-bab9-1fab37e692f5

falgun143 avatar Feb 03 '24 17:02 falgun143

Screenshot from 2024-02-04 14-52-40

I was thinking of a play button like ^^

walterbender avatar Feb 04 '24 19:02 walterbender

@walterbender there is a problem with that .The new start block(Play button start block) is a different world from the first start block(Mouse start block),The play action in the second start block assumes that thre is noting being push into the heap(But actually was pushed in the first start block) and give's a message of empty heap.

https://github.com/sugarlabs/musicblocks/assets/105922142/d4b16a6c-5f7c-4b71-8212-f81022d10453

falgun143 avatar Feb 05 '24 07:02 falgun143

On the ensemble block there is a way to access the heap of a different start block, as long as you give that start block a name.

walterbender avatar Feb 05 '24 12:02 walterbender

@walterbender Done,Plz review it. https://github.com/sugarlabs/musicblocks/assets/105922142/aec3d316-cb78-4fc4-b2d3-701f8aaf3752

falgun143 avatar Feb 05 '24 15:02 falgun143

Excellent. So maybe the empty heap should be a button too? And a show heap button? Then I think it is solid.

walterbender avatar Feb 05 '24 15:02 walterbender