Let's Code for the Uzebox?

What is a Uzebox? How can I get one? Check here!
User avatar
L4rry
Posts: 242
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: Let's Code for the Uzebox?

Post by L4rry »

Artcfox wrote: Wed Nov 22, 2017 4:21 pm I think it would be awesome if it were possible to trigger PCM patches in addition to noise patches in this way, but currently I don't believe it is possible. If the sound engine supports this in the future then it would be really easy to trigger PCM samples in exactly the right places in songs.
I can't agree more! Busy doing this Udemy music course and the chiptune class they present has 3 wave channels and a PCM channel all in the same mix. Castlevania 2 is used as a reference. PCM beats make a massive difference.

Have a listen: Castlevanida 2 - Bloody Tears
User avatar
ry755
Posts: 226
Joined: Mon May 22, 2017 6:01 am

Re: Let's Code for the Uzebox?

Post by ry755 »

Artcfox wrote: Wed Nov 22, 2017 12:28 am I just completed a video tutorial demonstrating how to (starting from scratch with nothing installed) compose a multi-track, multi-instrument MIDI file with a percussion track using Rosegarden on Linux, and then how to convert and integrate that into a Uzebox project.
Nice video! It'll come in handy when I get around to adding music to my WIP game.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Let's Code for the Uzebox?

Post by Artcfox »

Jubatian wrote: Wed Nov 22, 2017 8:09 pm Huh, nice to know about this!

At least for me Rosegarden was something new here, and I see it would be very useful to me as I can better conceive music with the visual matrix. I struggled with Modplug Tracker to realize the ingame music of Flight of a Dragon (maybe the second time I used a tracker in my life), and I found it still very difficult to tie the commands and their spacing in the pattern with what I hear. Hopefully with this knowledge I will be able to make something better for the final game (otherwise FoaD is not midi, it uses a special compressed format which I enter manually in hexa, the ingame music is about 300 bytes).

But of course it is nice to have this all working! By the way wouldn't it be possible to remove unnecessary stuff during conversion? (you mention it is better to join the segments in Rosegarden before export to get a smaller result in Uzebox, while as far as I perceive the split shouldn't contribute to anything audible)
I'm glad you found it helpful. I'm sure it is possible to strip the unnecessary stuff out in the conversion process, and I believe that is exactly what Lee did with his even-more-compressed MIDI processor that can stream from SD, SPI RAM or PROGMEM. It can strip all control commands out. It is also possible that the newest version of Rosegarden does this automatically, because in the simple test I did with just two segments per track, it wasn't any larger when I joined them, but in older versions that was the case.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Let's Code for the Uzebox?

Post by Artcfox »

L4rry wrote: Wed Nov 22, 2017 9:36 pm Thanks man. That actually clears up a lot of uncertainty for me. So it seems it's best practice to have your melody/lead and bass (or midi sound founts) in the first three patch array positions, your percussion (noise) instruments in the next few and your sound effects then following that in any order.
No problem. Yep, that is how I've done it in my games!
L4rry wrote: Wed Nov 22, 2017 9:36 pmI now know why I had so much trouble getting any kinda percussion working for the Cyaron's Gate port in Iros! I can't help wandering if it would be worth separating midi sound fonts (first three wave channel patches), percussion (noise patches) and general sound effects into three separate arrays just for readability. Thanks for the tutorial vids. It really is insightful :) Keep it up!
I think that would take up valuable RAM rather than just putting them all in the same array. The PCM patches also go in that array. You can look at the patches.inc file for Laser Puzzle II to see how I did the PCM data.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Let's Code for the Uzebox?

Post by Artcfox »

L4rry wrote: Thu Nov 23, 2017 1:09 am
Artcfox wrote: Wed Nov 22, 2017 4:21 pm I think it would be awesome if it were possible to trigger PCM patches in addition to noise patches in this way, but currently I don't believe it is possible. If the sound engine supports this in the future then it would be really easy to trigger PCM samples in exactly the right places in songs.
I can't agree more! Busy doing this Udemy music course and the chiptune class they present has 3 wave channels and a PCM channel all in the same mix. Castlevania 2 is used as a reference. PCM beats make a massive difference.

Have a listen: Castlevanida 2 - Bloody Tears
Very cool! I was thinking more for sound samples that aren't necessarily percussion, like the "Play!" vocal in Tornado 2000, even though that used the secret (possibly unfinished) MOD player in the Uzebox kernel, not the MIDI player.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Let's Code for the Uzebox?

