[WIP] FMStudio

Few comments on the latest version:

  • Often the start of the song played in the editor is unaudible because there is a fade-in at start
  • As the instrument affects to the pattern window the instrument field could be near that window
  • If I change the instrument in the pattern window it does not affect to the previously added pattern in the song window. Maybe that is the intention, thought.
  • I like how you can put pattern playing in the loop and try different instruments :slight_smile:
  • I saved the song but pressing the save button again caused this error:
    image

Here is my test song. Warning! It can break your ears :wink: Please put the volume down!

2 Likes

Ah, yes. I hadn’t discovered this bug until after I published the release package. Already have it fixed and will be pushing v0.2.1 once I implement some of the other feature suggestions.

I haven’t quite figured out what’s causing this, but I’ve noticed that sometimes the previously played pattern/song (when stopped midway) will continue playing when you play a song/pattern again. Trouble is it doesn’t always happen and I haven’t been able to reproduce it reliably enough to figure out what’s causing it (I’ve tried clearing all the audio buffers when stopping, next I’ll try clearing them again just before playing to ensure they are empty).

I think that makes more sense placing the instrument selection down in the pattern editor portion.

This is intentional as patterns are not tied to specific instruments, rather the song sections indicate to play a given pattern using a given instrument. This allows one pattern to be played using multiple instruments without having to create separate patterns for the same set of notes. To change the instrument for a specific section in the song editor select the desired instrument and then double-click the section (documentation/tutorial will help when everything is more feature complete).

Yes I was really wanting to make sure that was possible. Also you can edit the notes within a pattern while it’s looping. When dragging a note around it will not be heard until placed (releasing the mouse button). Also newly placed/moved notes won’t be heard until the pattern plays again (this is because a copy of the list is sent to the player when a pattern starts playing). While it is possible to set it up so it can play the changes immediately it would take a bit of effort to set everything up, so it may end up being added in a future update but not 100% certain yet.

Since the saving bug is a major breaking bug I’m going to move the instrument drop-down to the pattern area and then publish v0.2.1 so that it is functional again while I work on the next major features (keyboard/midi input and exporting to C Header to be played on HW).

EDIT: I’m also going to add a feature where a pattern remembers the last instrument it was “played” with (either the user plays that pattern or adds a section to the song with that pattern and the selected instrument). Then when selecting a pattern it will automatically switch the instrument to the last instrument the pattern was played with (if no instrument saved then it will simply not change the selected instrument rather then setting it to the first instrument). Eventually there might be a general settings screen for personal preferences like this and maybe default project settings (overlap policy, instruments loaded, etc).

3 Likes

New release (v0.2.1) is out fixing the bug preventing you from saving projects.
Also moved the instrument drop-down to the pattern area since it’s more useful there.
Patterns now remember the last instrument used for that pattern (by pressing Play or adding the pattern to the song).

NOTE: Patterns are not tied to specific instruments. You can add a pattern to the song multiple times each using a different instrument to play the same notes.

Updated the links in the top post.
Can’t wait to hear what more people are able to create with this.

2 Likes

Still a bit of cleanup to do before releasing the next version but here’s a demo of the FMPlayer working on HW.

When a song has nothing placed in any channel then each pattern gets exported independently as a sound effect.

I’ve made an FMStudioSource.h file that provides an FMPatternSource and FMSongSource. The sound effects are played on a separate channel as the songs as you might expect.

The way I have it setup now gives a basic setup of:

#include "songs.h" //generated from FMStudio and can be named anything you want

Audio::FMSongSource *fmSong = nullptr;
Audio::FMPatternSource *fmSFX = nullptr;

...
fmSong = &Audio::FMSongSource::play<0>(FMStudio::songs[currentSong], FMStudio::instruments);
...
fmSFX = &Audio::FMPatternSource::play<1>(FMStudio::sfx[currentSFX], FMStudio::instruments);

With the way the song player works though even things like what I did with Prelude to a Dream’s music is possible (when entering a battle I pause the main music and play the battle music, then resume the main music where it left off after the battle).

Audio::FMSongSource *fmSong1 = nullptr;
Audio::FMSongSource *fmSong2 = nullptr;
Audio::FMPatternSource *fmSFX = nullptr;

//Play main music
if (fmSong2 != nullptr && fmSong2->isPlaying())
  fmSong2->pause();
fmSong1 = ...

//Play battle music
if (fmSong1 != nullptr && fmSong1->isPlaying())
  fmSong1->pause();
fmSong2 = ...

//NOTE: Only one song can be playing at once and the
//      FMSongSource should use the next lowest channel
//      number. The song source simply copies its
//      generated audio data straight to the audio buffer
//      instead of trying to mix it with existing audio data as it's meant to be the primary audio.

Here’s the bin file for my WIP FMPlayer demo (controls displayed on screen):
FMPlayer.bin (65.9 KB)

Once I get everything cleaned up I’ll post the next update that will allow playing the raw notes on HW.

3 Likes

Works well on HW.
The volume level is quite high. A minor bug in the ui texts: for both songs and sfxes it is told to use up/down keys.