Mod Archive Forums Mod Archive Forums
Advanced search  

News:

Please note: Your main modarchive.org account will not work here, you must create a forum account to post on the forums.

Pages: [1]   Go Down

Author Topic: MOD files BPM and Temp parameters/commands  (Read 6286 times)

0 Members and 1 Guest are viewing this topic.

Sayman

  • New User
  • Offline Offline
  • Posts: 2
    • View Profile
MOD files BPM and Temp parameters/commands
« on: May 26, 2021, 08:52:39 »

Hello All! I have some 8 bit machine based on Z80 CPU. I try to write MOD player, but confront wirh a problem.
This 8 bit machine not have DMA and not have CIA or similar device. So, i need to work with samples and speed and bpm parameters in realrtime (or with tables). I need to convert BMP and speed to bytes per tick/row. I know about standart formula - speed/(BPM*2), but this is in milliseconds (or in Hz). But, i need to calculate - how many byutes i need to send in sound device per speed tick (or row). Can somebody help me?
Logged

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: MOD files BPM and Temp parameters/commands
« Reply #1 on: May 26, 2021, 22:48:22 »

With milliseconds, you're almost there, you just need one more calculation. First, you need to know the sample rate at which you're mixing. For example, if your sample rate is 48000 Hz, then 1 second (or 1000 milliseconds) will be 48000 samples long. So if your sound signal has 8-bit quality, that would be 48000 bytes, if it-s 16-bit quality then 96000 bytes and so on. So if your tick duration is 10ms, that would be 48000*10/1000=480 samples.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker

Sayman

  • New User
  • Offline Offline
  • Posts: 2
    • View Profile
Re: MOD files BPM and Temp parameters/commands
« Reply #2 on: July 15, 2021, 07:58:56 »

Hello again. Ok, about BPM and tempo, I seem to have understood and figured it out.
But another question i have: when playing, periods are used. How can these
periods be converted to sample movement? let's say, the note A-4 is encountered,
it has some period. To reproduce the sample at this note (frequency), this
period must be converted to a certain value that will indicate the offset in the
sample.
Logged

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: MOD files BPM and Temp parameters/commands
« Reply #3 on: July 15, 2021, 18:43:58 »

Periods are divisions of the Amiga's CPU clock, so the frequency is derived from the formula 3546895 / period. If you have the possibility to use a custom MOD format for your player, I would recommend against using the Amiga pattern data as-is, because in particular the period values make it harder to use than necessary. On the earliest Amiga trackers this made sense when there was no finetune (you could just send the period, as it was written in the pattern data, to the hardware) but as soon as finetune comes into play, even on Amiga this optimization doesn't make sense anymore. So to save some cycles, you may want to either put note values in converted pattern data, or directly whatever numeric value your mixer needs to determine at which speed to advance the sample data.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker
Pages: [1]   Go Up