ElijahCrafter

Mic Test

Dec 2nd, 2025
93
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | Source Code | 0 0
  1. -- Get peripherals
  2. local mic = peripheral.find("microphone")
  3. local speaker = peripheral.find("speaker")
  4.  
  5. if not mic then
  6.     print("No microphone found!")
  7.     return
  8. end
  9.  
  10. -- Check if voice chat is available
  11. print("Voice chat available: " .. tostring(mic.isVoiceChatAvailable()))
  12.  
  13. -- Record some voice
  14. mic.startListening()
  15. mic.startRecording("test")
  16. print("Recording... speak now!")
  17. sleep(5)
  18. mic.stopRecording()
  19. mic.stopListening()
  20.  
  21. -- Get recording info
  22. local info = mic.getRecordingInfo("test")
  23. if info then
  24.     print("Recorded " .. info.size .. " bytes over " .. info.duration .. "ms")
  25.     if info.size == 0 then
  26.         print("WARNING: No audio data captured!")
  27.         print("Make sure Simple Voice Chat is installed and you're speaking into your mic")
  28.     end
  29. else
  30.     print("Recording failed - no info available")
  31. end
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment