Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:05 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: MODs vs. WAVs, and ModTracker recommendations.

Author Message
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 01:12pm 22 May 2021
Copy link to clipboard 
Print this post

I noticed that the PLAY WAV command is fairly expensive and it doesn't vary much with the sample rate:


> TIMER=0:PLAY WAV "fireSmall.wav":PRINT TIMER
13.444
> TIMER=0:PLAY WAV "fireBig.wav":PRINT TIMER
14.252

> list files "fire*.wav"
A:/XDRAGON/demo
12:54 22-05-2021      42982  fireBig.wav
12:55 22-05-2021      21514  fireSmall.wav
0 directories, 2 files


One is 22050Hz, the other 11025Hz.

I'm guessing file system access is a big part of the cost, and maybe that's not the case if I would use PLAY MODSAMPLE instead.

So I'm looking for a beginner friendly ModTracker for PC that allows me to edit in my sound FX (currently in .wav format). Any recommendations?

I found OpenMPT, but I'm struggling with it. It lets me import my sound effects but they sound weird. I see some resampling options, but those only made it worse.

Or maybe this approach is wrong and I should find a MOD archive somewhere that contains MOD friendly sounds?
Epsilon CMM2 projects
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 01:43pm 22 May 2021
Copy link to clipboard 
Print this post

Reaper DAW

No clue what this MOD thing is but when it comes to audio, Reaper can handle pretty much anything.
Edited 2021-05-22 23:44 by Tinine
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 02:02pm 22 May 2021
Copy link to clipboard 
Print this post

  Tinine said  Reaper DAW

No clue what this MOD thing is but when it comes to audio, Reaper can handle pretty much anything.


...anything but mod files. .mod files are not recognized as supported media files.

MOD is a chiptune file format, late-80s/90s era. I think it came from Amiga but it was common in the PC demoscene as well.
Epsilon CMM2 projects
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 02:11pm 22 May 2021
Copy link to clipboard 
Print this post

  Quote  I noticed that the PLAY WAV command is fairly expensive and it doesn't vary much with the sample rate:


What do you think you are testing? Play WAV is non-blocking so you are just measuring the time to open the file and read the header + the first block of data. This won't vary much. The overhead of actually playing the sample will vary linearly with sample rate
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 02:14pm 22 May 2021
Copy link to clipboard 
Print this post

MOD uses 8-bit PCM samples of instruments. Usually either 15 (IIRC) or 32. They did, indeed, start on the Amiga but PC sound cards started handling them too. I think the file specifies the instrument, special effect, channel, start and stop times. My memory is a bit hazy now. lol They were designed to have a low processing load on the system.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 02:52pm 22 May 2021
Copy link to clipboard 
Print this post

  matherp said  
  Quote  I noticed that the PLAY WAV command is fairly expensive and it doesn't vary much with the sample rate:


What do you think you are testing? Play WAV is non-blocking so you are just measuring the time to open the file and read the header + the first block of data. This won't vary much. The overhead of actually playing the sample will vary linearly with sample rate


Yes, I'm aware of that. But the time to open the file and reader the header and first block of data is already too much if the sound effect in question is a bullet being fired in a game for instance.

I'm hoping that PLAY MODSAMPLE will be faster because it's referencing samples in an already open MOD file. I would like to experiment with that a little, but haven't found a good ModTracker yet that allows me to add my sounds to an existing .mod.
Epsilon CMM2 projects
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 03:16pm 22 May 2021
Copy link to clipboard 
Print this post

If it is a short sound effect, load it into an array and use DAC START
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 03:20pm 22 May 2021
Copy link to clipboard 
Print this post

  epsilon said  I'm hoping that PLAY MODSAMPLE will be faster because it's referencing samples in an already open MOD file.


This indeed appears to be the case:


> play modfile "blind_justice.mod"
> TIMER=0: play modsample 26, 1: PRINT TIMER
0.007


The sample I played is the same as the .wav in the previous test.
(still struggling to get it to sound right however).
Epsilon CMM2 projects
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 03:21pm 22 May 2021
Copy link to clipboard 
Print this post

  matherp said  If it is a short sound effect, load it into an array and use DAC START


Perfect! Yes, I'll try that. Thank you!
Epsilon CMM2 projects
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 03:34pm 22 May 2021
Copy link to clipboard 
Print this post

Creating sounds with MODs
Visit Vegipete's *Mite Library for cool programs.
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 04:37pm 22 May 2021
Copy link to clipboard 
Print this post

  vegipete said  Creating sounds with MODs


Thank you. That's a great post! The steps outlined happened to match with what I was doing, but only in the case of 8000Hz the sample playback approached the original, at least when played back in OpenMPT itself.
Anyway, it's good to know OpenMT is the tool to use. I will experiment more with this.
Epsilon CMM2 projects
 
epsilon

Senior Member

Joined: 30/07/2020
Location: Belgium
Posts: 255
Posted: 12:42pm 23 May 2021
Copy link to clipboard 
Print this post

  epsilon said  
  vegipete said  Creating sounds with MODs


Thank you. That's a great post! The steps outlined happened to match with what I was doing, but only in the case of 8000Hz the sample playback approached the original, at least when played back in OpenMPT itself.
Anyway, it's good to know OpenMT is the tool to use. I will experiment more with this.


It was just a pilot error. The procedure as described by vegipete works great. So, MOD files are a great container for sound effects, and the PLAY MODFILE/MODSAMPLE API is a perfect API for sound effects in games: low overhead, easy to use, and supports overlapping sounds.
Epsilon CMM2 projects
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025