This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-05-18 17:22:41

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

MIDI synchronization in SCRATCH

Hey guys, I'm working on a music project in SCRATCH, but I've seemed to have encountered some kind of problem.

The music projects is based on a composition I created for the piano, both the left hand and right hand playing simultaneously. At first I created a single sprite, with two scripts, one for the right hand melody line, the other for the left hand harmony line, both scripts done in this manner:
When 1 Key pressed
     Play note for 0.5 beats
     Play note for 0.5 beats
     (and so on, until it's done)

It seems to work fine most of the time, but sometimes, the scripts didn't synchronize: one script would shoot off slightly earlier than the other, and the melody and harmony lines would be in discordance.

I moved one of the scripts to the other sprite, thinking that might be the issue, but still no such luck. I also changed the instruments of the melody line, but again, the synchronization problem would randomly occur.

Anybody got ideas on how to synchronize the two scripts together?

EDIT:
Here's the link to the project, if anyone is interested:
http://scratch.mit.edu/projects/cheddargirl/533212

Last edited by cheddargirl (2009-05-18 18:38:23)


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#2 2009-05-18 20:53:41

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: MIDI synchronization in SCRATCH

It's becuse of all the lag. I found one way around it is to shift-click on Extras, click "set single stepping" and set it to turbo. You have to do that every time you open the project, though.


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#3 2009-05-18 22:43:05

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: MIDI synchronization in SCRATCH

You can use the [Broadcast and wait] system I used in this project:
http://scratch.mit.edu/projects/MyRedNeptune/451954

The whole melody is split into parts (loops), which are broadcasted one after another in a single script.


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

#4 2009-05-19 13:18:22

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: MIDI synchronization in SCRATCH

hmnwilson wrote:

It's becuse of all the lag. I found one way around it is to shift-click on Extras, click "set single stepping" and set it to turbo. You have to do that every time you open the project, though.

Wow, that significantly improved the execution time within the first run. It's too bad that can't set turbo speed single stepping when running projects online  sad


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#5 2009-05-19 13:23:04

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: MIDI synchronization in SCRATCH

MyRedNeptune wrote:

You can use the [Broadcast and wait] system I used in this project:
http://scratch.mit.edu/projects/MyRedNeptune/451954

The whole melody is split into parts (loops), which are broadcasted one after another in a single script.

Hmm, broadcast messages, I've never thought about using those. Thanks for the tip and the link! I'll go check it out  smile


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

Board footer