mirror of
https://github.com/dnet/pySSTV.git
synced 2025-12-06 07:12:00 +01:00
added get_floats example
This commit is contained in:
parent
0e0a56161a
commit
8262a72629
23
pysstv/examples/get_floats.py
Normal file
23
pysstv/examples/get_floats.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
This example streams the raw floating point samples to stdout in 4-byte
|
||||
single precision format, so that it can be processed outside PySSTV.
|
||||
|
||||
Usage example: get_floats.py | play -r 44100 -t f32 -c 1 --norm -
|
||||
"""
|
||||
|
||||
from pysstv.sstv import SSTV
|
||||
from PIL import Image
|
||||
from pysstv.grayscale import Robot8BW
|
||||
import struct, sys
|
||||
|
||||
def main():
|
||||
img = Image.open("160x120bw.png")
|
||||
sstv = Robot8BW(img, 44100, 16)
|
||||
sstv.vox_enabled = True
|
||||
for value in sstv.gen_values():
|
||||
sys.stdout.write(struct.pack('f', value))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Reference in a new issue