mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-03-24 04:33:05 +08:00
25 lines
603 B
Python
25 lines
603 B
Python
import sys
|
|
import requests
|
|
|
|
def ggwave(message: str, protocolId: int = 1, sampleRate: int = 48000, volume: int = 50):
|
|
|
|
url = 'https://ggwave-to-file.ggerganov.com/'
|
|
|
|
params = {
|
|
'm': message, # message to encode
|
|
'p': protocolId, # transmission protocol to use
|
|
's': sampleRate, # output sample rate
|
|
'v': volume, # output volume
|
|
}
|
|
|
|
response = requests.get(url, params=params)
|
|
|
|
if response == '':
|
|
raise SyntaxError('Request failed')
|
|
|
|
return response
|
|
|
|
result = ggwave("Hello world!")
|
|
|
|
sys.stdout.buffer.write(result.content)
|