Circular Audio Progress bar

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 12:00 pm

"Circular Audio Progress bar" is a funny title, as a Progress bar is never circular.

So, "Suffer for it!":
-
Counter3.png
Attachments
COUNTER 2.livecode.zip
Here's the stack.
(67.31 KiB) Downloaded 295 times

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Circular Audio Progress bar

Post by [-hh] » Wed Oct 02, 2019 1:37 pm

Richmond wrote:You'll take the LCB road and I'll take the LC road, And I'll get my stack finished afore you.
Great words, but where is the audio part of your answer?
You didn't even notice that my solution above is pure LC Script.

So, what is your problem?
shiftLock happens

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 1:53 pm

So what is your problem?
Aha: so you're a qualified psychiatrist as well. :D

My "only" problem is that the circular progress "bar" is so simple
I wondered why it had to be delivered as a widget,
therefore making it more difficult for people to modify.

Yes! The "audio bit" is missing . . .

But. presumably this progress "thing" is meant to be used while
an audio files launches, so that "bit" should be elementary.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 1:56 pm

It basically just fills the color of the stroke of the circle in sync with the audio playback time.
Aha: so it has to be synced with the length of the audio file. :D

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Circular Audio Progress bar

Post by [-hh] » Wed Oct 02, 2019 2:04 pm

The OP wrote:
How do you connect this to an audio timeframe?
"While an audio file launches" shows always a progress of 0%. And the length of the audio file shows always 100%.
Really simple, no "progress" needed.
So finish your stack and show him that elementary thing, in LC Script. Move a player's slider and buttons and show that with your simple progress. My solution above does that, in LC Script, even creates the "progress" display by script, no LCB/widget needed.
shiftLock happens

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 2:36 pm

The last time I worked with audio in LIveCode it was called Runtime Revolution, in 2002, and was dependent on Quicktime,
so I will leave the "audio bit" to someone who is a 'twitch' more up to date re audio in LIveCode .
-
RR.jpg
RR.jpg (6.23 KiB) Viewed 8941 times

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Circular Audio Progress bar

Post by [-hh] » Wed Oct 02, 2019 2:54 pm

I used the player object not yet in LC 9, so detected now a small bug with it in LC 9 (return sometimes a currentTime > duration). Edited my solution above by a 'work around'.
@Richmond.
Anyway, now we know your problem: Answering the trivial part of a question only and at the same time judging other (full) answers as "complicated" ...
shiftLock happens

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 3:09 pm

Answering the trivial part of a question only and at the same time judging other (full) answers as "complicated" ...
OK, OK; you got me there: and I do apologise. :(

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Circular Audio Progress bar

Post by [-hh] » Wed Oct 02, 2019 3:31 pm

Never mind. Often you are right when simplifying complicated things. (But not always.)
shiftLock happens

dpalmersce@gmail.com
Posts: 25
Joined: Wed Aug 28, 2019 4:58 pm

Re: Circular Audio Progress bar

Post by dpalmersce@gmail.com » Wed Oct 02, 2019 4:22 pm

WOW! This is the best forum I have been part of! Thank you very much for all your help! I hope I get to the point that I can contribute to help people, too! I am a long time Adobe(wished it had still been Macromedia) Director. Livecode is very similar but still enough differences that it takes me a little bit to delete the Director knowledge and think in the way Livecode expects it. Thank you again so much for the help!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 7:31 pm

So: how does one find the length of an audioClip programmatically?
-
Screenshot 2019-10-02 at 21.41.11.png
Screenshot 2019-10-02 at 21.41.11.png (13.89 KiB) Viewed 8875 times
-
You can get the duration of a player . . .
Last edited by richmond62 on Wed Oct 02, 2019 7:41 pm, edited 1 time in total.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Circular Audio Progress bar

Post by Klaus » Wed Oct 02, 2019 7:41 pm

I'm afraid we can't!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 7:49 pm

That's "a pity" . . .

OK: so, having done this:

Code: Select all

put the duration of player "wazoo"
and got: 119808

and having done this:

Code: Select all

put the timescale of player "wazoo"
and got: 48000

and reading this:
The timeScale is the number of intervals per second of a movie or sound.
These intervals are used for the player's startTime, endTime, duration, and currentTime properties,
and you can use the timeScale property to convert from the time scale used by the movie or sound to seconds.
The inevitable Q has got to be how to use those 2 numbers to work out ticks for a progress bar/circle.

The Happy MacOS 'get info' thing states that my a55.aiff file has a duration of 2 seconds,
but 119808 / 48000 gives me 2.496

Of course MacOS could be rounding down, or 2.496 could mean something else.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 8:05 pm

Blast!
-
Screenshot 2019-10-02 at 22.01.42.png
-

Code: Select all

on mouseUp
   put the duration of player "wazoo" into DURANCE
   put the timescale of player "wazoo" into TS
   put ((DURANCE / TS) * 60) into TIX
   put (TIX/360) into DIVZ
   -----
   play player "wazoo"
   set the startAngle of grc "CRUNCH" to 0
   put 0 into DEG
   repeat until DEG > 360
      set the arcangle of grc "CRUNCH" to DEG
      set the label of grc "MASK" to DEG
      add 1 to DEG
      wait DIVZ ticks with messages
   end repeat
   -----
end mouseUp
The sound file finishes while the progress graphic is about half complete:
probably because LiveCode does not like. wait 0.416 ticks

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Circular Audio Progress bar

Post by richmond62 » Wed Oct 02, 2019 8:15 pm

I'm afraid we can't!
I really hate that word 'can't'!

And we can:

Code: Select all

on mouseUp
   put the size of audioClip "a55.aiff" into SZ
   put (SZ / 4)
end mouseUp
gave me exactly the same value as the duration of a player
linked to an external instance of the sound file 'a55.aiff'.
Last edited by richmond62 on Wed Oct 02, 2019 8:23 pm, edited 1 time in total.

Post Reply

Return to “Multimedia”