SynthMaker

Time format: Seconds to Hours:min:sec display

Archive · 2011 17 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

tektoog ·

Hello, Does someone append to have such a module in his own collection? Something that converts long sample length in sec to a more readable format... Most of the modules out there read something like 2:71...which is 3min11s... I thought it would be quite simple to build, but I'm finding out that this involves quite some maths...which I suck at... Any help would be really appreciated !!!

Dozius ·

I threw this together in a hurry as an example for someone on the IL forums.

One module does mmm:ss:zzz One module does bbb:ee

m = minutes s = seconds z = ms b = bars e =beats

Should be a good place to start anyways.

tektoog ·

Hey, Thx Dozius, I was surprised to see some blue cables in that !!! In fact I was expecting something more in the green math logic, in particular what is the formula to add the reminder after the base of 60s(1mn) Like 156sec=2mins and 36sec so the formula goes like 156/60=2.6 so How to convert the 0.6 to the expected 36 secs This is where I'm at...(not very far I'm afraid !!): Thanks for your time !

tektoog ·

Ok, I'm getting closer:

If you type 12 sec it is fine..but if you type in 13 sec...then it goes all weird... Why?

Neptune ·

Check this one if it fits to your need.

Cheers, Neptune

tektoog ·

Yeah man !!! That's perfect !!! exactly what I wanted !!! Sweet!! You saved me quite some brain damage... and quite some time too !! Thanks a lot ! Cheers !

tektoog ·

I couldn't resist to finish the one I started... I used your logic to implement the zero digit when number is below 10... Thanks a lot for sharing...

I entered 889955 secs in both projects...and both went crazy... But it will be good enough for now as most recordings don't exceed 24 hours... Cheers

Dozius ·

tektoog wrote: Hey, Thx Dozius, I was surprised to see some blue cables in that !!!

It's because the example was used to show song duration based on the hosts playback position and as such based off the sample position primitive. I could have converted sample position into green right away and did all the math there, but like I said, I did it in a hurry and it's quicker to play around in code than in green.

Neptune ·

tektoog wrote: I entered 889955 secs in both projects...and both went crazy... But it will be good enough for now as most recordings don't exceed 24 hours... Cheers

Its due to your string split inside the hours module.

You can easily fix this by adding a selector for the split position.

If (seconds/3600) >= 100 then Split position = 3;

tektoog ·

Hey Neptune, Thanks for your tip! ... and your help in general ! To solve it in another way, I added days to the formula... In case someone wants to make a 4 days long recording !!!

And here is a adapted module to just put on the wave Player output... It displays the file tempo and its length, without showing a wav of 2min71sec!!! 🙂

Cheers

oddson ·

Modulus Divide and Format String primitives can greatly simplify this task

oddson ·

Strange... the Edit Box used for display isn't working correctly.

When I type 15989 in the formatted string is from the hours calculation is correctly showing as "04:" but it's displaying as "00:"

Curious.

infuzion ·

oddson wrote: Strange... the Edit Box used for display isn't working correctly. When I type 15989 in the formatted string is from the hours calculation is correctly showing as "04:" but it's displaying as "00:"

Seems to work fine for me. BTW, when there needs to be an inline "Float" primitive to translate the format, sometimes it is best to make that part a module & make the outputs Float.

Thanks for the Modulus Divide tip, & nice to see you back!

oddson ·

What happened to the rest of this thread?

BTW = there are number of shortcomings of the Format String primitive which relate to its history as a slap-dash solution to a problem I was having years ago... they never really made it ready for prime time.

The other issue is that it will crash if certain errors exist in the format string.

There was (is?) still a problem with the Edit Box when used as a display (the Label module would have made more sense but I was copying an existing module from one of the other posters.

...and I'm not back... I never left. I just don't come round as much.

cyto ·

oddson wrote: Strange... the Edit Box used for display isn't working correctly.

When I type 15989 in the formatted string is from the hours calculation is correctly showing as "04:" but it's displaying as "00:"

Curious.

Seems to be a triggering problem. Adding a "sample and hold" primitive in the display edit box seems to do the trick...

-cyto

tektoog ·

oddson wrote: Modulus Divide and Format String primitives can greatly simplify this task

Hehe... nice optimization! Like I said in my first post, I suck at maths...I was already quite happy to get it to work...

oddson wrote: What happened to the rest of this thread?

??? what do you mean?

oddson ·

tektoog wrote: ...

oddson wrote: What happened to the rest of this thread?

??? what do you mean?

😊 I followed a link from infuzion back to this thread... he used 'start=10' instead of an anchor link and it made me think the thread had been chopped up by a moderator.

@cyto Nice fix... still implies a minor bug with the edit box primitive as it does some funky stuff. But then I don't think it was ever meant to be used as a label which is what's happening here. But the Sample and Hold still makes sense anyway as there's no point updating the display three times as each of the three component strings are sent to it. Better to trigger after the 'seconds' string is done.

The stock Label module with a string input added would be more appropriate.

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.