How to manipulate audio position

Hmm… something off in terms of your calculations then. You can post a screenshot of your blocks or PM me with a link to your project and I’ll see if I can figure out why.

On a related note: does anyone know how to record a sound and stop recording using the new drag-and-drop interface? :face_with_raised_eyebrow:

2 Likes

This is my code:

1 Like

You’re using [app variable end seconds since 1970]. Did you mean to do that? I suggested you use [app variable start seconds since 1970].

2 Likes

Oh my bad! I duplicated a end variable block and forgot to change the name😀

1 Like

A quick way to test this is to set a label to the value of [app variable time]. Then see if you get the expected value. For example, if you recorded for 15.59, you’d expect to get back 15.591274857134 or 15 if you’re rounding. If you’re rounding to the nearest second, add the [round] block that I have in my second screenshot.

2 Likes

Is this supposed to happen?
image

1 Like

You’ll have to decide how much to round your duration. See the comment I made just above about rounding.

2 Likes

Thanks, testing that right now. When I tried it again, I got 1:14, which seems correct(didn’t use the phone’s timer).

1 Like

This was a very informative discussion.

I wanted to see if anyone knows if it’s possible to move to a different part of a song, by moving the slider? i.e. to rewind, fast forward by dragging the slider left and right.

I’ve been able to rig up a super basic progress bar which moves as the song progresses, but I want the user to be able to manipulate the position of the song.

Here’s my project.
https://x.thunkable.com/copy/b233b14e33703e55ade7db7d723bf9ad

I would so dealy love to be able to make this work, I’ve been trying to figure this out for many months!!

TIA

3 Likes

I’m still trying to figure that out. I’ve also made a progress bar that displays elapsed time but am unable to find a way to shift audio position.
You’re project link isn’t working; would it be possible for your to share the project page?

3 Likes

https://x.thunkable.com/copy/8d73b5e6b66cbe2a135d4af5af0a1c40

Hi codeswept, see if that link works?

Hmmm yeah I don’t know if it’s possible on Thunkable?
I had a bit of a muckaround in AppGuyver and was able to get it working there, but would prefer to use Thunkable if I can!

The other thing I tried was using a webviewer and hosting the song on my Wix website which has an audio player. But the sizing going between iPad and phone seemed impossible, and I’d prefer for this to work offline.

3 Likes

Using JavaScript you can synchronize a progress bar with a song file but this means using Web Viewer not direct Thunkable components.

2 Likes

Thanks muneer.

I pretty much know nothing about JavaScript. Do you think it’s worth learning?

4 Likes

Absolutely!!! Js + Thunkable is an awesome combo

2 Likes

Awesome :slight_smile:

Any recommendations of how to get started?

2 Likes

Both Thunkable and AppGyver are built on React Native which is built on JavaScript.

2 Likes

Hi codeswept,

I was wondering if you had any luck finding a way to shift audio position with a progress bar (slider)?

Cheers

1 Like

I’ve pretty much given up hope by now :pensive: I’ve tried, like @muneer suggested counting the recording time but that still doesn’t allow me to change position in audio.

@carlinmclellan @codeswept

I had an idea. You can upload a song to YouTube Music and then use time parameters in the url to determine the starting point. For example, I added &t=46s to the end of this url to make it start at the 0:46 mark:

https://music.youtube.com/watch?v=cIOsuEy-QuY&list=MLPT&t=46s

But currently that song is private in my account. I’m not sure how to set it to public. But if it was possible – and it’s definitely possible with YouTube videos – you could theoretically move a slider in Thunkable and have the app reload the sound at the desired position using url parameters.

1 Like

Okay, I didn’t have much luck with that. For some reason, uploaded songs are not available to the public.

But I do have an example that offers one way of having a slider for playback. It’s just not customizable. If you add a Web Viewer and set the url to a YouTube Music song that is commercially available (e.g. this Chris Pureka song url which I’ve set to start at 0:46 → YouTube Music), when you press play (requires Thunkable Live), it opens a full-screen viewer at least on an iPhone and it includes a slider:

I know this doesn’t solve the problem but it might be a step closer…?

As another example, I figured out how to move a slider to load a song url at various points on its timeline:

Try it yourself at Thunkable
(See the screen with @codeswept’s username)

The only problem now is that you have to press play each time the song reloads. Also, I had to hard code the length of the song (242 seconds).

Soundcloud urls work similarly (except that the timestamp is formatted as #t=46s) but the web viewer isn’t as user-friendly as with YouTube Music and it doesn’t seem to respect the timestamp value.

2 Likes