It is currently Tue Nov 21, 2017 7:06 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Jul 12, 2017 12:51 pm 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1017
Location: Gothenburg, Sweden
Background:
In FamiTracker (and other engines), the default mode of notes is legatissimo (as legato as possible, that is, the notes are glued together as one). This is technically straightforward, but musically not always desired. Then, normally, we make an accent at the beginning of a volume envelope of an instrument to distinguish the notes by some. This would, in music theory, make them simply Legato, since they're still bound together. Then, by dropping the volume to 0, you can get both staccatissimo and staccato. But there's a middle ground that's left out the way FamiTracker works: Notes that indefinitely sustain themselves but still are distinct from the next.

I've done the following for long* with Bass notes:
Volume Envelope MML: [0 1] or [0 anything]. This put the notes one sample behind the other instruments, but it works well to make the sound distinguishable, plus, the tone of an electric finger bass comes a little behind too, if you examine a waveform closely. This is just omitting the atonal attack.

But what about if we want to easily shift between playing with or without with legato - without resorting to staccati or notes fading at a predetermined length)?

Then it struck me:

1) Treat EVERY instrument as the bass. Add 0 to the beginning of EVERY volume envelope of EVERY instrument. Since litteraly everything is delayed one sample, it isn't percieved as a delay at all. If you're using other envelopes than volume, you should add a dummy sample at the beginning to those aswell.

2) Then, for the instruments you want to control legato on, clone those instruments. Add a new volume envelope. Copy and Paste the mml string; remove the zero. Again, if you use more envelopes, you might want to clone those envelopes aswell, depending on how pedantic you are with the sound.

3) Switch instruments between non-legato and legato as you please.

Small caveat: Legato notes will be one sample ahead. If you find it stands out too much, see below.
Remedy: use the Gxx effect to delay it a frame. Legato will still hold.

Example file playing a winners' fanfare, with and without legato. First, nonlegato is played. Then, the default legato:
Attachment:
fanfare_nonlegato_legato.ftm [2.01 KiB]
Downloaded 45 times


Notes:
*Well, i've only used famitracker for half a year or something.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Wed Jul 12, 2017 1:15 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5825
Location: Canada
Yep, that's a fairly common technique. Most of Super Mario Bros. instruments start with 1 frame of volume 0, for example.


By the way, did you know that Famitracker has a forum?
http://forums.famitracker.com/index.php

Not that the stuff you've been posting isn't relevant here, but there's a whole lot of people there that discuss these kinds of things more regularly than at this forum where relatively few people are interested in making music. You might pick up a lot of good ideas from people there. (Though I must confess I am no longer a regular poster there.)

Similar motivation led me to create the NSF Import tool for studying NSFs withing Famitracker.


Top
 Profile  
 
PostPosted: Wed Jul 12, 2017 2:37 pm 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 543
Hi. :)

Not that I am in any way discouraging you from sharing your FTM or 0CC files here... You may wish to be a part of the FamiTracker community and forums; also on the FamiTracker Discord server. People share and discuss their methods regularly in those areas.

Secondly, effectively FamiTracker has been superseded by 0CC-FamiTracker. 0CC files are not compatible with FamiTracker; as they have additional driver modifications that the community has supported.

NESdev community members DO use FamiTracker, but they would not necessarily be on the cutting-edge of tracker techniques or musical discussion of the platform. Another community I would suggest is Battleofthebits if you wish to be a part of a graphical art, coding, and musical production community based on competition and education. (Please use your favorite search engine to discover relevant references. ;))


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 2:18 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7272
Location: Chexbres, VD, Switzerland
FrankenGraphics wrote:
1) Treat EVERY instrument as the bass. Add 0 to the beginning of EVERY volume envelope of EVERY instrument. Since litteraly everything is delayed one sample, it isn't percieved as a delay at all. If you're using other envelopes than volume, you should add a dummy sample at the beginning to those aswell.

2) Then, for the instruments you want to control legato on, clone those instruments. Add a new volume envelope. Copy and Paste the mml string; remove the zero. Again, if you use more envelopes, you might want to clone those envelopes aswell, depending on how pedantic you are with the sound.

3) Switch instruments between non-legato and legato as you please.

To be honnest this sounds more like a hack. A good sound engine (like the ones I code) do this by default - always start notes with a silent frame (and implicitely delaying everything one frame). Legato should be enablable and disableable explicitely without making different volume envelopes - also when legao is enabled the volume enveloppe should not restart (for example if there is an attack it should only be heard after silents but not if there is several consecutive notes). On systems where samples are supported, the samples should not restart but continue to loop/play and only change frequency.

This is basic sound engine stuff. Famitracker is obviously limited.


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 2:25 am 
Offline
User avatar

Joined: Fri Jan 24, 2014 9:05 am
Posts: 138
Location: Hungary
I've always tried to address this from both directions: My engines can either have a length counter-like timer in software to stop the sound, or a "stop the sound when less than X frames of duration are left for this note". It makes things as opened up as I need them to be.


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 3:07 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1017
Location: Gothenburg, Sweden
I was hoping this would incite a discussion on engine design/programming. :) With the two applications you described, file size can be kept a bit smaller; especially if you use lots of instruments.

