{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":91844,"databundleVersionId":11361821,"sourceType":"competition"},{"sourceId":11076800,"sourceType":"datasetVersion","datasetId":6903541},{"sourceId":291147,"sourceType":"modelInstanceVersion","isSourceIdPinned":true,"modelInstanceId":249468,"modelId":270984}],"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"Python\nimport librosa\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport soundfile as sf\nimport time\n\ndef bryer_singing(bird_sound_file, human_voice_file=None, time_stretch_factor=1.0, pitch_shift_steps=0):\n    \"\"\"Simulates Bryer's singing by manipulating audio.\"\"\"\n\n    bird_audio, sr = librosa.load(bird_sound_file)\n    combined_audio = bird_audio\n\n    if human_voice_file:\n        human_audio, _ = librosa.load(human_voice_file)\n        combined_audio = bird_audio + human_audio[:len(bird_audio)] #add human voice\n\n    combined_audio = librosa.effects.time_stretch(combined_audio, rate=time_stretch_factor)\n    combined_audio = librosa.effects.pitch_shift(combined_audio, sr=sr, n_steps=pitch_shift_steps)\n\n    return combined_audio, sr\n\ndef generate_healing_graph(audio, sr, duration_seconds=10):\n    \"\"\"Generates a healing time graph based on audio.\"\"\"\n\n    time_points = np.linspace(0, duration_seconds, int(duration_seconds * sr))\n    healing_progress = np.zeros_like(time_points)\n    healing_rate = 0.1 #base healing rate\n    audio_level = np.abs(audio)\n\n    for i, t in enumerate(time_points):\n        healing_progress[i] = healing_rate * t\n        if i < len(audio_level):\n            healing_progress[i] += audio_level[i] * 0.001 #audio level effect\n        healing_progress[i] = min(1.0, healing_progress[i]) #cap at 1.0\n\n    plt.plot(time_points, healing_progress)\n    plt.xlabel(\"Time (seconds)\")\n    plt.ylabel(\"Healing Progress\")\n    plt.title(\"Bryer's Healing Time Graph\")\n    plt.grid(True)\n    plt.show()\n\n# Example Usage:\nbird_sound_file = \"bird_chant.wav\" #replace with your file.\nhuman_voice_file = \"human_singing.wav\" #replace with your file or set to None.\n\nbryer_audio, sample_rate = bryer_singing(bird_sound_file, human_voice_file, time_stretch_factor=1.1, pitch_shift_steps=2)\n\nsf.write(\"bryer_song.wav\", bryer_audio, sample_rate) #save the audio\n\ngenerate_healing_graph(bryer_audio, sample_rate, duration_seconds=10)\n\n","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-03-18T16:02:44.771967Z","iopub.execute_input":"2025-03-18T16:02:44.772535Z","iopub.status.idle":"2025-03-18T16:03:10.573075Z","shell.execute_reply.started":"2025-03-18T16:02:44.772502Z","shell.execute_reply":"2025-03-18T16:03:10.572010Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}