Audio Recording using Sound blocks - help

What I found was “start audio recording” was just exiting even though I had not pressed the “stop” button. Question is how do I point the file to which the recording should be saved? I have both the Firebase and Cloudinary setup, was hoping to find a way to configure the Sound(wav) file to point to one of them. I have tried all possible combination. Any pointers would be much appreciated.
There is a nice tutorial Sound Playback in Thunkable Drag and Drop UI - YouTube on using all the Sound Blocks except the two I want “start audio recording” and “sound file from stopped audio recording”. The lady in the tutorial says the follow on video has the Recorder part but then Murphy comes in and that video link she gives is broken :frowning: Thanks

Ok I have been working on this elusive over a week. I could not share the link because I get this error:
“Sorry, we were unable to generate a preview for this web page, because the following oEmbed / OpenGraph tags could not be found: description, image”

So here is the image


This works once in a while. The problem is sometime in the Timer1 block the execution does not reach the block set “TimerLbl Visible to false” It just gets stuck there.

1 Like

I’m also really struggling with Audio recording and getting it to connect to files. My bigger issue is that right now I can’t even find the ‘Timed Recording’ block. I have a ‘Start Audio Recording’ block but no timed recording. Is this a versioning thing? Honestly, documentation for Thunkable needs a big upgrade!

Hi Nathan,
I am 100% with you, the document is very rudimentary. No wonder I did not get a single response :grinning:. I have been working on this for the past 1 week or more finally figured it out.
https://x.thunkable.com/copy/e3d66c44d17ab5f7d11a9a7222eedcb3
Here is the link to the fully working app. Please copy it and save it as I am still working on it. One part is still not done is saving it to Cloudinary. Once that happens then I am all done. Will do it this week. Then one again share the full app. For now I will put the full snap shot also for posterity when the above link is gone


I have put some comments too. Only thing you should remember to do is
Advanced Blocks:
You can right-click any block to show an advanced version of the block. Good luck.

2 Likes

Love it! Thanks so much for replying and posting the link. One question - where can I find that timed recording purple block? It’s not in my list.

I was about to just give up on it to be honest and go a work in FlutterFlow (steeper learning curve but more support). Shame, as I like the click together nature of Thunkable but a lot of the videos seem to pertain to the old version with invisible controls and such which means half the user content is out of date.

" but a lot of the videos seem to pertain to the old version with invisible controls"
Exactly was my problem too. Not a single video for the current version!!
The way to back trace any advance block is to right click and go to “Show regular block” in the timed one it is “sound file from X sound recording”. I agree it is not obvious :grinning:. Glad my app was helpful to you

1 Like

Aaaacch! Thank you. I never would have got that. The ‘Sound file from X recording’ is a different shape so I never would have thought that was the simple version of the advanced block I needed.

hmm much UI work required but it could be SO good and much simpler than FlutterFlow for users starting out like me.

Thanks again!

So, after some tinkering, this works:

Strangely, if I turn the stop recording block into and advanced block and add in error handling, it stops working. I now also need to either export this audio file to an external source for data treatment or send it directly to an API next.

1 Like

Fantastic, right now I am working on doing exactly what you are doing and I am 90% done. I am using Cloudinary for that. So hold on will get back on full solution ASAP. I will also try to duplicate the issue you are facing and see what might be the reason behind the strange behaviors you are seeing. One of these days we will figure it out :grinning:

1 Like

Your error handling isn’t quite right. Typically, you’d put the timed recording block inside an else section so that it only happens if there is no error. Same goes for the sound file from 5 second recording block.

If you’d like help with the advanced version of the block(s), post a screenshot of how you set them up and I can advise.

2 Likes

Ah amazing - yeh that makes perfect sense! Thanks :slight_smile:

My issue with the advanced version of the blocks was just finding the timed recording block as it’s not the same same as the simple version of the block it originates from. So I was really struggling to find it.

From my experiments I have discovered the following truth of the Sound blocks, it is stranger than fiction!!

Start Audio Recording(SAR) block starts recording the moment it is executed. Timed Recording Number of Seconds(TRNoS) block has the Number of Seconds(NoS) as its input slot(Set to 0 now). In this context the recording will start right away no starting delay. Sound File From x Second Recording(SFFxSR) block has a value of x and that determines the recording time!! Totally convoluted!! In this case the “audio file” and the SFFxSR generated files do not match. “audio file” is not usable.
No it is not all done it even stranger.

image

The above block also works perfectly however in this case NoS which is set to 5 is the duration of the recording not the starting delay as in the previous case.

