Author Topic: Pattern aliases  (Read 2055 times)

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,136
  • Gender: Male
  • Operating System: Windows XP
Pattern aliases
« on: November 04, 2010, 19:39:49 »
Not sure how difficult it would be, but knowing a bit about the code, i want to enter this request for the future. If done right, it could be a feature that most other trackers don't have.

I'm envisioning a Pattern Alias, a special note in a pattern row that forces a channel to play the data from another pattern, even while playback continues in the current pattern. The Pattern Alias would look a bit like a PC event, but instead the user can enter an alias to row Z of pattern Y belonging to the sequence X, something like:

PAT 01 012 000

which means the playback pointer would play the note data starting at row 0 of Order 12 of Sequence 01. (This of course limits the aliasing for the first 1000 rows of the first 1000 patterns of the first 100 sequences).

I'm thinking it can be implemented by simply extracting the note from the given source row (or tick) in the same way it extracts the note from the current tick of the current pattern. That is, the playback pointer keeps up with where it's at for each channel, and when an alias is called, the channel's pointer finds the data from the same place in the source pattern. Then, if a note or other event is called from the current channel, the data and perhaps the sound from the aliased channel is stopped (with options to loop or fade).

An alternate version would be a channel pointer rather than a row pointer. Instead of playing row X it could play the same row (as that of the pattern alias) but at channel X. I could use both methods.

I'm not sure what's the best way of handling pointer desyncing, such as when the current pattern is, say, 32 rows but the referenced pattern might be, like, 36. Theoretically, it should continue with playing back the source pattern until THAT ends, but the playback pointer for each channel would be in different rows, which might be able to be overcome by assigning a variable or an array to keep up with where each channel's pointer is supposed to be calling. Hmm,...like:
Code: [Select]
CHANNEL           pRow      pChn       pPat      pSeq
  000              031       000        001       001
  001              031       001        001       001
  002              000       006        050       002
...
which shows that when the "global" playback pointer is at row 31 for the current Pattern 1 in Sequence 1, the playback pointer for Channel 2 has encountered an alias, and its playback pointer is in the first row of channel 6 of the given pattern 50 of Sequence 2. So, even if the source pattern (#50) has more or less rows than the current pattern, the pointers should stay in sync as long as every channel's row pointer is incremented properly. But what if the tick count is different? Or the tempo? Perhaps those of the source pattern are ignored, and those attributes of the current pattern are used.
There might also be problems with some of the other pattern FX like Pattern Break or Pattern Loop. Some limitations to their use would have to be introduced.

The result of all this would be similar to a sequencing trick of interchanging instruments using the same pattern of notes -- altho here we're not using different instruments, but it might be possible: patterns could serve as templates for note playback. By leaving the instrument designations in the source pattern blank (notes without instruments), you could call the instrument in your main channel, then call the alias to the "uninstrumented" pattern. You could do the same with volume levels and pan settings. It might also work for differing tempos and other global settings.
It would also save HD space (even though this is nowadays not a huge problem), and could make assembling and transcribing tracks a helluva lot quicker...

Sound doable?

Edit: Moved to the issue tracker
« Last Edit: July 01, 2011, 19:07:16 by Jojo »

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,197
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Pattern aliases
« Reply #1 on: November 04, 2010, 20:23:37 »
Sounds pretty much like this request to me, if you agree please close the request.
ยป No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 707
Re: Pattern aliases
« Reply #2 on: November 04, 2010, 20:39:31 »
There are some related ideas also in Revised IT Project (.ITP) functionality.

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,136
  • Gender: Male
  • Operating System: Windows XP
Re: Pattern aliases
« Reply #3 on: November 08, 2010, 20:35:36 »
Sounds pretty much like this request to me, if you agree please close the request.

Mmm, not quite the same idea. But it can be used for the same things.

My idea relies more on a refiguring where the playback pointer is at a given tick...have you thought about the difficulty of implementation, or had any ideas on how a future coder can go about putting it together? Jot them here. ;)