Gmc Metronome - Flash Coding Help Needed! |
|
Gmc Metronome - Flash Coding Help Needed! |
|
|
|
|
Jul 2 2007, 10:06 AM |
Hey there,
We have a very helpful user named Marraboy, who is a flash programer (check his site here) and who has decided to donate a flash metronome to GMC. He has insisted to do it for free so be sure to help him out in the forum as much as you can! Either way - there seems to be a slight bug, we have agreed to ask openly about it. So if anyone has a suggestion how to solve this, please let us know here. Check out the metronome in Wallimann's most recent lesson (found here). You might notice that the metronome clicks unevenly at higher speeds - which is what we would like to fix. This is only a problem when the flash video player is open simultaneously. Kris |
|
|
||
|
|
|
Jul 2 2007, 10:33 AM |
There must be Flash forums where people can help. I don't know if these are any good, just googled a couple.
Flashsupport Flashguru And the metronome see uneven at any speed and it's not up to tempo, it falls behind my Guitarport metronome in speed. Or it's my metronome that is not perfect. Thanks Marraboy for helping EDIT: And the "falling behing in speed" happens also when flashplayer is closed. I'm curious to know if it's this or my metronome that's got the wrong tempo. This post has been edited by MickeM: Jul 2 2007, 10:37 AM -------------------- My bands homepage
All time favourites: B. Streisand - Woman in Love, M. Hopkin - Those were the days, L. Richie - Hello |
|
|
||
|
|
|
Jul 2 2007, 10:49 AM |
Hey there, We have a very helpful user named Marraboy, who is a flash programer (check his site here) and who has decided to donate a flash metronome to GMC. He has insisted to do it for free so be sure to help him out in the forum as much as you can! Either way - there seems to be a slight bug, we have agreed to ask openly about it. So if anyone has a suggestion how to solve this, please let us know here. Check out the metronome in Wallimann's most recent lesson (found here). You might notice that the metronome clicks unevenly at higher speeds - which is what we would like to fix. This is only a problem when the flash video player is open simultaneously. Kris I don't have experience of flash programming, but I do have quite a lot of experience in developing software generally. My question would be how is the timing of the metronome ticks generated? Is it from a hardware timer? When the time expires and a new tick is needed, how is this event serviced? The problem sounds like the flash player sometimes has to do a higher-priority thing rather than play the tick when requested, resulting in uneven ticking at higher speeds. The fact that the problem is worse when the flash video player is active would also indicate this. Can the metronome 'tick' routine be put on a higher priority? The only other explanation I can come up with is that the timer is very inaccurate in counting out the required delay. Not much of a solution I'm afraid, but maybe it will give Marraboy a few ideas about how to tackle the problem. -------------------- QUOTE If you think you can, you can. And if you think you can't, you're right. |
|
|
||
|
|
|
Jul 2 2007, 02:00 PM |
I would echo what Ressurection says,
but wanted to add, thanks Marraboy for helping to make GMC even better ! -------------------- Check out my Instructor profile
Live long and prosper ... My Stuff: Electric Guitars : Ibanez Jem7v, Line6 Variax 700, Fender Plus Strat with 57/62 Pickups, Line6 Variax 705 Bass Acoustic Guitars : Taylor 816ce, Martin D-15, Line6 Variax Acoustic 300 Nylon Effects : Line6 Helix, Keeley Modded Boss DS1, Keeley Modded Boss BD2, Keeley 4 knob compressor, Keeley OxBlood Amps : Epiphone Valve Jnr & Head, Cockburn A.C.1, Cockburn A.C.2, Blackstar Club 50 Head & 4x12 Cab |
|
|
||
|
|
|
Jul 2 2007, 02:46 PM |
As ever, Kaneda gives a complete and well resoned response
I'm guessing you can't reset the timer right at the beginning of the handler like you can in some languages. Maybe this would work better in a Javascript + DHTML format? Might even try that if I ever get a spare moment ... -------------------- Check out my Instructor profile
Live long and prosper ... My Stuff: Electric Guitars : Ibanez Jem7v, Line6 Variax 700, Fender Plus Strat with 57/62 Pickups, Line6 Variax 705 Bass Acoustic Guitars : Taylor 816ce, Martin D-15, Line6 Variax Acoustic 300 Nylon Effects : Line6 Helix, Keeley Modded Boss DS1, Keeley Modded Boss BD2, Keeley 4 knob compressor, Keeley OxBlood Amps : Epiphone Valve Jnr & Head, Cockburn A.C.1, Cockburn A.C.2, Blackstar Club 50 Head & 4x12 Cab |
|
|
||
|
|
|
Jul 2 2007, 05:34 PM |
Thats strange that it does that .. Have you asked Marraboy himself about the bug? Him being the flash programmer he might know how to fix it ? But as for now it seems we can at least practice up to where it starts making it mistakes. Does anyone have an exact Bpm of when this occurs ? Thanks-John it is not a bug, not really. the logic of what he did is there. however flash is a very high level language, that is, a very busy one. a lot goes on, and subroutines have to wait their turn to be served. normally these slight delays (fractions of a second) have no bearing in any practical sense, and are not noticed. for applications that require precise timings, a language closer to the machine is more appropriate. however, for such languages, building a gui is a major task. in flash building a gui such as for this metronome is trivial. i will play around with this, see if i can come up with something, in the next couple days (unless somebody takes on the challenge and beats me to it). there is almost always a solution to these things, not always, but most of the time. basically what has been stated above is what needs to be done, a scheme to correct the inevitable delays in response. edit: here is a link, where the guy says pretty much the same thing. http://www.bit-101.com/blog/?p=910 I am hoping somebody takes up the challenge so i don't have to, being a very lazy person, who does not have a lot of ego, or at least a person who tries to keep his ego in check, i would be very happy with that outcome. I don't think it would be very difficult, it does not have to be perfect, just close enough from the user's perspective. This post has been edited by fkalich: Jul 2 2007, 05:56 PM |
|
|
||
|
|
|
Jul 2 2007, 09:08 PM
|
|
I haven't even looked at AS3 yet, as I have too much onoing AS2 stuff!!!
It's simple don't look at Youtube before you use the metronome!!! I guess that if the user closes the browser completely and reopens this will destroy the initial instance of the flash player? As you know your flash stuff, have a look at this and see what you think: http://www.electro-server.com/forum/?f=2&m=3743 - it's baffling me?!?!?! This post has been edited by Marraboy: Jul 2 2007, 09:10 PM |
|
||
|
|
|
Jul 3 2007, 12:42 AM |
I haven't even looked at AS3 yet, as I have too much onoing AS2 stuff!!! It's simple don't look at Youtube before you use the metronome!!! I guess that if the user closes the browser completely and reopens this will destroy the initial instance of the flash player? As you know your flash stuff, have a look at this and see what you think: http://www.electro-server.com/forum/?f=2&m=3743 - it's baffling me?!?!?! I will look later at that link. BTW, Moock's 3.0 book just came out, I ordered it today. As you may agree, nobody writes on Actionscript better than Moock. I am surprised that you got the metronome to work at all with Flash, in any steady beat. I ran some tests using 3.0, and to me it does not seem possible, just too much going on. Below is an example where i check every 5 milliseconds, at 240bps. Seems like it is impossible to avoid delays, based on my readouts. Weird thing is that even when the readouts are pretty steady, I can hear an unsteady pattern to the beat. Perhaps the routine passes the command to the mp3 players asynchronously, but there is a delay in the player module, would not surprise me. You are saying you got this to go steady? Based on what i have seen, i have concluded that our friend from Holland is right, just no way with flash to get that kind of accuracy. I read where that is the case in another source, seems that delays of up to 100 ms can occur at times, and smaller ones quite frequently. I realize only half our audience will understand this, not the half working in the food service industry. package { import flash.display.Sprite; import flash.utils.*; import flash.events.TimerEvent; import flash.media.Sound; import flash.media.SoundChannel; import flash.net.URLRequest; public class MyTest extends Sprite { // The time of the last beep var lastBeepTime:Date; // 4 bps so 240 bpms var INTENDEDINTERVAL:Number = 250; var _sound:Sound = null; private var url:String = "beep_1.mp3"; var myBeep:Sound; public function MyTest() { // Timer will go off every 5 ms var myTimer:Timer = new Timer(5); myTimer.addEventListener(TimerEvent.TIMER, onTimer); lastBeepTime = new Date(); var request:URLRequest = new URLRequest(url); myBeep = new Sound(); myBeep.load(request); myTimer.start(); } function onTimer(event:TimerEvent):void { var sampleTime:Date = new Date(); var msPassed:Number = sampleTime.getTime() - lastBeepTime.getTime(); // if time passed is at least the interval - 5ms if( msPassed > (INTENDEDINTERVAL-5) ) { trace("Time elapsed Before BEEP at "+msPassed+" MS"); myBeep.play(); lastBeepTime = sampleTime; } } } } This post has been edited by fkalich: Jul 3 2007, 12:47 AM |
|
|
||