24 June 2016, 23:35 | #1 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 667
|
Time conversion in Arexx
I'm writing an Arexx script for OctaMED SoundStudio which will calculate (roughly) the total playing time of a song.
Now I've got a quite correct amount of seconds which I'd like to show as minutes:seconds. Problem is, just dividing by 60 is returning a value which is minute and part of minute elapsed, not seconds. Code:
TRUNC(total_ms/1000/60,1) I'm not very familiar with Arexx and I don't know if there's a way to format time, or a ready to use code or library without having to manually split the value etc. Any help? |
25 June 2016, 02:14 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,001
|
Code:
seconds = (total_ms + 500) % 1000 mm = seconds % 60 ss = seconds // 60 time = mm":"right(ss,2,'0') // is modulo |
25 June 2016, 13:15 | #3 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 667
|
Thanks! this works nicely! I just removed the addition of 500ms to the total because it made no sense to me.
|
25 June 2016, 15:31 | #4 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,001
|
|
25 June 2016, 19:14 | #5 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,304
|
Do you want to show us how do you calculate the total playing time of a OctaMED SoundStudio song? It would be nice to know if scanning of all pattern data is needed.
Usually I use the following to eliminate decimal digits from a given seconds value: Code:
s = (sec // 60) % 1 |
25 June 2016, 19:48 | #6 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 667
|
|
25 June 2016, 19:57 | #7 | |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 667
|
Quote:
So the script in pseudo code will: play the song cycle blocks in sequence allow a few ms to tpl commands to eventually get applied calculate lines ms accordingly to bpm and tpl add to a total finish cycle stop playing format the output show output I am quite satisfied with the resulting values, they quite match the real song playing time. I made a video also: [ Show youtube player ] if you want I can upload the script |
|
25 June 2016, 22:27 | #8 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,304
|
I guess for most mods it will work. Only on some mods with several/regular speed/tempo changes won`t taken into account. A play song in fast motion function would be nice.
|
26 June 2016, 09:06 | #9 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 667
|
yes and 90% of the mods you mentioned change TPL at every line to simulate quantize/shuffle therefore the final bpm are quite the same, so I suppose it would do a good job anyway
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AREXX Help | Zetr0 | support.Other | 2 | 26 January 2011 23:09 |
arexx help | jimbobrocks92 | Coders. General | 4 | 19 January 2011 12:50 |
Arexx | redblade | request.Apps | 2 | 30 August 2006 11:51 |
Arexx | Seti | Coders. General | 2 | 05 August 2003 18:59 |
|
|