diff --git a/.gitignore b/.gitignore index 2c906cc..4c354d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ venv/* -.venv \ No newline at end of file +.venv +__pycache__ +*/__pycache__ +*.btsnoop \ No newline at end of file diff --git a/apps/bap_unicast_client.py b/apps/bap_unicast_client.py index c8bab25..a0ddf6f 100644 --- a/apps/bap_unicast_client.py +++ b/apps/bap_unicast_client.py @@ -1,6 +1,7 @@ from scipy import signal import numpy as np import argparse +import json from bumble.profiles.bap import ( AudioLocation, @@ -353,7 +354,7 @@ async def main() -> None: parser = argparse.ArgumentParser( description="A simple example of argparse") parser.add_argument("-c", "--config", type=str, - default="device.json", help="device config file") + default="", help="device config file") parser.add_argument( "-p", "--port", help="com port (e.g. serial:/dev/ttyUSB0)") parser.add_argument("-s", "--sample_rate", type=int, @@ -389,6 +390,19 @@ async def main() -> None: app_specific_codec.octets_per_codec_frame = 120 else: raise ValueError("unknown sample rate") + + dev_config = args.config + if not dev_config or dev_config == "": + # Define the data as a Python dictionary + config_data = { + "name": "Unicast Client", + "address": "C0:98:E5:49:00:00" + } + + # Write the data to a JSON file + dev_config = "device.json" + with open(dev_config, "w") as outfile: + json.dump(config_data, outfile, indent=4) # Indent for better readability print(f"sample rate: {app_specific_codec.sampling_frequency.hz} Hz") print(f"frame duration: {app_specific_codec.frame_duration.us} us") @@ -398,7 +412,7 @@ async def main() -> None: # Create a device to manage the host, with a custom listener device = Device.from_config_file_with_hci( - args.config, hci_transport.source, hci_transport.sink + dev_config, hci_transport.source, hci_transport.sink ) # Connect to diff --git a/apps/device.json b/apps/device.json deleted file mode 100644 index 05a33f0..0000000 --- a/apps/device.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Unicast Client", - "address": "C0:98:E5:49:00:00" -} \ No newline at end of file diff --git a/leaudio/__pycache__/__init__.cpython-312.pyc b/leaudio/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 47a5906..0000000 Binary files a/leaudio/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/sounds/test1.wav b/sounds/test1.wav index 22846d6..da4a30a 100644 Binary files a/sounds/test1.wav and b/sounds/test1.wav differ diff --git a/sounds/test2.wav b/sounds/test2.wav new file mode 100644 index 0000000..d067d24 Binary files /dev/null and b/sounds/test2.wav differ diff --git a/sounds/test3.wav b/sounds/test3.wav new file mode 100644 index 0000000..7e7e608 Binary files /dev/null and b/sounds/test3.wav differ diff --git a/sounds/test0.wav b/sounds/test4.wav similarity index 53% rename from sounds/test0.wav rename to sounds/test4.wav index e5c8878..ef6c7b7 100644 Binary files a/sounds/test0.wav and b/sounds/test4.wav differ