Seeking audio engine for Compo project

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Seeking audio engine for Compo project
by on (#170259)
Hello!

I know this topic has been discussed at length from different angles, but as someone without experience on the audio side of NES programming, and without experience in NES composition, I'm hoping that I can find some simple answers to the questions I face in finding a sound engine that will work for my project and its composer.

From what I understand, the main options available are Famitone2, GGsound, and Pently. I'm curious about how these stack up in music options, CPU performance, and size in ROM of engine and songs. I'm also curious about licenses and whether or not I'm able to use these engines for my project. I don't know much about the various software licenses. I'm curious if the sound engine will comply with the licensing restrictions of the compo, and also, if the licensing would allow for a stand-alone copy to be sold. In an unrelated question, I'm curious if the licensing of the compo will allow me to make an extended version of my game later and sell it, but that's a question for a different thread.

The composer with whom I am speaking is used to writing in Famitracker, and I'd prefer to not have to ask him to change his techniques. Being able to convert from a file used by the composer is a plus. If there's a substantial increase in performance, or decrease in size from converting manually, then I could see that as a reason that it might be worthwhile, but it would be nice if I didn't have to do that. The main reason of using a pre-existing engine is so that I can have music in my game without having to start a new project of learning how to program sound for the system. Converting complex music by hand seems like it could become a Pandora's Box of time expense.

Allowing the composer to write with the techniques with which he is comfortable is highly important, but I understand that there will be trade-offs from what Famitracker engine can do, and what is feasible to run during gameplay. I expect there will be some limits. The size of the compo cart alone is a restriction on DPCM, so only short samples there. I hear that he may not be able to use the volume column and that he may be limited in the number of effects. If I knew what trade-offs each engine implements, I could present the choices to him and let him decide which would be best for his music.

I mentioned speed, and that's pretty important. With the game I'm making, I'm trying to be able to have as much going on on-screen as possible without slowdown. If one of the sound engines is considerably slower than the others, then I'd rule it out. If we're talking about a different of ~200 cycles though, I'd rule on other factors.

TL;DR: I'm looking for a brief description of the strengths/weaknesses of the various sound engine options to communicate to a Famitracker composer who does not have programming knowledge, and a brief description of their licenses so that I can rule out ones which are not an option for this project.
Re: Seeking audio engine for Compo project
by on (#170261)
Welp shameless plug time I guess! Memblers included GGSound in this benchmark thread: Benchmark Thread.

As for licensing, I'm about to add the "do what the fuck you want to" license to GGSound this evening, so sit tight :) *edit* I chose Unlicense instead.

I think it is of comparable performance to FamiTone2, perhaps a little slower? (eyeballing the CPU usage tint raster effect used in both demos) I've used it in a full 8 way scrolling game with 10 enemies , a main character and a familiar all going at once so I doubt it'd get in the way, that's for sure. (and this is even with the top 16 scanlines wasted by a manual cycle timed raster effect)

In all other ways it's nearly identical feature wise to FamiTone2, I believe, with two exceptions that I know of: GGSound makes creating and using sound effects dead easy, and, you can also use all 87 audible notes available in FamiTracker. FamiTone2 appears to have a restriction of about 64 notes or something (I *almost* switched to FamiTone2 so I wouldn't have to maintain GGSound, then realized I couldn't use it for the music and sound effects I was composing, due to errors from its converter concerning the note range), which as I've said elsewhere probably has a good reason like rom space.

GGSound does use more ROM space than FamiTone. Exactly how much more on average I'm not sure. But, was able to fit the soundtrack of a full game, along with GGSound itself, in a 16 kb bank, so again, I doubt that'd get in the way either.

So from my perspective, all software has trade-offs, you just have to figure out which trade offs serve you better. Ease of use and total freedom of all notes I could type in FamiTracker were my personal top priorities, and apparently that of a few other people who are using GGSound. However if you're doing a compo where data size is the main restriction, it may not be the best choice.
Re: Seeking audio engine for Compo project
by on (#170264)
I don't like the way Famitone handles sound effects. If the volume of the sound effect is less than the music, the sound effect won't play. Also, If the sound effect fades out, it will cut out as soon as music volume is louder, when I would prefer that the entire sound effect play, and it wait till a new note is triggered before allowing music on that channel.

How does GGsound handle sound effects on the same channel as music?

Also, I'm still waiting for tepples to chime in about Pently. What say you, eh, tepples? Free to use for games? How does it handle sound effects?
Re: Seeking audio engine for Compo project
by on (#170265)
dougeff wrote:
I don't like the way Famitone handles sound effects. If the volume of the sound effect is less than the music, the sound effect won't play. Also, If the sound effect fades out, it will cut out as soon as music volume is louder, when I would prefer that the entire sound effect play, and it wait till a new note is triggered before allowing music on that channel.

I think altering this behaviour is a one line change. Not much work to customize it away.
Re: Seeking audio engine for Compo project
by on (#170266)
Pently supports these features that other engines might not:
  • Decay phase: At the end of an envelope, volume can either hold steady or decay
  • Attack track: An additional virtual channel that inserts short staccato notes before another note; can substitute
  • Automatic triangle drums: A single drum hit can interrupt two channels at once, usually triangle and noise
  • Small data: On average, a note or rest takes less than 2 bytes
  • Short patterns: Patterns loop independently of the "frame", allowing drum patterns to be shorter
  • Pattern interruption: A pattern can be started or stopped on any row, allowing drum fills
  • Patterns can be shared between tracks
  • Transposition: A track can be played transposed up or down by an interval, which can be useful for ostinatos or for shared between square and triangle channels
  • Conductor notes: Notes can be inserted directly in the conductor track. This is usually used for crash cymbals, so that a cymbal doesn't require adding a second copy of your drum loop
  • Dynamic allocation for pulse sound effect channels: If a sound effect is playing on one pulse channel, a second is automatically routed to the other pulse channel
  • Sound effect priority: If a sound effect has less data than the effect currently being played on that channel, it isn't played
  • Sound effect to music priority: If a sound effect and a note are being played in any given frame, whatever is louder is heard (similar to FamiTone)
  • Reuse of instruments and patterns between songs
  • Provides beat state to allow synchronizing animations to music

There are some things that Pently currently doesn't support:
  • DPCM (use triangle drums)
  • Looped envelopes
  • Vibrato
  • Portamento
  • Volume column (bake it into your instruments)
  • Pitch envelopes (as opposed to arpeggio envelopes)
  • Automatic conversion from FamiTracker text export to its native format, which more closely resembles MML or LilyPond

Pently is under the MIT License, a permissive free software license. It does not restrict commercial use. It requires only a notice in the manual, and I'm willing to negotiate on the exact form of the notice if you use an unmodified version of Pently from Git.

But unfortunately, the lack of automatic conversion from FamiTracker plus your composer's apparent unwillingness to work in anything but FamiTracker disqualifies Pently. There's a fairly detailed request to make a converter, but I cannot fill that request in May 2016 because other things occupy my time. (Ex-cu-ses...)
Re: Seeking audio engine for Compo project
by on (#170268)
dougeff wrote:
I don't like the way Famitone handles sound effects. If the volume of the sound effect is less than the music, the sound effect won't play. Also, If the sound effect fades out, it will cut out as soon as music volume is louder, when I would prefer that the entire sound effect play, and it wait till a new note is triggered before allowing music on that channel.

How does GGsound handle sound effects on the same channel as music?


GGSound temporarily pauses the channel that the sound effect wants to use (a sound effect can use 2 channels simultaneously optionally) until the sfx is finished and the next note is played.
Re: Seeking audio engine for Compo project
by on (#170273)
Thank you for the responses! I'm going to send over these limitations to the composer and see if any of them pose significant restrictions on his writing. I sent over the "Limitations of ft_txt_to_asm.py" section of the GGsound readme earlier. That seemed to cover the parts that are relevant on his end.

It looks like Pently is considerably faster than the other options. It seems that a lot of it's features are also optimized to keep file size small. How does Pently's note range compare to GGsound?

tepples wrote:
But unfortunately, the lack of automatic conversion from FamiTracker plus your composer's apparent unwillingness to work in anything but FamiTracker disqualifies Pently.

I'm not certain if he's unable or unwilling to work in MML or Lilypond, I just want him to have his choice of writing method. He simply asked if he could still compose in Famitracker or another tracker, so I'll present the option to him and see if it's something with which he would feel comfortable.

Ideally, I'd like to try converting a piece of music either for the game or similar in style with any available engines and compare, but it seems like a song would have to be written in separate formats for the different engines. I'll pose these options to him and see what's on the table. Meanwhile I'm sure I can dig up some more notes on FamiTone2.

tepples wrote:
It requires only a notice in the manual, and I'm willing to negotiate on the exact form of the notice if you use an unmodified version of Pently from Git.

The license portion on your website mentions that it just needs to have the header for the engine in the source code, and that it would be preferred if Pently was credited in the game. I'd definitely mention the programmer of the sound engine by whatever name they wanted to use in the end credits, whether that was required or not. I'm not sure if listing individual credits in the manual is commonplace though. I'll look at some manuals and see.

I noticed the limitation of no DPCM though and this might be too much, unfortunately. I can see how it would be attractive for small games to not have this feature when it's often not needed, but I've been requested if we could have small kick and snare samples, and I think this would help for the style of music I'm hoping to have in my game. The speed and small size of Pently are attractive though and I'll keep it in mind for a project where I don't feel that DPCM is pretty important.
Re: Seeking audio engine for Compo project
by on (#170289)
darryl.revok wrote:
It looks like Pently is considerably faster than the other options. It seems that a lot of it's features are also optimized to keep file size small. How does Pently's note range compare to GGsound?

It's adjustable at assembly time by editing the Python program that creates the period lookup table. Common choices are 64 semitones or 80 semitones. As with all NES music engines, the highest octave is the least in tune.

Quote:
I noticed the limitation of no DPCM though and this might be too much, unfortunately. I can see how it would be attractive for small games to not have this feature when it's often not needed, but I've been requested if we could have small kick and snare samples

Tim Follin didn't need no stinkin' samples. His title theme from Solstice and level 1 from Silver Surfer were obviously not made with Pently, nor were other tunes by Neil Baldwin and Jeroen Tel. But Pently's drums were designed for that style of making drums with triangle and noise and no DPCM, as one can hear in the music of Thwaite and RHDE.

In addition, Pently's rhythm sync feature (if enabled) calls your callback on every row, letting you tack on your own music engine that just handles samples. I made my Famicompo Pico entry "Breaking the Law" with Pently for the instrumental tracks and a completely separate DPCM handler for the vocals.
Re: Seeking audio engine for Compo project
by on (#170306)
tepples wrote:
Tim Follin didn't need no stinkin' samples. His title theme from Solstice and level 1 from Silver Surfer were obviously not made with Pently, nor were other tunes by Neil Baldwin and Jeroen Tel. But Pently's drums were designed for that style of making drums with triangle and noise and no DPCM, as one can hear in the music of Thwaite and RHDE.

I didn't realize that Silver Surfer lvl 1 didn't have DPCM. That song has some really solid sounding kicks.

I'd say that the choice to use DPCM for the kick and snare on this project is more of a stylistic one. I told the composer that I would like to be light on DPCM samples due to cart size restriction, and he said that he'd like to use the DPCM channel for kick and snare to give it more of a Konami vibe, but he could work with triangle to give the drums more of a Capcom vibe.

Being able program an additional DPCM handler could circumvent this issue, but the composer did point another issue that he sees at a hurdle, and that's the lack of a vibrato effect. From the fact that he picked that out, I get the impression that he relies pretty heavy on having that as an effect, and not hard-coded to an instrument. Is there any flexibility on this?
Re: Seeking audio engine for Compo project
by on (#170349)
After consideration, I believe adding the features to Pently that I would need for this project at this time would be too much. Between now and the end of the year, I may have time to make custom changes to an audio engine and familiarize myself with the audio side of the NES, but at this time I'd like to be able to take a music file from the composer and input it into the game so I can focus on refining the gameplay.

I'm going to get a test FTM from my composer and compare the results with GGsound and FamiTone2.

I'm curious how the length and complexity of the songs will affect file size, especially in consideration of the 64KB limit. Have there been any benchmarks on file size for NES music?

Also, are there particular songwriting techniques that will minimize the file size? I imagine reusing patterns is a big way, but are there any techniques more obscure than that?
Re: Seeking audio engine for Compo project
by on (#170353)
Quote:
are there particular songwriting techniques that will minimize the file size?


I disagree with your premise.

As an occasional song-writer, the last thing you need is to be told is to worry about song length and make sure it has a ton of repeated patterns, etc. He / she will get better results if you focus on writing good songs that blend well with your game without being distracting.
Re: Seeking audio engine for Compo project
by on (#170354)
dougeff wrote:
As an occasional song-writer, the last thing you need is to be told is to worry about song length and make sure it has a ton of repeated patterns, etc.


Do you think there are considerations which may not hurt songwriting and have more to do with the file is structured?

Like, mapping all of the DPCM samples to different notes of one instrument. This is something I'll have to do for GGsound compatibility anyway, but I can imagine this might save space versus having multiple instruments.

I thought maybe there might be some esoteric tricks that may not affect composition as much as the output file. I don't want to ask him to make a bunch of loops, but that's the example which seems obvious.
Re: Seeking audio engine for Compo project
by on (#170355)
Give your composer a tool that can export and tell them what the resulting size is. Tell them what their size budget is, and it's their job to manage it.

There's lots of advice you could give for keeping the file size small, but nothing better than giving them the ability to measure it themselves.

Writing music that is both small and interesting is a challenge.
Re: Seeking audio engine for Compo project
by on (#170367)
I mean that, even SMB1 waa able to fit 6+ songs into an NROM space. And which one is my least favorite... the "time is running out" Castle song, which is a 5 second loop. I think I made my point.

The end theme is about a 7 second loop. Not nearly as bad.
Re: Seeking audio engine for Compo project
by on (#170371)
dougeff wrote:
The end theme is about a 7 second loop. Not nearly as bad.

You know, the first time I finally beat the game, I was pretty damn disappointed with the ending song. It's easy now but it was HARD as a kid, and I remember distinctly thinking, "THIS is the song I get for all that work?" Yeah, it's early, and the cart was packed, so I don't hold it against the game. It's not a Takeshi's Challenge ending.

I don't think I'll have the SAME song length problem. My composer generally writes full-length songs with a pretty high note density, and admittedly they're for Compos and not games, but still, I could give him 32KB for music and he'd still have to make sacrifices compared to what he's used to. He might have to make "game-length" and "full-length" versions. Really, I don't know, and I want to give as much of the power of choice in the matter to him as possible. I just want to give him the tools to balance as much as he can without inundating him.
Re: Seeking audio engine for Compo project
by on (#170380)
Kulor's great soundtrack for Alter Ego is a good point of comparison. I think he said shiru gave him a budget of 8k for the music data (not including Famitone, which I think is about another 1k), and he really used that space well: http://famitracker.com/forum/posts.php?id=2761

I think each of the main songs uses about 1k of data, to give you an idea of what you can do with space, if you're careful. (Also note how Kulor didn't even have the volume column or effects to work with.)