# gTTS : Google Text to Speech API : Google에서 제공하는 TTS 서비스. gTTS라는 모듈을 인스톨해야 함
"""
'en'으로 지정했을 때 한글이 text에 포함되어 있으면 이를 무시하지만, 'ko'일때 text내의 영문은 무시되지 않고 음성합성을 수행한다(아주 이상함)
영어는 여자 성우, 한글은 남자 성우이다(변경 불가능)
"""
from gtts import gTTS
import pygame
import time
text ="안녕하세요, 여러분. 파이썬으로 노는 것은 재미있습니다!!!"
tts = gTTS(text=text, lang='ko')
tts.save("helloKO.mp3")
# Initialize Pygame mixer
pygame.mixer.init()
# Load the audio file
pygame.mixer.music.load("helloKO.mp3")
# Play the audio file
pygame.mixer.music.play()
# Allow time for the audio to play
time.sleep(10)
# Stop the playback
pygame.mixer.music.stop()
Text to Speech (TTS) library for Python 2 and 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak.
pip install pyttsx3
Project description
pyttsx3is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.
Installation
pip install pyttsx3
If you recieve errors such asNo module named win32com.client,No module named win32, orNo module named win32api, you will need to additionally installpypiwin32.
Usage :
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
Changing Voice , Rate and Volume :
import pyttsx3
engine = pyttsx3.init() # object creation
""" RATE"""
rate = engine.getProperty('rate') # getting details of current speaking rate
print (rate) #printing current voice rate
engine.setProperty('rate', 125) # setting up new voice rate
"""VOLUME"""
volume = engine.getProperty('volume') #getting to know current volume level (min=0 and max=1)
print (volume) #printing current volume level
engine.setProperty('volume',1.0) # setting up volume level between 0 and 1
"""VOICE"""
voices = engine.getProperty('voices') #getting details of current voice
#engine.setProperty('voice', voices[0].id) #changing index, changes voices. o for male
engine.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female
engine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.runAndWait()
engine.stop()
"""Saving Voice to a file"""
# On linux make sure that 'espeak' and 'ffmpeg' are installed
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()
인공지능(AI) 시대 필수 인프라로 꼽히는 데이터센터가 ‘굶주린 짐승’처럼 전기와 물을 먹어치우면서 각국 정부와 기업들이 골머리를 앓고 있습니다. 데이터센터에서 물과 전기 사용량을 줄이기 위해 당국이 규제 강도를 높이자 기업들은 기술 개발에 나서는 등 대책 마련에 분주합니다.
네이버 데이터센터 내 '서버룸'. 수많은 서버를 보관하는 공간 (네이버 제공) /뉴스1
최근 생성형 AI 열풍이 불면서 AI 학습과 서비스에 필요한 데이터센터가 세계 곳곳에서 건설되고 있습니다. 현재 8000개에 달하는 데이터센터가 운영 중입니다. 문제는 데이터센터에서 발생하는 열을 식히기 위해 엄청난 양의 물이 필요하다는 겁니다. 2022년 데이터센터 유지를 위해 마이크로소프트(MS)는 물 사용량을 전년보다 34%, 구글은 22% 늘렸습니다. 2027년에는 세계 데이터센터 물 소비량이 영국의 한 해 물 소비량의 절반에 해당할 것이란 전망도 나왔습니다. 특히 AI 데이터센터는 일반 데이터센터보다 배 이상 전력을 소모하기 때문에 국가 전력망에도 큰 부담을 줍니다.
칠레 환경 법원은 구글의 데이터센터 건설 허가를 일부 취소하며, 구글에 서버 냉각 시스템 변경을 요청했습니다. 아일랜드 더블린 시 당국은 지난해 신규 데이터센터 건설 프로젝트를 거부했고, 미국 버지니아주와 독일은 최근 주거 지역 인근에 데이터센터 허가를 제한하고 재생 에너지 사용과 폐열 재사용을 요구하고 있습니다. 극심한 가뭄을 겪고 있는 우루과이에서는 구글의 신규 데이터센터 건설을 두고 주민들이 거세게 반발하고 있습니다. 기업들은 전력 효율을 높일 시스템을 도입하고 물을 재사용하는 방식으로 대처하고 있습니다. 24시간 운영 가능한 소형 모듈 원자로(SMR)까지 대안으로 거론되고 있습니다.
산업통상자원부에 따르면 국내 데이터센터 전력 수요는 2022년 1762MW(메가와트)에서 2029년 4만9397MW로 폭증할 전망입니다. 한국도 몇 년 내에 데이터센터발 물 부족과 전력망 문제를 겪게 될 수도 있다는 뜻입니다. 각국의 사례를 반면교사 삼아 미리 대비해야 데이터센터가 한국의 AI 경쟁력을 발목 잡는 일을 막을 수 있을 것 같습니다.