Demoscene

to_the_beat

to_the_beat

to_the_beat

to_the_beat

to_the_beat

to_the_beat is a made-in-a-hurry 64k intro. Graphic wise it's very poor (the screenshots are slightly misleading); the only interesting part is the sound system which is basically a proof of concept at the moment. But if you want to have a look it's all there. If you learn something from this, it's worth the look :-)

I have started working on the next version of the synth, so here's the code for v0.1 (the one used in the intro) and an explanation of its little juicy secrets for you.

A bit of background

I had spent some months slowly building a little software synth. Then, euskal party was coming close and I decided I would make a intro for the 64k compo. Funnily, the day before flying to Spain I just noticed that the intro which worked great on my desktop (a recently assembled intel quad core beast) was not working very well on my laptop (a recently declared vintage powerbook G4).

So I tried to do my best during that night to optimize the code. Heck, I even looked at Altivec vectorial instructions! But...

a) I didn't have time to get to grips with the altivec extension in just few hours before departing for the airport

b) my purpose is not, and will probably never be, to write G4 specific software.

At the end I just abandoned the idea of intro I was working on, and decided to write a very simple one instead which wouldn't kill my poor laptops processor. This was programmed in its entirety in a couple of evenings in the hotel (for avoiding the noise at the party) and it clearly shows. Furthermore, the song has only two channels and features only two instruments (that try to resemble a bass drum and open hi hat respectively), but I love to watch my stuff in the big screen - it's my vanity dose! :-)

Introducing sorollet

As I said some lines before, the only interesting part in this intro is the software synth. I had secretly been toying with the idea of writing one for probably years but only had some time to start it past year. The name of the synth is Sorollet - which if you know any Catalan will probably sound funny. It means "little noise" and that's exactly what my little synth likes to do, a little bit of noise.

Internally we could say it has a fixed pipeline, if that can be applied to music pipelines. There are two oscillators and you can adjust several parameters on them like the oscillators mix, the wave form (triangular, sinus, that stuff), amplification, etc. Then both get mixed and you can specify whether there should be any noise and its amount, adjust the ADSR envelopes for pitch, volume or filter, and also things like a bass boost or EQ. Also, it is monophonic, but you can have as many instances of synths as your processor permits. (I think this style of building synths is called additive synthesis, but I might be proved wrong).

The routing is not modular at all. To simplify things in this first version, I assumed that one instrument equals one synth using a track in the song. So if you wanted to have chords, you will need to create at least three synths with the same properties (so they sounded the same!).

The final mix is produced by recollecting the sound produced by each channel and accumulating it into the mix buffer. No volume adjustments of any kind are performed on the output, so if it saturates, it saturates and clips like there's no tomorrow ;-)

Since the intro song doesn't make any justice to the mighty powers of sorollet, here's a sample song: supersole - bk ++.

Frequently asked questions

I'll place here questions that pop over when speaking to people about this project :-)

Did you make any GUI for editing the songs?

No, I did not. I used Schism tracker for composing the songs, using samples which kind of sounded like what I wanted the song to sound. Then I used a little utility I programmed which extracts the pattern data from the .IT file and generates the song.h file which is later on included into the executable.

Why on the name of Steve Jobs and the immaculate Apple are you using SDL when Apple has its own system calls to open and manage windows and to open and manage audio channels?

Because my time is very valuable and I don't want to spend one month looking for information at apple's developer centre for something that will only work on Mac computers. If you really want the intro to work without SDL, you can either do it yourself or hire my mac coding skillz for a considerable amount of money.

Why did you use C instead of C++?

To test if it was feasible. It was years without programming any plain C program and I wondered whether everything could be done with C only. I had also read the OO C is passable article and that completely convinced me to try and see what could I do.

Can I have the utility that converts from IT to song.h? It's not in the repository!

Not right now, it uses a php class that I still don't want to release. Maybe in the future...

Getting the source code

  • Browse the online code at github
  • Clone my demoscene repository with git: bash git clone git://github.com/sole/demoscene.git . Then, it's in the releases/xplsv/to_the_beat directory

Here's a compiled version for mac powerpc (it is optimized for G4 computers as you can see in the Makefile). That's exactly the party version and it sounds slightly different but I can't quite isolate what made that difference. And I haven't looked too much in detail since the party, actually ;-), other than cleaning up redundant code and applying the performance fixes that iq suggested me...

Thanks

There's a ton of people which helped me in the process of doing this and I MUST thank them :-)

In no particular order:

  • Slack and his tutorials were possibly the best starting point one can have
  • Then the musicdsp archive is very good as well for things like snippets of code for concrete problems like EQ, bass boosting, filters, etc
  • Iq for all the help with the party windows port and general advice regarding optimisations. Unfortunately the port had a very broke sound for some strange reason (probably something to do with floats and random numbers), and it also produced an error when exiting, so I haven't distributed it. If you really want it, well, ask for it.
  • And trace for all the support, of course :-)