반응형

파이썬 3

[Python] wav 파일 자르기

import wave # 원하는 시간 단위 (초) start = 1 # 시작 시간, seconds end = 300 # 끝나는 시간, seconds # file to extract the snippet from with wave.open('test.wav', "rb") as infile: # get file data nchannels = infile.getnchannels() sampwidth = infile.getsampwidth() framerate = infile.getframerate() # set position in wave to start of segment infile.setpos(int(start * framerate)) # extract data data = infile.readfram..

[Python] wav 파일 Speech-to-Text 파이썬 코드

import speech_recognition as sr r = sr.Recognizer() text = sr.AudioFile('Source.wav') with text as source: audio = r.record(source) print("Source:"+r.recognize_google(audio)) 5분 이상 되는 음원은 오류가 나는 것 같음. 음원을 자르는 파이썬 코드는 아래에 있음. https://hb2207.tistory.com/54 [Python] wav 파일 자르기 import wave # 원하는 시간 단위 (초) start = 1 # 시작 시간, seconds end = 300 # 끝나는 시간, seconds # file to extract the snippet from with ..