One more tidbit is the audio file is local to the TRNoS block. I could put the (Play <= audio file) block in the do slot of TRNoS and it worked. However when I put the (Play <= audio file) block outside TRNoS block it did not work.
My guess and hope is I will be able to save the “audio file” to Cloudinary and later play it.

1 Like

According to the documentation, the sound file from 5 second recording block should start immediately and record sound for 5 seconds. The timed recording number of seconds block is just the advanced form of that block. It should do the exact same thing. The only difference, really, is that it includes an error block.

The start audio recording block immediately starts an untimed (endless, requiring you to stop it manually) sound recording. It should be used with the stop audio recording block but not with any other sound blocks. The stop audio recording block should not be used with any other sound blocks.

I would not put a timed recording number of seconds block inside of a start audio recording block. That’s redundant and will be unpredictable because you’re asking Thunkable to start two recordings at almost exactly the same time.

You then have the sound file from 5 second recording inside of the timed recording number of seconds block. Again, redundant and unpredictable. You’re asking Thunkable to start three recordings at almost exactly the same time.

Your algorithm is basically this: start recording → if not error → start timed recording → if not error → record for 5 seconds

Please try using just one sound recording block at a time and report your results.

I will say this: the documentation is quite misleading! It shows functions that look like normal Thunkable blocks:

Screen Shot 2023-01-24 at 4.24.38 PM

1 Like

Hi Tatiang,
Our problem is the current version of the Thunkable I am running does not have Audio_Recorder OR I am unable to locate it. Please comment. Hence I was forced to us Sound blocks. There are plenty of video’s on how to use Audio_Recorder but not a single on using Sound Blocks.
image
Thanks for the indepth explanation.

That’s an Any Component block. You shouldn’t be using that for sound.

Are you using the Drag & Drop interface or Snap to Place interface? If you’re not sure, post a screenshot of the Design or Blocks tab from your project.

Can you clarify: are you trying to record untimed audio or timed audio? And I don’t mean with a Timer… I mean that the recording has a defined stopping point such as 5 seconds after it starts.

Edit: I took this screenshot from the project you posted a link to above. It’s the Drag & Drop editor. So you should be using the sound blocks to record audio. Please try using ONE block at a time and if you have problems, post a screenshot of what you tried.

1 Like

Okay, I think I see an issue here. The stop block is used to stop audio playback. It’s not for audio recording.

So you can either start a timed recording or you can start an untimed recording. I think – it’s not mentioned in the documentation – that the untimed recording (using the start audio recording) block will stop when there is not sound for a few seconds. Then the file that was recorded is stored in the sound file from stopped audio recording block.

I thought this would be pretty simple but this demo I made for you doesn’t play back any sound on my iPhone 13 Pro in Thunkable Live:

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

I can play back an uploaded sound but the volume is really low. At full iPhone volume, it’s about 50 decibels.* See this version: Thunkable. @conroy I have been seeing this same issue with text-to-speech from the Google Cloud Voice API. I thought maybe it was the API but I think it’s a volume setting in Thunkable Live.

*Full volume on an iPhone 13 Pro has been measured at 105 decibels.

1 Like

That info on “stop” was the crucial one. Thanks a lot. I have mine fully working only the last bit is left to be solved that is storing the audio file in Cloudinary and replay it. Once I am all done with that will post my final one. As you say the documentation needs lot of changes and quite mileading.

1 Like

@conroy and @anandavardhana57zwwl Here’s a cleaned up version with better error handling:

https://x.thunkable.com/copy/1ec902656a021461e9911bb4bb22c1cb

This version does work for timed recordings. But it does not work for untimed recordings (no message or error message appears inside the if [error] block:

Edit: Ugh. I hate inconsistent results for the same blocks. Okay, here’s the thing… sometimes it does get to the if [error] block. When it does, it fails by immediately stopping the audio recording a split second after it begins. In that case, I do see “Recorded (untimed)”.

I’ve reported the failed audio recording bug here: Untimed sound recording does not work · Issue #1238 · thunkable/thunkable-issues · GitHub

And reported the playback volume bug here: Sound playback volume is inconsistent · Issue #1239 · thunkable/thunkable-issues · GitHub

2 Likes

Oh wow - that makes a LOT more sense. Thanks! My code is now a fraction of the size it was. I now just need to work out how to send that audio file direct to an API… which should be interesting.

I’m thinking Thunkable just needs to train a GPT on this forum as documentation is the thing which is holding the product back. Thanks for your help on this!

2 Likes

Preach! Just takes a lot of time to aggregate data. It really can be used for this type of task tho!