From ae8c00201188d9c38678415ec1b5447fc405bd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 3 Mar 2025 01:45:02 +0100 Subject: [PATCH] Audio --- README.md | 4 ++-- index.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8614d7b..a43e495 100644 --- a/README.md +++ b/README.md @@ -2078,7 +2078,7 @@ Memory View ``` ```python - = list() # Returns a list of ints, floats, or bytes. + = list() # Returns a list of ints, floats or bytes. = str(, 'utf-8') # Treats memoryview as a bytes object. = .hex() # Returns hex pairs. Accepts `sep=`. ``` @@ -2942,7 +2942,7 @@ write_to_wav_file('test.wav', samples_f) from random import uniform samples_f, params = read_wav_file('test.wav') samples_f = (f + uniform(-0.05, 0.05) for f in samples_f) -write_to_wav_file('test.wav', samples_f, params) +write_to_wav_file('test.wav', samples_f, p=params) ``` #### Plays the WAV file: diff --git a/index.html b/index.html index 3dac48a..ea6618c 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@
- +
@@ -1721,7 +1721,7 @@ CompletedProcess(args=['bc', '<typecode>', <mview>) # Treats memoryview as a sequence of numbers. <file>.write(<mview>) # Writes `bytes(<mview>)` to the binary file. -
<list>  = list(<mview>)                        # Returns a list of ints, floats, or bytes.
+
<list>  = list(<mview>)                        # Returns a list of ints, floats or bytes.
 <str>   = str(<mview>, 'utf-8')                # Treats memoryview as a bytes object.
 <str>   = <mview>.hex()                        # Returns hex pairs. Accepts `sep=<str>`.
 
@@ -2409,7 +2409,7 @@ write_to_wav_file('test.wav', samples_f)

Adds noise to the WAV file:

from random import uniform
 samples_f, params = read_wav_file('test.wav')
 samples_f = (f + uniform(-0.05, 0.05) for f in samples_f)
-write_to_wav_file('test.wav', samples_f, params)
+write_to_wav_file('test.wav', samples_f, p=params)
 

Plays the WAV file:

# $ pip3 install simpleaudio
@@ -2942,7 +2942,7 @@ $ deactivate                # Deactivates the active