handmade.network » Forums » Work-in-Progress » A Dear ImGui music tracker
immortalx
John
20 posts
#21251 A Dear ImGui music tracker
1 month, 1 week ago Edited by John on July 11, 2019, 4:10 a.m. Reason: Initial post

Hi everyone.

This is my first C++ project, which I've been working on for about a month now.

It's an attempt on making a very simple music tracker (or mod tracker if you will), or rather an experiment that'll help me get into the C/C++ world.
I'm not entirely new to programming, as I've used some VB6 in my youth and more recently GML. I finally overcame my fear of learning a more "proper" language, after my son encouraged me to watch together the Handmade Hero series.
I instantly became a fan, and although I stay into the comfort zone of using external libraries (like Dear ImGui and FMOD for this project), I'm slowly discovering memory manipulation, pointers, and all the lower level stuff.

As it stands, this tracker can create patterns/instruments, load samples, edit sample maps, and play-back the result. There's no saving/loading yet but I'm planning on doing a simple file format, as well as a wav export.

As soon as I have something a bit more usable I'll upload a working version here. For the time being here's a screenshot:
mrmixer
Simon Anciaux
651 posts
#21257 A Dear ImGui music tracker
1 month, 1 week ago

I don't know much about music making, but this look nice for your first C++ project. You should put a recording (recorded with another application) in the post so we could ear how it sounds.
immortalx
John
20 posts
#21261 A Dear ImGui music tracker
1 month, 1 week ago

Thank you very much Simon!
I'll definitely do a video capture, although my music creation skills are awful, despite having used trackers since the Amiga era :D

I also have to mention that playback is currently limited to playing "raw" notes, meaning that there's no implementation of effect commands, and volume/panning/mute/solo changes are only respected when a new note is triggered.
OliverMarsh
Oliver Marsh
134 posts / 3 projects

A budding game developer and programmer

#21263 A Dear ImGui music tracker
1 month, 1 week ago

Congratulations on your first project, looks very cool! Cool hearing you watch handmade hero with your son.
immortalx
John
20 posts
#21267 A Dear ImGui music tracker
1 month, 1 week ago

Thanks Oliver, yeah watching with my son is priceless!
immortalx
John
20 posts
#21269 A Dear ImGui music tracker
1 month ago

As per Simon's advice here's a capture of the program demonstrating my lack of music skills :D
mrmixer
Simon Anciaux
651 posts
#21277 A Dear ImGui music tracker
1 month ago

How much time did it take to make only the audio part (without the UI) ? I've been thinking about making something like that to easily add music/sounds in small games I make.
immortalx
John
20 posts
#21279 A Dear ImGui music tracker
1 month ago

Hi Simon!
I'm using the FMOD Core API which makes it very easy to load, play and set properties of sounds. My understanding is that it's higher level (but not under-powered) compared to other known libraries (PortAudio, RtAudio, OpenAL, etc) which makes it a perfect candidate for game audio programming.
So I'd say making the basic parts of the audio took very little time. And most of that time was me as a newbie trying to understand and handle pointers, which is what FMOD mostly gives you to work with.
mrmixer
Simon Anciaux
651 posts
#21282 A Dear ImGui music tracker
1 month ago

You mean you play audio samples for each notes ? You don't generate the sounds using a software oscillator ? For example generating a sine wave at 440hz to create a "La" (A) ?
immortalx
John
20 posts
#21284 A Dear ImGui music tracker
1 month ago

Indeed, every note is a loaded sample played at a different frequency. You can, of course, generate and play a sine wave if you wish. Most trackers though are sample-based and are in fact a form of a step sequencer.
immortalx
John
20 posts
#21385 A Dear ImGui music tracker
1 week, 6 days ago

Here's a somewhat working version of it. Pause, repeat and many other stuff still not implemented, and of course tons of bugs. I've also made a crude file format which allows you to save/load songs. Note that no samples are saved within the binary, and it uses absolute file paths for the samples. That means that if you move/delete/rename a sample on the HDD the program is going to shamefully crash!

uTracker v0.1
mrmixer
Simon Anciaux
651 posts
#21398 A Dear ImGui music tracker
1 week, 5 days ago

It's working for me on Windows 7. It took some time to figure out that I needed to configure an instrument with a sample (I never used a tracker so maybe it's expected). Maybe you should provide a basic sample (exporting a simple sine wave, or generating one on the fly) and have a default instrument configured, so that the tracker works out of the box ?
immortalx
John
20 posts
#21402 A Dear ImGui music tracker
1 week, 4 days ago

Simon, thank you very much for giving it a try! I haven't tested it on any other pc, other than mine, so it's nice to hear it works on Windows 7 too.
You're right, it's not obvious that an instrument needs at the minimum one sample. Although this is well known to someone who has used a tracker before, I should be making a short usage guide and provide some basic samples as you suggested.