Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / MOD / XM support - Tier 1

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 12th Dec 2019 00:54 Edited at: 6th Apr 2020 20:35
OK. I've waited long enough for this to be added as a feature, so I've made a start on a Tier 1 XM / MOD play routine.
The latest thread I've seen on this had some good thoughts and start points, but nothing seems to have come of it.

We couldn't really consider a T1 play routine until the sound functions were extended to allow sample playback speed control, but at face value now, there's no technical obstacle to getting at least a partial player to work here.

So, I gathered what info there was on the various formats and decided to approach the XM (Fast tracker 2) format, as this is broadly backward compatible with MOD format (plus it's easy enough to convert S3M / IT - even MIDI etc. into XM)

So far, I've sorted out processing the channel, pattern and song data and am part way through the instrument data. Next will be the actual sample data processing and then onto the sequencer part.
I expect I'll release a preview when I've got the basic player going with the fundamental pitch control for note playing and the basic commands (Fxx, Cxx, 1xx, 2xx, Bxx and Dxx) which will allow some reasonable capability.

There are a lot of extended functions in XM which will probably not be worth the effort to realise in T1, but who knows?

The more people who show support for this, the quicker I'll be impelled to complete it

Note: For those not familiar with this format, a MOD or XM is a sequenced music file which uses a combination of sequenced data with controls (e.g. volume, pitch bend) to play samples as notes. This allows for virtually unlimited music / complex programmed sound effects with low footprint and other benefits, such as synchronised or dynamic music, triggered effects and many other possibilities.

Version 0.0
Basic ability to play a XM module in Tier 1
-Load module
-Parse Module
-Decode 8bit samples
-Play a single pattern

Here, I'll add some functions, capabilities and features I'm trying to address and the progress thereof:

Commands:
Fxx (Speed)
Exx (Filter and ?)
Dxx (Song Jump)
Cxx (Inst Volume control)
Bxx (Pattern Jump control)
Axx (Slide Volume Control)
9xx (Sample offset)
8xx (Panning)
7xx ?
6xx (Vibrato + Vol slide) [partial]
5xx (Portamento + Vol slide)
4xx (Vibrato) [partial]
3xx (Portamento to note)
2xx (Portamento down)
1xx (Portamento up)
0xx (Arpeggio)

Other

Full sequence playback and song control
Channel activity control
Channel, Instrument and fx feedback for sync control
Multi-Channel mix control (overall mix / mastering) -
Sample Loop control (forward and ping pong) (forward only)
16 bit samples
Missing Instruments
Unset Instruments
Default Instrument Volume
native 50fps mapping to arbitrary frame update speeds
Correct pitch for non-linear pitch table (i.e. everything that came from PT/Amiga) using Amiga NTSC period table
Added Amiga range finetune table
[02/03/2020] Updated 1xx,2xx,3xx events and added 5xx based on newly gleaned information about how this is supposed to work.
Started tidying code up prior to beta release. Will now add the pattern controls (sequencer and pattern controls (bxx, dxx) as these needed the sequencer working before they could be added.
Also started adding parameters for setup. E.g. options for:
Optional rendering waveform images/sprites
Generating visual pattern data
Channel control (on/off)
Cut-off override (percussion reverb)
Export samples
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Dec 2019 02:08
great work
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Loktofeit
AGK Developer
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 12th Dec 2019 03:32
Yes! XM does seem the most versatile and backward compatible of the various formats at the time. MOD support would be interesting as a novelty, but if one is going to invest that type of effort, a modern board/sequencer might have much more appeal. I've shown a few modern DJs and EDM musicians how I used to make music (MODEDIT2/FastTracker2) and they look at me like I'm trying to teach them how to handcraft an integrated circuit.


While writing this, I looked through my backups to see when it was I was writing songs in that format. Evidently the last one I did was 1994, 25 years ago. Didn't realize it was that long ago. MOD file attached for anyone interested.

Attachments

Login to view attachments
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 12th Dec 2019 10:24
@nz0

yeah, I had to focus on other things, and the feedback and support with that project here was also not very high at this time.
In the link you mentioned I had also posted another thread-link
https://forum.thegamecreators.com/thread/219457

There I created a playback routine like a "Mario Paint Composer". It was a starting point.
For me S3M is in some cases the "best" format, because it is well documented and plays back in a lot of programs and a lot of programs support it.
And the next thing could be, to support MO3, a combination of MOD/MP3 or Tracker+OGG compression format.

The thing is, I didn't know, how to time the notes correctly and we have no Memblock-Playback for Samples. So I guess, some delay between notes could be an issue.
Also all these fanzy effects are some work.

Also a think for me was development time, and since it is no native command like in PureBasic, it would eat a lot of time and for a prototype I would still have to create a 30 sec. OGG file and could playback in a loop.
Also a lot of the music from asset stores are in WAV, MP3, OGG. But the tracker modules are not for sale. So one option is, to create one by our own, or hire a componist.

And yeah, it would be great, to have Tier 1 module playback that would work on any platform. Would really like that.
AliceSim1
6
Years of Service
User Offline
Joined: 15th Oct 2018
Location: Barcelona
Posted: 12th Dec 2019 13:49
It is a music format that I value a lot, for being retro varied and of small size that it occupies.
I own a collection of 15 years ago! Beautiful songs!
For my serious happiness if these formats were supported, music trakers
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Dec 2019 14:14
Did someone post a link to an open source Tracker/S3M/XM/IT C/C++ library a while back that could be incorporated?

Xaby: Did you link to it or was it XMPlay or something else??
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 12th Dec 2019 14:26
@xaby

Even if I can't work out some of the complex effects in T1, it could be built on perhaps, once there is a foundation for the common effects.
For instance, there's a ping-pong loop mode effect which could be faked by unrolling the ping-pong in memory during a preprocessing phase.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 12th Dec 2019 14:28
@Bengismo
I think it was OpenMPT

I was rather hoping it would make more sense to incorporate that into the main AppGameKit library
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Dec 2019 14:34 Edited at: 12th Dec 2019 14:34
nzO wrote: "@Bengismo
I think it was OpenMPT

I was rather hoping it would make more sense to incorporate that into the main AppGameKit library"


Thats the library I was thinking of!! Thanks!!

and Yes, putting it into the main library would be best (thats what I was thinking too)
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 12th Dec 2019 20:44
@Bengismo

http://modplug-xmms.sourceforge.net/

from 2017-04-24
https://sourceforge.net/projects/modplug-xmms/files/libmodplug/

all C++ source for 699, mid, mod, mt2, mtm, s3m, it, wav, xm and some others.

I guess, if we would have LoadMusic() and it would just support these files, it would be a great thing.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 15th Dec 2019 01:54 Edited at: 15th Dec 2019 01:55
OK, I said I'd post an update when there was something to see, so here it is:
There's no effects or stuff - just hacked up so show it works. This is my first rendition of a pitch table and it's linear, also it's slightly out in places, but 95% correct. I will also add the amiga pitch table as this and many other modules originated there.

The main thing is, is that it works in principal with the T1 capability. This test is just playing one pattern only (and not even the pattern on screen

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 15th Dec 2019 03:44 Edited at: 15th Dec 2019 04:00
good stuff, nz0.

Quote: " it's slightly out in places"

i say keep it as-is and call it SoundOff™? (i have jokes )

in the end, i just want more of this.

keep it up!

Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 15th Dec 2019 11:52 Edited at: 15th Dec 2019 12:30
I sat down 5 mins ago to look at how hard it would be to add tracker playback support to the internal AppGameKit libraries....

I've just discovered that most of the mod formats (.S3M .XM .IT and a few others) will ALREADY playback in AppGameKit teir 1 on PC anyway!! (shocking)

You just need the codecs on your PC and you can use the built in music commands already.
klitecodec pack (Full version) gives you at least .it .mo3 .mtm .s3m .umx .xm.


EDIT: the klite codec pack doesnt support .mod format but the BASS windows codec pack does... so its possible to play .mod files too if you install that...Happy days
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 15th Dec 2019 19:50
@Bengismo,

but using BASS would cost money, I guess, if you want to use it in game. And it is also not multiplatform.

@nz0

great, its more sound, I ever got with my beginning
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 15th Dec 2019 20:06 Edited at: 15th Dec 2019 20:10
You only need the bass library for .mod files the rest of the formats are covered without.

The k lite codec pack states it is freeware and so no licensing fees. Thats what it states anyway. Besides.... it would be the end user downloading any codecs.

The point was that teir 1 supports all the mod formats and a lot of other audio formats too depending on the filters you have installed locally.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 21:25
@Bengismo
For Windows, all that stuff is fine and dandy, but not cross platform, no interaction with the playback etc. My BASS/FMOD wrapper could offer all that and more for Windows users.
Great actually, and I'm quite happy that such codecs exist - that people could play mods/XM on windows with downloaded add-ons, but it's not in the spirit of things - i.e. native support
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 21:44
I've updated the initial post to show progress and goals.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Dec 2019 21:46
Of course, i just thought people should know that its there as its not a capability that ive seen anyone mention on the forums at all...im doubtful most users would even know its possible - even on one platform.

It is indeed unlikely that there is any support in linux or android etc for tracker format playback in teir 1 but without looking into the sources on those platforms, who would even know?

Besides....writing a player is half the fun

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Dec 2019 21:51
what's involved re: interacting with music/sound on our end?

IE, i expect we can we look for certain things within the music being played and use them as triggers?

and, does filetype matter?

i haven't delved into what you're working with so trying to imagine functionality/usage.

G-Breaker WIP and Itch.io Page.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 22:11
@Bengisomo I agree. The mod/XM format is criminally under-utilised and people should be made aware of it's existence. This should work on all platforms that AppGameKit supports (although I note that some don't/may not support the InstancePlayback() rate to varying extents, so that should be tested at some point?

@Virtual Nomad I would expect that you would be able to trigger events from anything you like - instrument, note, channel, volume/peak, arbitrary effect (e.g. Exx) or whatever you like. If you were using this, then you would have the source for the T1 player so be able to interact with whatever event you wish.
For instance, that video I showed with the events triggering things onscreen - that was events triggered by a particular instrument (with optional volume level) e.g. the reverse cymbal would only be accepted at volume>50%. The Exx command is (as far as I know) not used for much so custom triggers could be added to E01, E02, E03 etc. at arbitrary positions.
For filetype, do you mean module types (XM, MOD, IT) or general audio types like WAVs and OGGs?
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Dec 2019 22:15 Edited at: 16th Dec 2019 22:16
ogg, yes.

perhaps i'm misunderstanding what you're working with. can we monitor (general) sound with this or do we "create" the sounds with it?

either way, i'm interested
G-Breaker WIP and Itch.io Page.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Dec 2019 22:28 Edited at: 17th Dec 2019 00:11
Just to comment on the InstancePlayback() rate "limits" on each platform

As far as I can tell from the sources...they are

Windows XAudio x0.001 to x1024
Android x0.001 to 1000 on startup - this is checked at runtime and corrected to the supported ranges - On 3 different devices ive tried, the range is 0.5 to 2.0
Linux x0.5 to 2.0
Apple x0.5 to 2.0
Mac x0.5 to 2.0
Pi x0.5 to 2.0
Html x1.0 to 1.0


As you can see.....most platforms appear to be quite limited except windows

EDIT - Added details of android actual testing.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 22:36
Ok, this project is to real-time playback of MOD/XM (and derivatives) which are basically files which contain song data (patterns of sequence data like MIDI but also include many other realtime effects such as volume, loop, slide etc.) and digital samples which are used for the instruments in said songs).
The player looks at the sequence of notes and commands and plays multiple simultaneous samples according to the sequence and commands.
In relation to your question, with the player, we can of course intercept and monitor individual notes, instruments/samples, effects or any arbitrary event during the playback of that sequence. There's no "creation" of sounds here, although you can do and generate whatever you want in the module itself (e.g. music sequence, complex sound effect etc. using the library of samples in the module itself).

I think if you had a set of samples (e.g.) words saying "5" "4" "3" "2" and "1" as .OGG files, then you could arrange any sequence you like with all kinds of effects and trigger the sequence as needed.

If you get the concept of a sequencer, then the result of this project will give you virtually unlimited sequencing abilities with the samples you've got, with the overhead of relatively few bytes of sequencer (or song) data, with all the programmable abilities a sequencer gives.
This can be used to make music, complex sound effects and sound effect sequences.

If you have one big sample of a piece of music, then this isn't going to be able to deconstruct that and find instruments / peaks etc, rather it's the other way around.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Dec 2019 22:55
thanks for that

now i'm ready to put it to work!
G-Breaker WIP and Itch.io Page.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 23:10 Edited at: 16th Dec 2019 23:21
@Bengismo That's interesting. Where did you get those from? That could be quite limiting (although not impossible to deal with).
The range required for 8 octaves covered by XM is ahem.. according to my linear calculated pitch table for AGK:

[0.0625, 0.0677083, 0.0729167, 0.078125, 0.0833333, 0.0885417, 0.09375, 0.0989584, 0.104167, 0.109375, 0.114583, 0.119792, 0.125, 0.135417, 0.145833, 0.15625, 0.166667, 0.177083, 0.1875, 0.197917, 0.208333, 0.21875, 0.229167, 0.239583, 0.25, 0.270833, 0.291667, 0.3125, 0.333333, 0.354167, 0.375, 0.395833, 0.416667, 0.4375, 0.458333, 0.479167, 0.5, 0.541667, 0.583333, 0.625, 0.666667, 0.708333, 0.75, 0.791667, 0.833333, 0.875, 0.916667, 0.958334, 1, 1.08333, 1.16667, 1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333, 1.91667, 2, 2.16667, 2.33333, 2.5, 2.66667, 2.83333, 3, 3.16667, 3.33333, 3.5, 3.66667, 3.83333, 4, 4.33333, 4.66667, 5, 5.33333, 5.66667, 6, 6.33333, 6.66667, 7, 7.33333, 7.66667, 8, 8.66667, 9.33333, 10, 10.6667, 11.3333, 12, 12.6667, 13.3333, 14, 14.6667, 15.3333, 16]

So.. many platforms would need pre-calculated lower/higher octave samples. Not impossible, but dang...

[edit] To be honest though, not much is going to the C0 or C7 extremes. Most stuff sticks to the middle 3 (at least with Amiga origins) so, we are really working with 0.5 -> 2.0 in most cases. However, it would be prudent to render additional re-samples for all ranges if this project gets sufficient interest. A good coder would pre-check the music for extreme samples and render those specific samples as required to save memory
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Dec 2019 23:20 Edited at: 16th Dec 2019 23:21
Those are from AGK's source files....each platform has limits set in its core.

Windows is fine....android is actually dynamic and dependant on hardware (OpenSL support) so at best will be the range above but likely lower depending on implementation

Pretty much everything else is just 2 octaves (0.5 to 2.0)

But....like you said....Use over sample and sub sample copies. So copy of the sample at x1/4 rate, one at 1x rate and one at x4 rate and you will have 6 octaves covered.
You cant pitch slide between boundaries though but still should be fine for most files - its not likely to be used that much.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 23:26
Another annoyance - the way I was going to do looped samples was to make 2 different samples and switch over when the loop part hits. More duplication then!
Oh, 0.5 -> 2.0 is 3 octaves (Includes the 1.0).

Well, at least there's the test function to see how much pitch range there is. Still all technically possible then - just more work
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 23:29 Edited at: 16th Dec 2019 23:30
What do you mean, can't pitch slide between boundaries? Pfft.

As the pitch slide is calculated per pattern step (and even per tick frame for fine shift) and not per note, this will still be possible - just more complicated
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Dec 2019 23:30
0.5 to 1.0 is one octave, 1.0 to 2.0 is one octave
So 0.5 to 2.0 is 2 octaves range

Yah...its not great really....would have been alot easier if the ranges were just abit wider.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 23:33 Edited at: 16th Dec 2019 23:36
Quote: "0.5 to 1.0 is one octave, 1.0 to 2.0 is one octave
So 0.5 to 2.0 is 2 octaves range
"


In my mind it covers 3 octaves, including default 1.0 in the XM format - C-3=0.5, C-4=1.0, C-5=2.0

[edit] oh yea.. the c-5 octave has to go up to 4.0 to be covered....
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Dec 2019 23:37
https://en.wikipedia.org/wiki/Octave

num octaves = log2 (f2/f1)
=log2(2.0/0.5)
= log2(4) = 2 octaves

The wiki explains it
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 23:40
Another thing I'd asked for ages was float volume. I can't believe it's just an integer (1-100) for volume in AGK.. Surely it's possible to express floats for volume in whatever lower lib AppGameKit is using?
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Dec 2019 23:45 Edited at: 16th Dec 2019 23:45
Quote: "The wiki explains it"


Yea, my bad - I know what an octave is - I was a musician once
I was just thinking of the octave that can be reached by the range - not the entire octave that is capable with that range.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th Dec 2019 23:48 Edited at: 16th Dec 2019 23:59
I know what you mean. Pretty much all the audio libraries used in AppGameKit (XAudio,OpenSL etc...) actually take a float value to the volume controls! The integer values in AppGameKit are converted to floats internally - theres more to it then that though as different libraries have different logarithmic scales so there is additional scaling going on to also include master volumes and log bases.

Its even worse then that...ive noticed that the log scales used are not the same across platforms. A file played at 50 then 100 on windows does not necessarily have the same relative change as it does on android in AppGameKit! I found that out some time ago and had to compensate.



EDIT: Back to instance rates....ive just checked my android phone and the max and in rates are listed at 0.5 and 2.0 and I then checked an odroid SB computer running android and that was the same....I will try my tablet tomorrow but its not looking great....only really windows thats supports wider ranges.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 17th Dec 2019 02:01
Well, the rate issue can be overcome. Plenty of basic issues to deal with just under Windows

Just been trying to do something with channel balancing and without float volume could be an issue. Hey ho and all that. Still.. we like a challenge
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 17th Dec 2019 23:47
"Pitch" perfect now, using the Amiga NTSC period conversion table.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Dec 2019 03:06 Edited at: 20th Dec 2019 03:33
Got quite a lot more added.
Only focusing now on the middle 3 octaves, which covers all the Amiga originated stuff and does away with (most of) the extreme playback rates required.
Added the fine-tune table and incorporated the portamento with it. Seems pretty accurate when I converted it to go at 1/16 of a note per frame instead of the actual parameter (1/12)

I also needed to add some special frame control, as timing is important when firing repeat samples with an offset loop position.
The loop trigger control is called as fast as the device can manage but the play routine is called at the appropriate frame rate. I added a 50 fps controller and a 60 fps controller so if anyone ever uses this play routine, it can slot into their code if they adapt it to use Framerate independent updates.

The main problem with having to check the loop trigger so fast is because to get something useful from GetSoundInstancePlaying() is already too late - the instance has stopped and you could get a frame with halted audio.
I would like to do away with the furious checking of the GetSoundInstancePlaying() by predicting if the sound instance is going to be expired on the next frame, by tracking the playback pointer in the memblock of the sample (I kept them around for that possibility and doing something with waveform data later)

Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 20th Dec 2019 12:46
sounds cool. I guess, with a solid foundation, it would be also possible, to at more support for other compatible formats
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 30th Dec 2019 15:36
@nz0

Hope you had a merry Christmas and will also have a very good start into the next year. Can't wait, to test your playback routines with music by ourselfs.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Dec 2019 04:18
@Xaby Thanks for the greets - same to you

Well, you can see I added some extra stuff to the top post.
Pitch 1xx and 2xx is working as it should be. I needed to add the amiga finetune table to get that working properly, which will allow me to do the 3xx function.

As I suspected, the retrigger / loop function is quite annoying. I was using a "max frame rate" check for GetSoundInstancePlaying() but that's not really a good way to do it.
I've been working on a function to predict the expiry of the sample - kind of a GetSoundInstanceWillbePlayingNextFrame() function to deal with that, as it will be important for a lot of other functions later.

As also mentioned, I've ditched supporting the extreme octaves for now, as they won't be supported on many platforms and the whole point of this was to get cross platform T1 support, so no big deal.

I've spent xmas playing with my new arcade cab (my present to myself!) and getting all those good old games working
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Dec 2019 04:20
The source is a little messy at the moment, but would you like to collaborate at some point and we can pool our efforts? I know you did some work on this but now we have this foundation maybe you will want to get involved?
I'll have to tidy it up a bit first of course
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 31st Dec 2019 09:50 Edited at: 31st Dec 2019 09:50
@nz0

One idea could be, to convert samples to Memblocks, and do the mixing "by hand", and render it out as a complete song in memory.

"problem": no dynamic, needs more space in memory, could be too much for mobile, because of very long songs, if the sample-rate would be 44.1kHz, Stereo, 16 Bit a minute would be about 10.584.000, ~ 10.6 MB

I don't know, if it would be possible to render only "patterns" out and play them back. If it could be a compromise. Also a problem could be the "render-time" itself. If we can't stream from the first second on, but would have to wait some seconds, before the "WAVE" is generated.

@collaboration, in January I have to finish some projects from last year and also will have a relocation. Don't know yet my schedules. Would like to look into the code, and maybe could figure something out here and there. But you know from the past, that I also broke up my "MOD-decoder" maybe I would try to re-activate that project.
Also the biggest problem I see at the moment is timing the sounds. We would have to need our own timer. But Frame-Rate indipendently. Waiting till Playing is over, could get us some milliseconds without sound. A FRAME is too long for music.

Let's say the game runs with 60 FPS, 44100 / 60 ~ 735. So our timer has to be nearly 1000 times more accurate. If our game would only run in 30 FPS, the timer has to be accurate more like 1500 times.

It would be great, if we could render about 2 seconds out before playing, to have a Sound-Buffer in some way. Maybe we have to render every-other sound in a second memblock and if the first is not just finished, we play the second in parallel, to avoid missing Sample-FRAMEs.

I started once a re-player in Game Maker Studio, it was nearly the same problem.
https://docs.yoyogames.com/source/dadiospice/002_reference/game%20assets/sounds/audio%20buffers.html

But also in Game Maker Studio it was not possible to playback the same-audio-sound-buffer in its creation time and re-write it on-the-fly. You would have to "store" the buffer completly and only could send the complete buffer to the sound-output.

BUT! And maybe we could do that in some way, or have to ask TheGameCreators, if AppGameKit can "stream" MP3, OGG and so on. How do they do that? Does that do the hardware by its own, or de-codes some code these files and sends buffer-data, after buffer-data
Can we maybe, create a file and this file can be streamed. But we stream the file while "writing"?

I guess, what we also not have in App Game Kit is that:
https://docs.yoyogames.com/source/dadiospice/002_reference/game%20assets/sounds/audio_create_play_queue.html

With such a "command" my idea of pre-rendered PATTERNs, would be the easiest way. Also most of the PATTERNs are not very long because of the limited RAM back than.
In Sound Clubd for DOS e.g. you could have about 32 instruments and every instrument about 64 kBytes of Sample-Data and so the PATTERNs would be only some seconds long.
But if you only used maybe 3 instruments, your PATTERN could be some minutes long. Or maybe about 30 seconds or so.

And in most TRACKER programs, we are limited to 64 "Ticks". So I guess, we would have to render a 64 "Tick" chunc into a Sound-Buffer in Software. S3M has "the benefit" of being "limited" like MOD in the early days was exactly for the PAULA audio processor.
If we can have 8 channels, and non note can be manipulated from one PATTERN to the next, that could be a limitation we could render-out.

Tempo and Speed can produce long PATTERNs that would take more memory, but maybe we try the worst case or say, in most cases a 64-Tick-Chunch is maybe about 3 seconds,
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 5th Jan 2020 13:59
I thought about rendering it out, but that would almost defeat the point, as there won't be any interaction or trigger opportunities for a start.
Rendering pattern by pattern would not work either due to timing and bridging between patterns. Also, more complex commands will have retrigger positions and jumping around in the pattern.

I have recoded the timing parts and now the player part works at 50 fps whatever frequency it is called at, but the main calling loop has to be 50fps or higher.
I'm guessing you could call playback twice in a 30fps loop and it would still work OK ... I'll try it

I made a new function which is like GetSoundInstancePlaying() but actually returns true when the sound instance will be finished playing on this frame, therefore allowing me to connect the sub-sample loop.
This also gives me a value for the current position in the sample playback which has numerous benefits.

There isn't really any point in rendering the sound out now, as the per-channel, real-time playback controls are working just fine and don't require any additional memory.
Once I've loaded and parsed the XM into workable structures, I even discard the original memblock that contained the loaded XM.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 7th Jan 2020 02:31 Edited at: 7th Jan 2020 03:51
Bit of a bonus moment here, when I was adding a channel filter for debugging.
I happened to select a drum track for isolation and noted that the drums were clipped (as they were typically on 1 channel), but I remembered I could optionally allow no channel clipping on a designated channel (such as drums) and lo - it was thus:

First play is clipped channel (as it would be in XM) and 2nd play is my un-clipped variant)

[edit] Oh yea, 3XX done - top post edited.

Can this thread be moved to WIP?

Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 15th Jan 2020 15:39
@nz0 was this thread moved or will you post here the progress?

I like the percussion. Sounded good to me.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 15th Jan 2020 23:59
I will update it if it is here or moved to WIP or somewhere.
At the moment I've been studying some new info regarding the actual Protracker/FastTracker logic regarding how certain effects are achieved. I did a lot of 68000 code back in the day and thought about just simulating / converting the 68k from what the Protracker routines were doing for certain effects. I've certainly been looking at the 68k source code to understand some of the weird stuff.
I've also started on a new dynamic sync system, which should be a lot more impressive than the first versions I made.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 28th Jan 2020 10:29
A tracker

nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 16th Feb 2020 16:40
Did you move your project to another thread, or did you put it on hold, because of some mixing issues?
Would be nice, to have some prototype, doesn't matter, if it didn't sound perfect.
I had to do some other things first, before, I could help with some coding :-(
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 19th Feb 2020 22:57
It's OK - I've been messing with some other stuff in the meantime.
I haven't started another thread, although I will when I get back to it.
I did find some more documentation which may help with some issues I've been having. Mostly issues regarding internal stepping of effects in vibrato etc.

Login to post a reply

Server time is: 2024-11-22 05:02:02
Your offset time is: 2024-11-22 05:02:02