Skip to content

نشاط

Funny voice recorder

متوسط | MakeCode | Audio recording, الصوت, الميكروفون, مكبّر الصوت | Pitch, الأجهزة والبرمجيات, الصوت, المدخلات/المخرجات

الخطوة 1: اصنعها

ماذا يعني؟

Record your voice using the BBC micro:bit’s microphone and play it back speeded up – or slowed down.

مقدمة

دليل البرمجة

كيف تستخدمه؟

Put the code below on a micro:bit. Press button A and speak into the microphone. A square appears on the LED display while it’s recording.

Press button B to play back the recorded sound. It plays back twice as fast, making your voice speed up and sound squeaky!

كيف يعمل ؟

The code sets the sample rate to 10,000 Hertz (Hz) for recording. This means the micro:bit measures, or samples, sound from the microphone 10,000 times every second.

When it plays it back, it plays back the samples twice as quickly, 20,000 times every second. This means it plays back twice as fast, and doubles the pitch of any sounds it recorded.

Recording a new sound will delete your previous recording, as will pressing the reset button on the back, or unplugging the micro:bit from its power source (USB or battery pack).

ما تحتاجه

  • micro:bit V2
  • محرر MakeCode
  • optional: crocodile clip leads and headphones, or an amplified speaker, to increase the volume and quality of the sound

الخطوة 2: برمجها

الخطوة 3: حسّنها

  • Change ‘on button B pressed’ to ‘on shake’ – then you can record a sound and put the micro:bit with something you want to protect. It’ll play back your recording when it’s picked up!
  • Change the playback sample rate number in the button B block: bigger numbers will make it play back faster, and make the pitch higher. Lower numbers will slow down the sound and make the pitch lower.
  • Experiment with different recording sample rates: recording at lower sample rates will allow you to make longer recordings, but the quality will be worse. Higher recording sample rates mean you can only make shorter recordings, but the quality will be better.
  • Attach headphones or an amplified speaker to pins 0 and GND to improve the quality of the sound that’s played back.