re: bregalad, on envelope trig/notrig: That very much depends on what (physical world) instrument you're playing (or mimicking). A piano will always have an accent*, regardless legato/legatissimo. As will classical/spanish guitar. Taps have (different) accents, slides are simply glissandi.

In analogue synth talk/practice, the mode you're describing is pretty standard, but it is likely due to a historic compromise where cost effectiveness has trumped user-oriented design. The method has since then become a culture in itself. I often find it cumbersome and mildly annoying when playing synths that got this particular legato setup hardwired. It's an arbitrary limitation and prone to false trigs/nontrigs. Another reason to abandon prepackaged synths and go modular: full interface control :roll: One thing that's almost always better is to have legati notes trig a different envelope (and derive the max of both), rather than none at all. Or for a piano-like interaction, just trig the same.

re: bregalad, regarding the rest: Despite FT not supporting nonlegato/legato directly/out of the box, it's rather flexible as far as 2A0x goes. It seems N163 is a bit arbitrarily limited for the sake of a non-technical user interface.

Another thing to consider: you may want your pauses wider than one sample: In that case, you could have:
[0 0 x ] = non legato, with very strong note separation
[ 0 x ] = non legato, but close
[x] = legato

add delay effects to compensate accordingly.

It can definitely be labelled a hack/trick, but a very functional one in any engine not featuring legato/nonlegato switching of some sort.

Re: rainwarrior, b00daw: Thanks for your suggestions! I'm a registrerad user at the FT forums but have remained an irregular lurker, mostly, besides posting a few ftm files, so i haven't really taken a swim there yet.

I suspected the trick was about as old as the NES itself, but it felt like a revelation when the penny dropped. :P I was hoping a quick tutorial might benefit homebrewers who're looking to roll their own bgm:s, if there's such a target audience. It looks like we're seeing more division of labour (dev + artist combos)?

To what extent is 0CC-FT suitable for NES development?

*not to be confused with note accents

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 6:34 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19238
Location: NE Indiana, USA (NTSC)
za909 wrote:
My engines can either have a length counter-like timer in software to stop the sound, or a "stop the sound when less than X frames of duration are left for this note". It makes things as opened up as I need them to be.

Pently has a "detached" bit on each instrument, which means cut it when half a row remains. Its concept of "legato" is to change the pitch of an existing note and ignore the detached bit.


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 8:21 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5825
Location: Canada
FrankenGraphics wrote:
To what extent is 0CC-FT suitable for NES development?

0CC is a fork of Famitracker with whatever extra features HertzDevil wanted to see.

I don't think any of those extra features are really relevant for use in an NES game. For the same reason that most game engines would want to use their own compact/subset music engine instead of the full Famitracker driver, the extra features of 0CC require more driver code to support. I think 0CC is mainly of interest to people just making music / NSFs and were frustrated by the (stagnant?) pace of regular Famitracker development-- though I think the existence of 0CC itself might have contributed to jsr losing interest in continuing Famitracker. :(

Bregalad wrote:
A good sound engine (like the ones I code) do this by default - always start notes with a silent frame (and implicitly delaying everything one frame).

This statement is a bit strange to me, at least in an NES context. For sampler based music engines, and also with FM, I have seen this primarily to be able to release a note smoothly and quickly before the next frame, rather than a hard cut, but that's not something that happens on the NES. Why should a "good" NES music engine delay everything by one frame? (Do you know of NES music engine examples that do this? SMB does not, it's doing it through envelopes like FrankenGraphics described, and the other channels without such an envelope start a frame "early".)

This "volume 0 as note start" idea can be useful for breaking up plain tones, but I'd never think of that as the default way to start a note on the NES. There's a million other ways to start a note with an envelope that will make the beginning of it sound distinct from the previous tone.


One similar trick that some people like to do in Famitracker is put an H00 effect, which is supposed to be a null hardware pitch slide but had the side effect in the engine of rewriting high pitch and resetting the phase of the square channel it's on. This adds a little "pop" discontinuity where the phase is reset, though if the previous phase is unlucky it might be quiet. A lot of NES engines actually start every new note with a full phase reset. I think the volume 0 envelope start is a much more robust solution to that problem, but this is an alternative that I've seen used in both commercial games and as H00 by Famitracker users.


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 11:19 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1017
Location: Gothenburg, Sweden
Just to show how varying between non-legatos with different pauses can be useful/dramatically change the sound:

