New creation : Music Demo - by eriban

Music demo

I have been working on extending the Gamebuino library with more advanced music capabilities. This demo shows the results. It’s only 151 kB in size but generates more than 22 minutes of music.

Note: Sound is not (yet?) supported in the emulator. So you really need to download and install the program on your Gamebuino to hear the result.

Controls

  • Play/Pause: A
  • Stop: B
  • Previous: Left
  • Next: Right
  • Toggle Repeat: Up
  • Toggle CPU load display: Down

Music generation

The new music functionality is very similar to that supported by the PICO-8 fantasy console. More specifically:

  • The basic element is a NOTE, which has a wave form, a frequency, a volume and optionally an effect
  • Eight wave forms: TRIANGLE, TILTED_SAW, SAW, SQUARE, PULSE, ORGAN, PHASER and NOISE
  • Seven effects: FADE_IN, FADE_OUT, DROP, SLIDE, VIBRATO, ARPEGGIO and ARPEGGIO_FAST
  • Layered composition: Multiple NOTES comprise a TUNE, multiple TUNES played in parallel comprise a PATTERN, multiple PATTERNS comprise a SONG

This enables very space-efficient music generation. Including the music in this demo as WAV files would require 30 MB of space.

Dynamically generating the music does require a bit of CPU. The CPU goes up with the number of channels that is used. Furthermore, the PHASER and NOISE instruments require more CPU than the other instruments. The ARPEGGIO and VIBRATO effects also increase CPU usage. Nevertheless, CPU usage of this demo never exceeds 75%, even for the four-track songs, so there are still spare cycles that can be used to implement a game. :slight_smile:

Credits

  • “Alex Kidd” songs by Domarius from PICO-8 game Alex Kidd
  • “Bubble Bobble” songs by pahammond from PICO-8 game Bubble Bobble
  • “Bumble Bots” songs by Paul Bonsma from PICO-8 game Bumble Bots
  • “Neon” song by Luca Harris from PICO-8 demo Neon
  • “Porklike” song by Krystian Majewski from PICO-8 game Porklike
  • “Rock for Metal” song by Jumalauta from PICO-8 demo Rock for Metal
  • “Sweet Buns” songs by Krystian Majewski from PICO-8 game Sweet Buns
  • “Techno Utopian Edict” song by Jumalauta from PICO-8 demo Techno Utopian Edict
  • “The Lair” songs by Gruber Music from PICO-8 game The Lair
  • “Wintergolf” songs by Gruber Music from PICO-8 game Wintergolf

Version 1.0

New player UI:

  • Controls for Play/Pause, Stop, Previous, Next and Repeat
  • Show output level
  • Toggle CPU load visualisation

More music:

  • Now featuring 17 songs
  • by 7 artists
  • comprising more than 22 minutes of music

Note: Some tracks are designed to loop endlessly and end somewhat abruptly if they are not on repeat.

Improved music generation:

  • Add PHASER instrument
  • Improve note blending
  • Improved NOISE
  • Fixed ARPEGGIO implementation
  • Add optional volume boosting

Version 0.2

Demonstrates improvements to music generation:

  • Reduced CPU usage for NOISE instrument
  • Fix bug in SongGenerator that caused occasional glitches
  • Reduced memory footprint and program size
  • Reduced CPU usage by switching to 11025 Hz
  • Increased accuracy of volume and wave index calculations
  • Let octaves start with C note, as is the convention

    See more
3 Likes