Post by Artcfox »

ry755 wrote: Thu Nov 23, 2017 4:26 am Nice video! It'll come in handy when I get around to adding music to my WIP game.
Thank you! I'm not too sure how to compose (as in write) my own melodies from scratch, so that is the tricky part for me, but I'm assuming the tools and Uzebox-specific workflow might be the tricky part for somebody else. I'm hoping that someone who knows more music theory than I do can take the tool knowledge I share and come up with some really great Uzebox-original soundtracks.

Especially with the new code that Lee wrote to stream compressed MIDI from the SD card. In that case, space shouldn't be a real concern so all of the note off commands can be included, and the songs can be longer and more complicated.
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Let's Code for the Uzebox?

Post by Jubatian »

I vaguely remembered Rosegarden, and now I tried it on my system. However I realized why I wasn't using it: I couldn't ever get it to produce sound. Even now if I start a Timidity server (I even have one configured by default for various games needing it such as through DOSBox), when I start Rosegarden, Timidity becomes unable to output anything. The most ridiculous part is that when I actually play some midi, either by aplaymidi using a running server or directly using Timidity, when I start Rosegarden, the playback shuts off, and only resumes when I shut Rosegarden down. This is very much unlike anything I ever experienced (I knew about the nightmares around OSS, but then something would just consistently not get access to the audio device, I never experienced something "stealing" it).
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Let's Code for the Uzebox?

Post by Artcfox »

Jubatian wrote: Fri Nov 24, 2017 11:10 pm I vaguely remembered Rosegarden, and now I tried it on my system. However I realized why I wasn't using it: I couldn't ever get it to produce sound. Even now if I start a Timidity server (I even have one configured by default for various games needing it such as through DOSBox), when I start Rosegarden, Timidity becomes unable to output anything. The most ridiculous part is that when I actually play some midi, either by aplaymidi using a running server or directly using Timidity, when I start Rosegarden, the playback shuts off, and only resumes when I shut Rosegarden down. This is very much unlike anything I ever experienced (I knew about the nightmares around OSS, but then something would just consistently not get access to the audio device, I never experienced something "stealing" it).
What console messages are you getting? Before I discovered Timidity, I used Rosegarden with no sound output to compose, and then exported it to a midi, then converted the midi to a wave in order to hear it.

Have you tried using JACK? I came across this article about setting Rosegarden up with JACK, but haven't gotten the chance to try it yet.
User avatar
Jubatian
Posts: 1563
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Let's Code for the Uzebox?

Post by Jubatian »

I currently resolved it with the following shell script:

Code: Select all

#!/bin/sh
jack_control ds alsa
jack_control start
timidity -iA -Oj &
rosegarden
killall -u $USER timidity
jack_control stop
Seems like my setup tried everything to stop me from getting sound. Jack for some reason starts with outputting to a dummy driver by default, so even figuring it out to start Timidity outputting to the Jack server still gets nothing audible. This way it works, at least Rosegarden starts, and there is a midi device which can be selected (the new Timidity server instance) to get sound (that one running by default is still there though with no sound, and that's selected by default). The whole thing pukes errors all over the console all the time and could fall down with a segfault, but at least until then there is sound (and it doesn't bring down Rosegarden with itself, so not a very big deal).
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Let's Code for the Uzebox?

Post by Artcfox »

Jubatian wrote: Sat Nov 25, 2017 10:14 am I currently resolved it with the following shell script:

Code: Select all

#!/bin/sh
jack_control ds alsa
jack_control start
timidity -iA -Oj &
rosegarden
killall -u $USER timidity
jack_control stop
Seems like my setup tried everything to stop me from getting sound. Jack for some reason starts with outputting to a dummy driver by default, so even figuring it out to start Timidity outputting to the Jack server still gets nothing audible. This way it works, at least Rosegarden starts, and there is a midi device which can be selected (the new Timidity server instance) to get sound (that one running by default is still there though with no sound, and that's selected by default). The whole thing pukes errors all over the console all the time and could fall down with a segfault, but at least until then there is sound (and it doesn't bring down Rosegarden with itself, so not a very big deal).
I can't get those commands to work for me, but I'm glad you finally got some sound output. I wonder if this will work for other people who can't get sound out of timidity?
Post Reply