Sample code and sounds for the Reading and Writing WAV Files in Python tutorial on Real Python.
Create and activate a new virtual environment:
$ python3 -m venv venv/ --prompt wave
$ source venv/bin/activate
Install the required dependencies:
(wave) $ python -m pip install -r requirements.txt -c constraints.txt
(wave) $ python synth_mono.py
(wave) $ python synth_stereo.py
(wave) $ python synth_beat.py
(wave) $ python synth_stereo_16bits_array.py
(wave) $ python synth_stereo_16bits_bytearray.py
(wave) $ python synth_stereo_16bits_ndarray.py
(wave) $ python plot_waveform.py sounds/Bicycle-bell.wav
(wave) $ python plot_waveform.py sounds/Bongo_sound.wav -s 3.5 -e 3.65
(wave) $ python plot_oscilloscope.py sounds/Bicycle-bell.wav
(wave) $ python plot_oscilloscope.py sounds/Bongo_sound.wav -s 0.005
(wave) $ python plot_spectrogram.py sounds/Bicycle-bell.wav
(wave) $ python plot_spectrogram.py sounds/Bongo_sound.wav -s 0.0005 -o 95
(wave) $ RADIO_URL=http://prem2.di.fm:80/classiceurodance?your-secret-token
(wave) $ python record_stream.py "$RADIO_URL" -o ripped.wav
(wave) $ python stereo_booster.py -i sounds/Bicycle-bell.wav -o boosted.wav -s 5