LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

[fixed] BGMVAR crash

Root / SmileBASIC Bug Reports / [.]

12Me21Created:
original postI crashed smilebasic with MML somehow... And no, I wasn't using any of the fancy features like variables. Unfortunately since I lost the code, I can't figure out what caused the problem...
Fixed in 3.3(.1?) Using BGMVAR too quickly while music is playing will crash SB. For example:
BGMPLAY 3
WHILE 1
 BGMVAR 0,0,0
WEND

What type of MML features were you using (standard notation, macros, channels, etc..)?

Ok, I figured it out. Apparently I was using BGMVAR (probably), because I found the glitch: If you use BGMVAR too quickly while music is playing, SmileBasic will crash. It's that simple. Things that do nothing: WHILE 1:BGMVAR 0,0,0:WEND (no music playing) BGMPLAY 0:WHILE 1:BGMVAR 0,0,0:WAIT:WEND (too slow) Things that crash SB: BGMPLAY 0:WHILE 1:BGMVAR 0,0,0:WEND I also found 2 other glitches that I have yet to reproduce: 1: 3DS freezes with black screen; music continues to play 2: Smilebasic freezes (you can press buttons but it does nothing) and music continues (this is just caused by a single command taking a(n infinitely) long time to execute). (I think I was using EFCSET, plus multiple channels) Anyway, I have a theory about why BGMVAR crashes SB. Music and sound can get very laggy. for example, try doing something like BEEP 69,10000. It stops all sounds for a second. Also, If you do stuff like WHILE 1: BEEP: WEND, it will sound very glitchy. Maybe BGMVAR is the same, but since it affects more than just sound, it causes SB to freeze.

I wonder if this had anything to do with the MML processing time. The documentation suggests that there is approximately a 2 frame delay when using BGMPLAY. Could be mangling something by setting BGMVAR before it's done.

How do you activate MML?? I used a program that helps me get it running and interface with it. I wondering how to activate the actual pre-installed tool. P.S. I did buy the DLC so I was wondering if i could get help there too

MML is just a musical notation language that can be represented by a string of characters like this (in the same way a musician would understand what notes to play when looking at sheet music):
BGMPLAY "CDER4FV65D"
Internally SmileBASIC reads the string and interprets what sounds you are asking it to make. If you type the above code into direct mode and execute it, it will play the following in order:
  • C
  • D
  • E
  • Quarter Note Rest
  • Volume Change to 65
  • D
There are many more commands in the documentation which can be found here: http://smilebasic.com/en/reference/#mml, that will alter the octave, note length, pan, and playstyle (vibrato, tremolo, etc). You can get surprisingly complex music out of such a simple system. I'm not sure what you mean by pre-installed tool, but if you are talking about a way to generate MML through a gui (instead of typing out cumbersome strings), let me take a moment to plug my MML Tracker (http://smilebasicsource.com/page?pid=375). It is a little slow on playback on an original 3DS, but I have an optimized version coming very soon. On a new 3DS is works quite well.

@glennxserge, I have your program, it works great for N3DS, but the problem is it doesn't represent a music sheet correctly, instead of bars, I would like actual notes.

Ah, I see what you are saying. You want real musical notation like Sibelius or something. I don't think anything like that exists yet, or at least I haven't seen any programs like that. I'd say that it's not a huge leap to interpret what you know about sheet music into an MML Tracker though. I have a note length button in my application, tapping it changes the default length of notes and it's represented by an actual music note, you could use that for reference. For instance eighth notes are 16 pixels long and take up one tile. I know if I'm looking at 32 pixels, that it's a quarter note, and the grid makes it easy to see it takes up 2 tiles (wide). It's sort of a learning/remapping process if you've always used sheet music, but I don't think it's particularly hard to do. Just out of curiosity though, since you're musically minded, what sort of features do you expect out of an music application?

First, thanks, that explanation of the bars helped immensely. 2, I'm running my own trial and error learning course to recreate other melodies. If I succeed, I will use it for my games. Would it be possible to make those buttons slightly bigger? BTW right now I have an idea for a spin-off between Mega Man and Cave Island. At this point, I'm learning the tools and type of program language. The reason why I'm familiar with notes is because I played the piano for about 3 years and still have a bit of talent. I really do appreciate your' GUI

Would it be possible to make those buttons slightly bigger? BTW right now I have an idea for a spin-off between Mega Man and Cave Island
Yeah, I think it's possible, I need to rethink how the controls are displayed on the top row a bit, as space is a bit tight, but that's the kind of feedback I'm interested in getting. And I'm always interested when mentions Mega Man as an inspiration for a game. Good luck with your projects. Let me know if you have any other questions about MML or the GUI in general.

Find me on Miiverse (same nickname) and check out the Mega Man practice art. thanks again ♪♪♪♪♪