![]() |
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: GermanyPosts: 12 |
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 KingdomPosts: 267 |
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: NetherlandsPosts: 5089 |
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: AustraliaPosts: 6283 |
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 KingdomPosts: 10310 |
No: sorry the modfile codec is a black box as far as the firmware is concerned |
||||
Bluescreen2001 Newbie ![]() Joined: 14/08/2020 Location: GermanyPosts: 12 |
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 KingdomPosts: 10310 |
PLAY MP3 filename$ ![]() |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
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 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |