{"library":"soundfile","code":"import soundfile as sf\nimport numpy as np\nimport os\n\n# Create dummy audio data (mono, 44.1 kHz)\nsamplerate = 44100  # samples per second\nduration = 1.0     # seconds\nf_hz = 440         # sine wave frequency\nt = np.linspace(0., duration, int(samplerate * duration), endpoint=False)\ndata = 0.5 * np.sin(2 * np.pi * f_hz * t)\n\noutput_filename = 'dummy_audio.wav'\n\n# Write the audio data to a WAV file\nsf.write(output_filename, data, samplerate)\nprint(f\"Audio written to {output_filename}\")\n\n# Read the audio data back from the file\nread_data, read_samplerate = sf.read(output_filename)\nprint(f\"Audio read from {output_filename} with sample rate {read_samplerate}\")\nprint(f\"Read data shape: {read_data.shape}\")\n\n# Verify data\nassert np.allclose(data, read_data[:len(data)])\nassert samplerate == read_samplerate\n\n# Clean up the dummy file\nos.remove(output_filename)\nprint(f\"Cleaned up {output_filename}\")","lang":"python","description":"This quickstart demonstrates how to generate a simple sine wave using NumPy, write it to a WAV file using `soundfile.write()`, and then read it back using `soundfile.read()`.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}