Recording audio into a variable during runtime


#1

Hi there,

i have successfully recorded audio with my mBot2 / CyberPi but would like to know if I can assign this recording to a variable.

This way I could record more than one file and also access all these recordings in the rest of my program. For example, I would like to play back different recordings by pointing the joystick in different directions.

thank you


#2

Hi oscarthewhiz,

It is not possible. There is a user who made the same request on the forum and Makeblock’s response was not positive.

However, I would have the same need.


#3

yeah, it’s a weird limitation given that Scratch seems to support the functionality in Sprites / UI mode (i.e. not through coding)
Would love to see this added!

At the moment ‘recorded’ seems to be kind of a singular session variable that is available throughout the scope of an entire program but can’t be saved separately. So ‘recorded’ can be manipulated (speed, volume) from other events in a Scratch, say, tilting of the CyberPi.


#4

Hi,
I suggest you give a look at the mbuild speaker extension.
it as a internal memory and is able to play mp3.

I did some test, it works fine, unless a bit latency.


#5

actually it’s possible, mblock as hidden thing like from global_objects import mic_o,mp3_music_o that allow to: mp3_music_o.play_raw_data(data, 16000) and record_data = mic_o.get_recording_data(1)[1]
also take a look at this script: https://www.yuque.com/makeblock-help-center-en/cyberpi-api/walkie-talkie#OhOcC


#6

Very cool @Idaill! Someone should make an extension for this…