Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:56 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: Can I access current playing position in Mod file

Author Message
Bluescreen2001
Newbie

Joined: 14/08/2020
Location: Germany
Posts: 12
Posted: 03:26pm 15 Aug 2020
Copy link to clipboard 
Print this post

Hi,
I am new to Maximite, currently waiting for mine to arrive.

As I understand, MMBASIC is able to play MOD files in the background. Is it possible to get the current playing position, to do some visualisation of the play MOD.

Thorsten
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 11:45pm 16 Aug 2020
Copy link to clipboard 
Print this post

  Bluescreen2001 said  As I understand, MMBASIC is able to play MOD files in the background. Is it possible to get the current playing position, to do some visualisation of the play MOD.

I do not think that is possible.  

My understanding is that the following can be used to play a mod file and get information on what is happening:
PLAY MODFILE file$ [,samplerate]
MM.INFO$(SOUND)
MM.INFO$(TRACK)


I found the following information on the mod file format:
MOD FAQ part 1
MOD FAQ part 2
Noisetracker/Soundtracker/Protracker Module Format

Scanning through that documentation it does not look like the mod format contains the length of the track so I do not see any easy way to work out where you are in the file playback.  You could of course analyse the track in an external program (eg. on a PC) and assemble a list of timestamps to synchronise your visualisations by hand.

It might also be possible to tap the audio output and feed it into an analog i/o pin to analyse the signal, but thats a hardware solution, not a software one.

Someone more knowledgeable than I might be able to shed more light on this.

Regards

Womble
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 06:18am 17 Aug 2020
Copy link to clipboard 
Print this post

I think only matherp can answer this one but reading the values written to the DAC by poking the DAC register could give you information for a digital VU meter. If that is what you are after. I have no idea if that is possible at all (direct access to STM32 registers from MMBasic).
PicomiteVGA PETSCII ROBOTS
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 06:30am 17 Aug 2020
Copy link to clipboard 
Print this post

  Volhout said  I think only matherp can answer this one but reading the values written to the DAC by poking the DAC register could give you information for a digital VU meter. If that is what you are after. I have no idea if that is possible at all (direct access to STM32 registers from MMBasic).


I don't think that is what he is looking for but if it is, PIN("DAC1") does the job nicely.

Jim
VK7JH
MMedit
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 07:18am 17 Aug 2020
Copy link to clipboard 
Print this post

  Quote  As I understand, MMBASIC is able to play MOD files in the background. Is it possible to get the current playing position, to do some visualisation of the play MOD.


No: sorry the modfile codec is a black box as far as the firmware is concerned
 
Bluescreen2001
Newbie

Joined: 14/08/2020
Location: Germany
Posts: 12
Posted: 08:17am 17 Aug 2020
Copy link to clipboard 
Print this post

Thank you for the replies. You are right, I do not mean the current output level. Ideal would be a file position pointer which points to the current playing position in the file.

Then I could interpret the file and show something like a tracker GUI.

What about playing MP3? I read somewhere CMM2 can play MP3s, but I do not find the command for that.

But I think I should wait for my board to arrive and play around with it a bit. Then it will be clearer.

Thorsten
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:19am 17 Aug 2020
Copy link to clipboard 
Print this post

  Quote  What about playing MP3? I read somewhere CMM2 can play MP3s, but I do not find the command for that.


PLAY MP3 filename$  
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 08:32am 17 Aug 2020
Copy link to clipboard 
Print this post

  Bluescreen2001 said  As I understand, MMBASIC is able to play MOD files in the background. Is it possible to get the current playing position.

Typically you would do this by using the TIMER function to check how long you have been playing the mod file.

PLAY MODFILE "file.mod"
TIMER = 0
DO
 ' main program loop
 ' TIMER counts how long the mod file has been playing.  For example:
 IF INT(TIMER) = 750 THEN PRINT "Now at the 750ms point"
LOOP


There are many ways to do this.  To avoid resetting TIMER you could assign its start value to a variable and use the difference as the running timer.  Another approach is to use the SETTICK command to trigger an interrupt at selected time intervals.

Geoff
Edited 2020-08-17 18:35 by Geoffg
Geoff Graham - http://geoffg.net
 
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