-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from lavajuno/wav-io
Add .wav read/write functionality for Receiver and Transmitter
- Loading branch information
Showing
6 changed files
with
171 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from afskmodem import Receiver | ||
|
||
def main(): | ||
receiver = Receiver(1200) | ||
print("AFSKmodem File Read Demo") | ||
while(True): | ||
print("Enter path to file to read (ex. \"./myfile.wav\"):") | ||
rxData = receiver.read(input()) | ||
if(rxData == b""): | ||
print("Could not decode.") | ||
else: | ||
print("Transmission decoded:") | ||
print("") | ||
print(rxData.decode("utf-8", "ignore")) | ||
print("") | ||
print("Done. (CTRL-C to exit)") | ||
|
||
|
||
if(__name__ == "__main__"): | ||
try: | ||
main() | ||
except(KeyboardInterrupt): | ||
print("CTRL-C") | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from afskmodem import Transmitter | ||
|
||
def main(): | ||
transmitter = Transmitter(1200) | ||
print("AFSKmodem File Write Demo") | ||
while True: | ||
print("Enter message string (ASCII):") | ||
userMessage = input() | ||
print("Enter path to save file at (ex. \"./myfile.wav\"):") | ||
filename = input() | ||
print("Saving to file...") | ||
transmitter.write(userMessage.encode("ascii", "ignore"), filename) | ||
print("Done. (CTRL-C to exit)") | ||
print("") | ||
|
||
if(__name__ == "__main__"): | ||
try: | ||
main() | ||
except(KeyboardInterrupt): | ||
print("CTRL-C") | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters