ggerganov / ggwave

Tiny data-over-sound library
https://youtu.be/Zcgf77T71QM
MIT License
1.9k stars 141 forks source link

ultrasonic sound in JavaScript #74

Open kaleemwaheed opened 1 year ago

kaleemwaheed commented 1 year ago

Can you guide me how to generate ultrasonic sound( not audible to human) in JavaScript and which parameter i have to change and save/download as a WAV file?

https://github.com/ggerganov/ggwave/tree/master/examples/ggwave-js

ggerganov commented 1 year ago

To generate Ultrasound messages you have to switch this parameter:

https://github.com/ggerganov/ggwave/blob/48830a1e18c5780f9c5cdac74230636c525ebccb/examples/ggwave-js/index-tmpl.html#L89-L91

to one of the following:

To save the sound into WAV file, checkout the following example:

https://github.com/ggerganov/ggwave/tree/master/examples/ggwave-to-file

For example:

# generate "Hello world!" message via  GGWAVE_PROTOCOL_ULTRASOUND_FAST and save it to "hello.wav":
curl -sS 'https://ggwave-to-file.ggerganov.com/?m=Hello%20world!' --output hello.wav

# playback:
ffplay hello.wav