Scratch Piano Notes

0 views
Skip to first unread message

Kayleen Dauteuil

unread,
Aug 5, 2024, 2:33:16 PM8/5/24
to stelitroeper
Whilenotes cannot be smaller than 0 or larger than 130, notes can be any decimal number within the aforementioned range. While unselectable on the piano keyboard, a decimal number can be inputted and a note will play at the appropriate frequency.

If you want to get a 'real' piano sound, it's best to work with samples (hold them in memory if you don't want to keep them in the filesystem). If you just want a simple way of emitting accurate notes (which sound nothing like a real piano) then doing it programmatically is the way to go!


If you want to emulate a piano specifically you only have two options, one of which is to use samples and the other is physical modelling. Physical modelling requires some pretty advanced knowledge of DSP (filtering, convolution, etc.) and a piano would be a challenging instrument to tackle but it has been done by the likes of Pianoteq


On the subject of samples, to create a piano that is anywhere near a convincing analogue you would ideally require more than one sample per note for different velocities with crossfades between them but you can probably get away with using a sample over a limited range of notes to reduce the total number of samples.


Now that these 6 notes are imported, we can code them into our program. To be able to play the piano in Scratch, we need to write our program so that these notes will play when certain keys are pressed. We can accomplish this with two different types of blocks:


When you are ready, go ahead and add the code in the image above to your program, mapping 1 to A, 2 to C, 3 to D, 4 to E, 5 to F, and 6 to G. When you are finished, you should be able to press these numbers on your keyboard and hear the associated notes.


Written by Matt Schofield, an educator and avid coder. After studying Spanish at the University of Pennsylvania, Matt began teaching English as a second language to elementary students in Baltimore. In addition to his full-time teaching position, Matt enjoys teaching computer science in the evenings and weekends with Create & Learn.


In the pre-existing project that I began with, there was already coding to make the clones disappear once they reached the bottom of the screen. I edited the y coordinate in this code so that the falling sprites would disappear as soon as they aligned with the circles on the piano keys : y = -130.


After doing this I realised that the F# would prove to be a problem as the circles for the black notes were higher, therefore needed to be deleted at a higher y coordinate. I decided to create an entirely new sprite rather than create a costume for the F#. This way I could easily program that sprite to delete itself once it reached the appropriate y coordinate.


To emphasise when the falling sprites would align with a black key, I decided to change the colour of the falling sprites and the circles on the keys so that they matched. Yellow for white keys and green for black.


However in Bandlab when i do this instead of the piano roll view showing just the midi notes in that track/tracklane, it shows a huge jumble of notes in different colors that i think are every note from every take all superimposed on top of each other. Possibly midi notes for other tracks as well?


Im currently doing a test recording in Bandlab where i have put down a scratch midi keyboard track and two takes of midi drums. Im stuck at editing my takes, because piano roll view shows every midi note from every track, rather than just the clip / track / tracklane that i am trying to edit.


I am seeing three "view"menus all above each other when i open piano roll, i have checked off and on boxes with no success, and would rather not tinker as i have no idea what the buttons im pushing do.


Seem to have made progress - switching on "hide muted clips"in the piano roll view menu might be the answer. I was focusing my efforts on the middle view menu with the display submenu, that i now suspect only applied to the track view screen.