Fanfares in order:
1. Legato [x]
2."Semilegato" [0 x] (previously called nonlegato. There's really no such thing as a semilegato*)
3. Nonlegato [0 0 x]

While the separation happens between 1 and 2, the 3rd has a stronger rythmic presence because the aural senses have more time to "land" on the difference while still having the prior samples fresh in mind. Too long a pause and this presence will disappear again.

Go ahead and change around in the instrument columns - you can often get away with mixing them, so you can use delays to taste when you think something felt too off beat just as well as you could aim to quantize it all. It can even be a feature refraining from quantizing the notes too much to make the bgm more "live played".

Attachment:
fanfare_legato_semilegato_nonlegato.ftm [2.79 KiB]
Downloaded 23 times


*My italian is limited to what the cookbook says, but
Semi = half
Legato = tied/glued together.

Half-tied together? Nah. To the ear, the notes are, or they aren't. #2 falls just outside what could be percieved as a legato.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 11:47 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5825
Location: Canada
Unrelated to the legato thing you're trying to demonstrate, I might point out that your vibrato pitch envelopes are off centre, which becomes especially noticeable at higher pitched notes. The central pitch is lower than where it should be, and it's twice as detuned-low when it transitions from the "1" to "2" part of the loop.

Your pitch loop goes down from the starting pitch, then back up, then loops. A symmetrical loop should go 50% up, then 100% down, then 50% back up before looping.

off centre: | 1 1 -1 -1 (resulting pitch offset: 1 2 1 0 1 2 1 0...)

centred: | 1 -1 -1 1 (resulting pitch offset: 1 0 -1 0 1 0 -1 0...)


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 12:02 pm 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1017
Location: Gothenburg, Sweden
Quote:
vibrato
Thanks! ugh, wouldn't be the first time i messed that up. :? Fixed it.
Attachment:
fanfare_legato_semilegato_nonlegato.ftm [2.79 KiB]
Downloaded 24 times
(For synthesizing flutes and some other woodwinds, you'd want the vibrato to "dip" asymmetrically, because that's how you play the flute/how the flute sounds - but generally not for many other instruments).

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 1:01 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5825
Location: Canada
Your new vibrato is strange. It spends 1 frame in 6 at a different pitch before reverting to the original? It sounds more like a periodic "blip" than a change in pitch.

new vibrato: | 3 -3 0 0 0 0 -3 3 0 0 0 0 (result: 3 0 0 0 0 0 -3 0 0 0 0 0...)

You could spread it out over the loop for a much smoother vibratio:

smoother alternative: | 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 (result: 1 2 3 2 1 0 -1 -2 -3 -2 -1 0...)

Or if you want a more "square" LFO:

square vibrato: | 3 0 0 0 0 -3 -3 0 0 0 0 3 (result: 3 3 3 3 3 0 -3 -3 -3 -3 -3 0...)


Also, pedantically because of the linear vs. logarithmic nature of pitch, even the balanced pitch envelope isn't quite "centred" but it's close enough for all musical purposes, really. The NES isn't a precision tuning instrument to begin with, so a true ideal balance is not really possible. (Though some have experimented with MOD style linear pitch for more intuitive/natural pitch slides, I think that is an 0CC feature, actually.)


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 2:31 pm 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1017
Location: Gothenburg, Sweden
Thanks - that cured me of a foggy misconception on how the pitch envelope works.

I ended up with this for now:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (delay)
1 0 0 0 0 -1 -1 0 0 0 0 1 (vibrato start)
1 1 0 0 -1 -1 -1 -1 0 0 1 1 (increase)
| 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 (vibrato max; loop)


A bit wasteful and a subtle difference compared to just turning vibrato on , but i think it's nice.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 2:53 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5825
Location: Canada
If you're using it for a game, I think it's pretty sensible to drop almost all of the Famitracker effects and just do all vibrato via pitch envelopes. Each effect costs RAM and code complexity, and the instrument envelopes are really very versatile already.

If you're just making music for music's sake though, I'd use whatever seems to work best. There's good use cases for any Famitracker effect. You can do more complicated vibrato with envelopes than the vibrato effect (e.g. you've already hit on the gradually increasing vibrato idea), though it is tied up with instrument definitions.


Personally, all I kept for my engine was Bxx (loop point), Dxx (irregular pattern length), and Fxx (speed change), and also the volume column. I also discarded the hi-pitch envelope, which seemed unnecessary.

Other people's engines keep various things, with Famitone shiru didn't think volume control or duty envelopes were important. Tepples' Pently has a bunch of concepts that he felt were useful that don't map to Famitracker features. For Haunted Halloween I was asked to add a bunch of Famitracker effects to Famitone (in particular the portamento stuff, which became kind of a unique feature of its soundtrack), and there have been other efforts to add stuff to Famitone. There seem to be a lot of differening ideas about what's important in a music engine, and what's not.


Top
 Profile  
 
PostPosted: Thu Jul 13, 2017 8:25 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3950
Famitracker works much better if you use Note Off commands (backslash key \ ). Then you define Release envelopes for the note to fade as it encounters the Note Off event. Release envelopes are sorta like the loop envelopes, but it's like this: x x x x | x x x x / x x x x. | is the loop, / is the release. For some reason, the first one from the release is also treated as part of the loop.

Alternatively, if you don't like dirty hacks, I think the proper command is S0X, where X is your speed in frames minus 1.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group