How to write a python program to convert speech into wav file
Prerequisites:
1. pip install pyaudio
2. pip install speechrecognition
Code:
import pyaudio
import wave
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "convertedTowavFile.wav"
paudio = pyaudio.PyAudio()
stream = paudio.open(format = FORMAT, channels = CHANNELS,
rate = RATE,
input = True,
frames_per_buffer = CHUNK)
print(".....Recording Started.....")
arrayFrames=[]
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
arrayFrames.append(data)
print(".....Recording Ended.....")
stream.stop_stream()
stream.close()
paudio.terminate()
waveform = wave.open(WAVE_OUTPUT_FILENAME,'wb')
waveform.setnchannels(CHANNELS)
waveform.setsampwidth(paudio.get_sample_size(FORMAT))
waveform.setframerate(RATE)
waveform.writeframes(b''.join(arrayFrames))
waveform.close()
Next Steps :
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists
► 1. Javascript - • Javascript Factory
► 2. Puppetter - • Puppeteer
► 3. Cypress - • Cypress
► 4. Tech works - • Video
► 5. Vbscript Basics To Advanced - • VBScript Part 1 - Features Advantage...
► 6. Jmeter - • Jmeter Tutorials
► 7. Excel - • Videos On Excel
► 8. Appium - • Appium
► 9. Shares - • Shares
► 10. Javascript Interview Questions - • Javascript Interview Questions
► 11. C# Tutorials - • C# Factory
► 12. HTML & CSS - • HTML & CSS
► 13. Browser Console - • Browser Console
► 14. JSON - • Videos on Json
► 15. Specflow - • Specflow Tutorials
► 16. MongoDB - • MongoDB Tutorials
► 17. Postman - • Postman
► 18. Python - • Python
► 19. Typescript - • Typescript & Node Imp Questions
► 20. Node - • Node
► 21. Java Selenium Interview Questions: • Java and Selenium Imp
► 22. Real Time Interview Q & A: • Real Time Interview Questions
► 23.SOAP UI Tutorials : • SOAP UI
► 24. WebDriverIO : • Getting Started with WebdriverIO | In...
► 25. Jenkins : • How to download and install Jenkins o...
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
#python
#speechrecognition
#sppechtowav
Смотрите видео How to write a python program to convert speech into wav file онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Azhar Techno Coder 08 Сентябрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 443 раз и оно понравилось 42 людям.