Tuesday, April 22, 2014

A Musical Interlude

It's been waaay too long since I posted something on this blog that wasn't undub related, but over the past couple of days, I've actually been working on something pretty cool that I wanted to share here. It's a little app called Microtone. For anyone not familiar with microtonal music, basically the idea is to compose music using a scale other than the traditional 12-step scale used by almost all modern music. For some examples of microtonal music, check here, here, and here.

While microtonal music is certainly nothing new, very few instruments and tools exist for making it. Consequently, not that many people attempt to create music using non-traditional scales, and very little good music exists outside the boundaries of the standard 12 tones. I created Microtone as a quick app that people could use to experiment with different scales lengths, so that they might get ideas they wanted to use in serious compositions. Microtone itself is not really suitable for anything beyond experimentation, but I still think that it may serve the purpose of getting people interested in microtonal music. Or you can just mash your hands into the keyboard to make funny noises... Either way. ;)

Microtone works best with either Firefox, or a Chromium based browser (Chrome, Safari, Opera, etc.). Internet Explorer doesn't work at all (not even the newer versions), which is probably a surprise to no one. Using Firefox is preferable, because it appears to have a better audio mixer. Chromium based browsers may have weird sound distortion issues when playing more than two notes at a time. Also, if you have issues hitting multiple notes at the same time on your keyboard, you may want to look into a keyboard with n-key rollover. Anyway, give it a try and let me know what you think in the comments. ;)