Muting clips and enabling 'hide muted clips' is only necessary when you want to hide notes in different lanes of the same track. To show only the notes of one track, you just need to open the Track Pane at the right side of the PRV (View Show/Hide Track Pane. This gives multiple options for filtering what you can see and edit. Normally it will default to just showing the track you double-clicked as you expect:


While I had the trial version, at one point, the midi editor created piano notes but only after "recording" an empty midi track and then editing it. After I bought and installed the Sountrack Edition, I cannot seem to get the piano back.


Go to the Synth tab at the bottom of the arranger screen. Click (or double-click) on the Vita Midi Editor. The "piano roll" will open, and it should load the default MIDI sequence and instrument, which is usually the default piano. I can't imagine they would not have an acoustic piano instrument available.


When there is an existing MIDI object in the arranger, click (or double-click) on it to open Vita....OR, right-click on the MIDI object and click on "MIDI Editor"....(or something to that effect). You can open the instrument Editor from the same right-click menu.


If you are missing instruments (you won't have as many with a special edition), it's possible the program did not load correctly, you did not update the program, and/or the trial version was not completely removed before loading the full program.


I could not find a "Synth tab". My tabs are "Soundpools", "File Manager" "Instruments", "Templates", and "Keyboard". Under "Instruments" I have two sections: "VST Instruments" with "String Ensemble" and "More...". I also have an "Object Synthesizer" box with three objects: "BeatBox2", "Robata", and "Livid".


Hi! I'm Max & I've been teaching piano lessons in the UK for 10 Years. This website and accompanying YouTube channel were created to help people like you along their journey learning the piano. To help them become better students of music whether learning alone or as an extra resource outside of lessons.


Check out the collection of helpful, in depth and beginner friendly PDF guides available - Chords, scales & other must know music theory with a practical approach - Step by step explanations, unique tips and tricks to memorize what you learn, clear graphics and glossaries, fingerings, cheat sheets & more!


Piano from scratch is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by linking to Amazon.com. Piano from scratch is compensated for referring traffic and business to Amazon and other companies, but this in no way increases the cost to you if you opt to make a purchase from my links.


It gave me a great deal of trouble, and took a very, very long time. I had no idea what I was doing in the beginning, but slowly, borrowing ideas from smart people online, it finally came together. It's got 11 keys (the black keys are just for show), and uses a Makey Makey, Scratch, and pressure plates to complete the circuit and activate the sound. Hopefully, my instructable will be thorough (and clear) enough that you can make one too!


Whole lotta cardboard for your keys (22 pieces, cut to 10" x 40" rectangles - preferably with no folds in them - also, if you use the same thickness of cardboard throughout, it may save you some headache later)


Large sheet of thick foam (I used something like this, which we happened to have on hand, but you could also use foam exercise mats, which might be easier all around) - you're going to cut this into 22 strips, 40" long x 1 1/2" wide


Each key of your piano will use two pieces of cardboard. You're going to put them together like a sandwich, with a small space in between the top and bottom sandwich layers. The first picture is a front view of one key, sitting on a table - notice the small gap between the layers.


To prep your keys, first off, you need to put a layer of aluminum tape on the inside of each key piece, leaving a narrow strip uncovered on either side (this is where you'll glue down your foam strips).


*You'll notice in the picture above that one of my key pieces is shorter than the other - this is because I had a hard time finding single pieces of cardboard that were long enough. I finally settled for some shorter pieces, and oriented the keys so that the shorter ends would be at the tops of the keys. (I imagined that kids stepping on the piano would be more likely to step on the bottoms of the keys.) I also decided to save myself some aluminum tape and kept the aluminum layer on the opposite key piece (the longer one) short as well. Once I put the keys together, I filled in that extra space with leftover pieces of foam. If you're able to find enough cardboard that is long enough, then you don't have to worry about this. Ideally, both pieces of your key will be 40" long, and the aluminum layer will extend all the way from the top edge to the bottom edge. I also decided to add a little extra aluminum tape to the fronts of my keys, wrapping it around that edge. (This is why you see aluminum on the fronts of my keys in the first picture).


*You might also be able to use aluminum foil rather than aluminum tape (and maybe save a bit of $), but we anticipated that our piano might get some heavy use, and opted for more durable materials. Aluminum tape is a whole lot thicker than aluminum foil. Also, the adhesive on the aluminum tape made the process very easy.


*My vocabulary is limited, so I use the terms top and bottom a lot. Each key is made like a sandwich, so sometimes I'm referring to the top sandwich piece or the bottom sandwich piece. Also, as you're constructing the piano, you want to decide beforehand which key edges are which in reference to the orientation of your piano. Which edge of the key will be the top, and which the bottom. If I'm still confusing you, you can check out my drawings.


Now it's time to glue down the foam strips on either side of the bottom sandwich portion only of your key. In my first attempt, I used Elmer's glue, and though it worked, it didn't take a whole lot of effort to loosen the strips (they came up if I tugged gently), so I switched to a good ol' reliable glue gun. Each strip of foam is 40" long (the same length as the key) and about 1 1/4" to 1 1/2" wide. The type of foam I used cut quite easily with a regular (but sharp) pair of scissors. To mark your foam, you'll want to use a marker (a pencil or pen will tear it).

3a8082e126
Reply all
Reply to author
Forward
0 new messages