cutcutcodec.core.generation.audio.noise¶
Generate an audio noise signal.
Classes
|
Generate a pure noise audio signal. |
Functions
|
Vectorised version of the md5 algorithm. |
Details
- class cutcutcodec.core.generation.audio.noise.GeneratorAudioNoise(seed: Real | None = None, layout: Layout | str | Integral | None = 'stereo')[source]
Generate a pure noise audio signal.
Attributes¶
- layoutcutcutcodec.core.classes.layout.Layout
The signification of each channels (readonly).
Examples¶
>>> from fractions import Fraction >>> from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise >>> (stream,) = GeneratorAudioNoise(0).out_streams >>> stream.snapshot(Fraction(2, 48000), 48000, 5).numpy(force=True) array([[-0.25397146, -0.1199106 , -0.12052107, -0.16986334, -0.50950706], [ 0.17409873, 0.42185044, -0.7231959 , 0.39764726, -0.25968206]], dtype=float32) >>> stream.snapshot(0, 24000, 5).numpy(force=True) array([[ 0.44649088, -0.25397146, -0.12052107, -0.50950706, 0.5112531 ], [-0.8036704 , 0.17409873, -0.7231959 , -0.25968206, -0.7944578 ]], dtype=float32) >>> frame = stream.snapshot(0, 48000, 48000*60) # test uniform >>> abs(round(frame.mean().item(), 3)) # theory 0 0.0 >>> round(frame.var().item(), 3) # theory 1/3 0.333 >>>
Initialise and create the class.
Parameters¶
- seednumbers.Real, optional
Transmitted to
cutcutcodec.core.interfaces.seedable.Seedable.- layout: cutcutcodec.core.classes.layout.Layout or str or int, optional
The audio layout to associate to each equation, let see
cutcutcodec.core.classes.layout.Layoutfor more details. By default, the layout is stereo, two channels.
- cutcutcodec.core.generation.audio.noise.md5(string: ndarray) ndarray[source]
Vectorised version of the md5 algorithm.
Parameters¶
- stringnp.ndarray
The values to hash, of shape (16, n) and dtype uint32.
Returns¶
- hashtuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
The hashed value of the input string, of shape (n,). Fours differents 32 bits values ares yields, total 128 bits.
Examples¶
>>> import numpy as np >>> from cutcutcodec.core.generation.audio.noise import md5 >>> string = np.zeros((16, 1), dtype=np.uint32) >>> np.vstack(md5(string)) array([[1543640769], [2049272632], [1899532917], [2915357108]], dtype=uint32) >>>