<jupyter_start><jupyter_text>Simpleaudio Examples A simpleaudio example using numpy from the [Real Python tutorial](https://realpython.com/playing-and-recording-sound-python/simpleaudio)<jupyter_code>import numpy as np
import simpleaudio as sa
frequency = 440  # Our played note will be 440 Hz
sample_rate = 44100  # 44100 samples per second
duration = 3  # Note duration of 3 seconds
# Generate array of duration*sample_rate elements
t = np.linspace(0, duration, duration*sample_rate, False)

# Generate a 440 Hz sine wave
note = np.sin(frequency * t * 2 * np.pi)

# Ensure that highest value is in 16-bit range
audio = note * (2**15 - 1) / np.max(np.abs(note))
# Convert to 16-bit data
audio = audio.astype(np.int16)
# Start playback
play_obj = sa.play_buffer(audio, 1, 2, sample_rate)
# Wait for playback to finish before exiting
play_obj.wait_done()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09513023782559456, 'fraction_numerical': 0.039637599093997736, 'mean_word_length': 5.054794520547945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '381455', 'license': 'MIT', 'n_tokens_mistral': 314, 'n_tokens_neox': 278, 'n_words': 96, 'path': 'sound/Simpleaudio_examples.ipynb', 'repo_name': 'hadfieldnz/notebooks', 'size': '883'}