Closed walterbender closed 7 months ago
That's Interesting. I want to work on this. The project aims to translate alphabets to Morse code right?
The goal is to use Morse code to generate rhythmic patterns.
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..
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.)
Where can we find the sugar activities?
GitHub com/sugarlabs
@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?
GitHub com/sugarlabs
Should I add an issue at help-activity or submit a PR directly?
Feel free to create issues directly
A project on the planet would make the most sense. I think there are adequate existing blocks to make this app.
@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?
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 like this? https://github.com/sugarlabs/musicblocks/assets/105922142/b5d48b2b-1f58-4afb-a213-ed2f4242eee7
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 what about this sir?
https://github.com/sugarlabs/musicblocks/assets/105922142/20fea362-a628-4aa4-a18b-e1825df9170b
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 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?
Something like this...
@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
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.
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 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?
Yes. My example is one simple approach. There are other ways as well.
@walterbender please review it ,Then i will publish it in global section
https://github.com/sugarlabs/musicblocks/assets/105922142/b1c5c9bf-23d6-4cd2-a53e-8deac00a159b
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 plz review it.
https://github.com/sugarlabs/musicblocks/assets/105922142/28b2d6e3-c224-4e8a-bab9-1fab37e692f5
I was thinking of a play button like ^^
@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
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 Done,Plz review it. https://github.com/sugarlabs/musicblocks/assets/105922142/aec3d316-cb78-4fc4-b2d3-701f8aaf3752
Excellent. So maybe the empty heap should be a button too? And a show heap button? Then I think it is solid.
@walterbender I tried to do like the above one but the problem is that in Ensemble block we only have .The below block So we can only get the value at the particular index,But the Use of the show heap is to print all the values at a given time.Like this
And similarly we cannot empty the whole heap using the above startegy. I think we can do it without buttons ?
You can have those buttons broadcast events that the startblock that "owns" the heap can listen for.
@walterbender I have tried it but didn't work https://github.com/sugarlabs/musicblocks/assets/105922142/c4008c89-d933-4c9a-bfc7-314b3fdd0e9c
Can you upload your project here or to the planet?
FINALMORSECODE (2).zip Click on initialze action to start the project.Show below
Check out this version... morse.zip
@walterbender When i click on Play button it is able to broadcast the event play but PlayAll action is not triggered from mouse1.Hence not able to listen the complete music rhythm similarly for other buttons.
https://github.com/sugarlabs/musicblocks/assets/105922142/7814f1a9-27f0-4d9d-b0fa-3800f17674cf
Hmm. It was working for me. I'll look again.
I added a print to the play for debugging. Works fine for me. Fedora/Chromium morse.zip
@walterbender I thought of a solution that can't we make the heap block global that is every start block will use the same heap block,What do you think?
There is no reason to have more than 1 heap, controlled by just one mouse. We can use event handling.
@walterbender I am telling that if heap is suppose ["T","T","T"] with respect to mouse1 then when we print the heap with respect to other mouse(let's say PlayAll),Then we will see Empty heap[](without help of broadcast).So we can make a common heap so that other mouse will also give heap as ["T","T","T"] . https://github.com/sugarlabs/musicblocks/assets/105922142/ddf24ece-6412-40f6-bb05-f8013eb3b4f6
Please look at the code I shared once again. Using one mouse/heap with events is the simpler solution.
@walterbender I have installed chromium and ran the project still doesn't work,It might be a problem in my browser.Can u confirm it from some one or should I ask some one to check if it works in their browser?
Are you sure you are running the correct file? I pushed my version to the planet. https://musicblocks.sugarlabs.org/index.html?id=1707347782903764
Try adding prints to the broadcast actions to make sure they are getting triggered. And prints to the event handlers.
Are you sure you are running the correct file? I pushed my version to the planet. https://musicblocks.sugarlabs.org/index.html?id=1707347782903764
Try adding prints to the broadcast actions to make sure they are getting triggered. And prints to the event handlers.
@walterbender yes.
https://github.com/sugarlabs/musicblocks/assets/105922142/00588706-cd17-4818-bb50-044ff439a9f6
Why are you clicking on the playall stack instead of clicking on the button?
When you do that, you no longer have the event handlers active since you are running a new mouse.
Why are you clicking on the playall stack instead of clicking on the button?
@walterbender now even the broadcastplay doesn't work.
https://github.com/sugarlabs/musicblocks/assets/105922142/0c92efd2-060f-4d6d-bc7c-4e5db6c3a7bc
If you don't mind can you please show a video at your end.
is this issue being worked upon? if not I would like to give it a try :-)
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.