From 761c4c7641d16901a1e97d14ff63280060abe5f3 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 10 Jan 2021 15:55:49 +0200 Subject: [PATCH] ggwave-to-file : update python example --- examples/ggwave-to-file/README.md | 6 ++++-- examples/ggwave-to-file/ggwave-to-file.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/ggwave-to-file/README.md b/examples/ggwave-to-file/README.md index e432961..b82f7ff 100644 --- a/examples/ggwave-to-file/README.md +++ b/examples/ggwave-to-file/README.md @@ -30,7 +30,7 @@ Usage: ./bin/ggwave-to-file [-vN] [-sN] [-pN] ```bash echo "Hello world!" | ./bin/ggwave-to-file -s24000 > example.wav ``` - + - Generate ultrasound waveform using the `[U] Fast` protocol ```bash @@ -61,13 +61,15 @@ https://ggwave-to-file.ggerganov.com/?m=Hello%20world%21 ```python import requests -def ggwave(message: str, protocolId: int = 1): +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) diff --git a/examples/ggwave-to-file/ggwave-to-file.py b/examples/ggwave-to-file/ggwave-to-file.py index f795ac8..32442f5 100644 --- a/examples/ggwave-to-file/ggwave-to-file.py +++ b/examples/ggwave-to-file/ggwave-to-file.py @@ -1,13 +1,15 @@ import sys import requests -def ggwave(message: str, protocolId: int = 1): +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)