27 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hello, any news on the Grandia 2 undub project? Do you know if someone else is finishing it? A project-website with a Donation button would be great. Or are you done with anything undub related?

    ReplyDelete
    Replies
    1. Sorry to say, but I have not done any work on the undub since the preview release. I was planning on starting up again once I had it working on my shiny new GD-ROM emulator (http://gdemu.wordpress.com), but I ran into a small issue getting it to work on the unit. Deunan said he would try to fix the problem in the next firmware update, so once that is released and I have a change to confirm that everything I've done with the undub works correctly on real Dreamcast hardware, I am planning on resuming work and hopefully finishing things up in a relatively short period. Oh, and there is a donate button on the top right of the page in case your missed it. ;)

      Delete
  3. First thanks for your work on the undub of Grandia 2 dreamcast version.
    I know it might not be the best place for this... but since you don't have links to a mailing list, forum post, w/e... so here it goes:
    I managed to run your undub version, and it changed the voices alright, but I didn't make it too far because I found an issue that bothered me, it removes the smoke trail that leave the lizard man while they run at the beginning of the game, for some time I though it was a problem on my end and I tried many stuff, until I tried running the same gdi image without the undub patch and the smoke trail showed up again. Tested with demul 0.58 and nulldc.

    ReplyDelete
    Replies
    1. Not to worry, this is absolutely the right place to contact me about this kind of thing. The opening scene of the game was one of the first things I undubbed, so it's not too surprising I might have messed something up there. I'll take a look at it later and see if I can figure out what happened. The existing patch is sort of beta quality, so if you find any other issues, please let me know about them.

      Delete
    2. Okay, I managed to fix the problem. To be honest, Grandia II's game engine is still a mystery to me in many ways, so I ended up having to fix things through trial and error, but it does seem to work correctly now. Here is a link to an updated patch that you can try: https://mega.co.nz/#!2k5gXJKL!ikTCIxNKLbJMcO-Fu8D0EHbcjskUzrF08g3Af21Ejv0 In addition to the fix for the issue you reported, it also fixes a few minor errors in the script for the early part of the game, and includes a much better patching script. If you could try the new patch out and report any problems you find with it, it would really help me out. I'm bad at spotting small things like the smoke trail issue you pointed out.

      Delete
  4. Something isn't right with the new patch, the ruby script fails:
    Let's undub Grandia II!
    Converting tracks from raw to user mode...
    Dumping files from original GDI...
    Error: undefined method `length' for nil:NilClass
    E:/dctemp/t/multiio.rb:111:in `pos='
    E:/dctemp/t/iso9660.rb:54:in `load'
    E:/dctemp/t/iso9660.rb:49:in `initialize'
    E:/dctemp/t/undub.rb:33:in `new'
    E:/dctemp/t/undub.rb:33:in `'
    Press any key to continue . . .

    ReplyDelete
    Replies
    1. Does this work?:

      https://mega.co.nz/#!T1J02bqZ!mC29Y2SrnLYOq8E3U6qbu5TnhOJwQ9OfOjoWYjhxok4

      And if not could you tell me what ruby version your are using, and upload a copy of your GDI file so I can test it?

      Delete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. Whoops, uh, minor oversight. ;) Try this link instead: https://mega.co.nz/#!n1AQyYxL!F7NZEX3gpNF-l2yWWkP25mwspc949lAkfOh2Vfqi4ao

      Delete
    2. Well I tested my new patching script with the copy of Grandia II you linked to, and it still worked perfectly on my end, so I'm not really sure what's wrong. I tried it with ruby 1,8, 1.9, and 2.0, and all the different versions worked correctly. For now, you can just copy the contents of the 0.91 undub folder over the contents of the 0.90 patch and use that since the old patching script seemed to work for you. That should bypass any issues created by the new patching script. But any information you could give my about your system's configuration (OS, Ruby version, ect.) might help me track the issue down. By the way, I have to delete your comment in order to remove the link to the Grandia II download. I had actually just meant for you to post the .gdi file somewhere...

      Delete
  6. The new undub.rb:
    https://mega.co.nz/#!n1AQyYxL!F7NZEX3gpNF-l2yWWkP25mwspc949lAkfOh2Vfqi4ao
    Still gives me the same error. My OS is windows 7 64 bit, the ruby version I installed is from http://www.rubyinstaller.org/ "RubyInstaller 2.0.0-p481"
    I tried using the ruby scripts from the version 0.90 with everything else from the 0.91 and it works, the voices are on Japanese and the smoke trail shows.

    ReplyDelete
    Replies
    1. Okay, glad you finally got it to work. ;) I'm using Windows 7 x64 and Ruby 2.0.0-p481 as well, but after repeated testing I can't duplicate your error. The only way an error like that could even happen is if there was some problem opening the tracks from the GDI image, or if your GDI image had become corrupted somehow. What the script tries to do, is to open each track of the GDI image individually and then use a special class that allows you to treat the tracks as a single file. This is preferable to my old approach of copying the tracks into a new file, because it ends up being much faster and not using as much disk space. An error like this would only happen if the total length of the tracks was less than the position in the disc image where my script looks for the ISO header. So I would double check and make sure all the tracks in your GDI image are the correct size, and did not get truncated somehow. But it's still really weird that my old script would still work and the new one wouldn't...

      Delete
    2. I think I may have found the problem, though if I'm right I still have no idea why it would have worked for me but not for you. Here is an updated multiio.rb:

      https://mega.co.nz/#!X9pCBCCK!3xbmG_rfuHPU-9vLh-6Q6yMdas8L1kZm15hx80KI4tA

      I ended up rewriting a ton of stuff because I wasn't entirely satisfied with my original code, so it may still have a few bugs, but I tested it and it did work (then again, so did the old one...). Try it out with the 0.91 patcher and see if you can get it to work. And if not, could you try opening a command prompt, running the following commands, and posting the output for me?:

      e:
      cd E:\dctemp\t
      (change the above two lines if you moved the patch files somewhere else)
      ruby -r debug undub.rb
      b 33
      c
      stream.streams
      stream.length
      stream.streams.each { | s | puts s.length }

      Delete
  7. 0.91 patch + your last multiio.rb
    F:\isos clients\dc\dctemp\trans>ruby -r debug undub.rb
    DL is deprecated, please use Fiddle
    Debug.rb
    Emacs support available.

    C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:57:
    (rdb:1) b 33
    Set breakpoint 1 at C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_requi
    re.rb:33
    (rdb:1) c
    Let's undub Grandia II!
    Converting tracks from raw to user mode...
    Dumping files from original GDI...
    Error: Cannot load an entry that isn't a directory.
    F:/isos clients/dc/dctemp/trans/iso9660.rb:111:in `load'
    F:/isos clients/dc/dctemp/trans/iso9660.rb:100:in `initialize'
    F:/isos clients/dc/dctemp/trans/iso9660.rb:421:in `new'
    F:/isos clients/dc/dctemp/trans/iso9660.rb:421:in `load'
    F:/isos clients/dc/dctemp/trans/iso9660.rb:350:in `get'
    F:/isos clients/dc/dctemp/trans/iso9660.rb:69:in `load'
    F:/isos clients/dc/dctemp/trans/iso9660.rb:49:in `initialize'
    undub.rb:33:in `new'
    undub.rb:33:in `'
    Press any key to continue . . .

    And then it goes back to the command prompt.

    ReplyDelete
    Replies
    1. Ungh, they are still distributing the debugger with the rubygems breakpoint issue? Okay, instead of "b 33", use the command "b undub.rb:33" instead. The rest should stay the same.

      Delete
    2. F:\isos clients\dc\dctemp\trans>ruby -r debug undub.rb
      DL is deprecated, please use Fiddle
      Debug.rb
      Emacs support available.

      C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:57:
      (rdb:1) b undub.rb:33
      Set breakpoint 1 at undub.rb:33
      (rdb:1) c
      Let's undub Grandia II!
      Converting tracks from raw to user mode...
      Dumping files from original GDI...
      Breakpoint 1, toplevel at undub.rb:33
      undub.rb:33: iso = ISO.new(stream, 45000 * 2048 + 0x8000)
      (rdb:1) stream.streams
      [#, #, #, #, #]
      (rdb:1) stream.length
      1124659200
      (rdb:1) stream.streams.each {|s|puts s.length}
      1241088
      90918912
      9975808
      1538048
      1020985344
      [#, #, #, #, #]
      (rdb:1)

      Delete
    3. [#< File:track01.bin>, #< StringIO:0x00000000499698>, #< File:track03.bin>, #< Strin
      gIO:0x000000004b1478>, #< File:track05.bin>]
      Added an space between < and what follows because otherwise it removes everything between a <> section

      Delete
    4. Okay, so it looks like all the data tracks are being loaded correctly (I don't load the audio tracks because they are not modified in any way), and track03.bin (which contains the ISO header that I need to modify) is being loaded to the correct offset. Are you absolutely, completely sure your GDI image did not get corrupted somehow? Have you tried using the patch on a new, freshly made copy of the original GDI image that you have never run the patching script on or modified in any way? Other than a corrupted GDI image, I don't have any idea what else could be wrong.

      Delete
    5. I have the gdi + bins + raws compressed in a single file, it's the original downloaded file that I did link you, so every time I'm doing the patching I extract your patch on a folder, emptied previously, I extract the image, I rename the the *.gdi file to GrandiaII.gdi and I launch the undub.rb... so I don't know... the 0.90 patch still works for me every time and, regarding the patch 0.91, looks like the error is now on another part of the patching process:
      Error: Cannot load an entry that isn't a directory.
      F:/isos clients/dc/dctemp/trans/iso9660.rb:111:in `load'
      ...

      Delete
    6. One last thing to try, but if this doesn't help, I really am stumped. Here is a copy of multiio.rb that prints a lot of additional debug information whenever the stream position is set:

      https://mega.co.nz/#!PtoC0ALb!ZK5e6LMn8NO93v3f5amm8LjfjDylDuYQgfVlAFOzlzE

      When you have time, could you please use this new multiio with the 0.91 patcher using the following command?:

      undub.rb > output.txt

      The patching script won't tell you when it's done because all the output will be routed to output.txt, so you'll have to open output.txt to check and see if it's reached the point where it crashes, and then you can close the command window. The text won't update while it's open though, so you'll have to close the file and reopen it every time you want to check it. But it shouldn't take longer than usual either way. Then you'll need to upload the contents of output.txt to pastie.org and post the link here, because I think the output will be too long for a comment. If the contents of output.txt are even slightly different than what they are on my computer, that should help me identify what the problem is.

      Delete
    7. the results:
      http://pastebin.com/ezisCf4i

      Delete
    8. This is just incredibly weird. The output you sent indicates that the MultiIO class was working correctly right up until the point of failure, so that couldn't be the problem. Okay, one more thing then, let's look at iso9660.rb.

      Here is a copy of iso9660.rb with some debug output enabled:

      https://mega.co.nz/#!T9gGzRpT!fLrsHSyjUxPyDdoIeU1xFLY_clWJeK6vBZFPIOdArOk

      And here is a copy of the new multiio.rb without the debug stuff since it seems to be working correctly and the extra output would just get in the way:

      https://mega.co.nz/#!D1oSxQiC!55RI354_mCOKs2t_Ek9rSUuJq2SMbB4zNHBWDlDNwEI

      Could you try this one more time with "undub.rb > output.txt" and pastie the results? I think this should finally reveal what's going wrong, although after repeatedly looking at the code, I still have no idea what it could be.

      Delete
    9. the results:
      http://pastebin.com/4keYCpF7

      Delete
    10. I accidentally pressed the wrong button and deleted the comment I wrote with an explanation what the problem was. >,< Well, long story short, the bug was caused by a recent change in how ruby handles multi-byte characters in strings. I would have found the problem sooner, but due to a little mistake on my part, I was actually testing with the wrong version of ruby without realizing it. Once I actually did run the script with ruby 2.0, I figured things out pretty quickly. And so here is a fixed iso9660.rb:

      https://mega.co.nz/#!C0A3HAYC!F4akQaW6T2_ifO4k1IUoRlxHFaPgtdWXIEMegg3ftEc

      Anyway, thanks for your help getting things figured out. Now I would have to deal with a mountain of complaints when the full 1.0 patch is released. ;) Which by the way, is still a thing that is going to happen, though I'm still not going to say when exactly. In the mean time please continue testing the game and report anything you can find.

      Delete
    11. Yeah now the patching works without problems.
      No problem, I am all for these undubing of projects.

      Delete
  8. Hey, it's been quite a long time since I last visited your blog.

    I don't know if you're still working on it, but looks like they will be releasing a HD version with japanese voices.

    ReplyDelete