Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Get peripherals
- local mic = peripheral.find("microphone")
- local speaker = peripheral.find("speaker")
- if not mic then
- print("No microphone found!")
- return
- end
- -- Check if voice chat is available
- print("Voice chat available: " .. tostring(mic.isVoiceChatAvailable()))
- -- Record some voice
- mic.startListening()
- mic.startRecording("test")
- print("Recording... speak now!")
- sleep(5)
- mic.stopRecording()
- mic.stopListening()
- -- Get recording info
- local info = mic.getRecordingInfo("test")
- if info then
- print("Recorded " .. info.size .. " bytes over " .. info.duration .. "ms")
- if info.size == 0 then
- print("WARNING: No audio data captured!")
- print("Make sure Simple Voice Chat is installed and you're speaking into your mic")
- end
- else
- print("Recording failed - no info available")
- end
Advertisement