Static sawtooth ( duration = 1.0, freqHz = 440, peak = 1.0, gain = 0.8, sampleRateHz = 48000, channels = 2 ) ¶ Implied from the extension at the end of filename. save ( filename, codec = None ) ¶įilename ( str) – File name to write audio clip to.Ĭodec ( str or None) – Format to save audio clip data as. Values outside that range will beĬlipped, possibly resulting in distortion. Nx1 or Nx2 array of audio samples ( ~numpy.ndarray). Value as the rate samples was captured at. Sample rate of the audio clip in Hz ( int). Specified, a float will be returned indicating the RMS of that There is one channel an array is returned). If None, the RMS of allĪn array of RMS values for each channel if channel=None (even if Resampling audio clip may result in distortion which is exaserbated byĬompute the root mean square (RMS) of the samples to determine theĬhannel ( int or None) – Channel to compute RMS (zero-indexed). ResampleType ( str or None) – Method to use for resampling.ĮqualEnergy ( bool) – Make the output have similar energy to the input. TargetSampleRateHz ( int) – New sample rate. Return type :ĪudioClip resample ( targetSampleRateHz, resampleType = 'soxr_hq', equalEnergy = False ) ¶ If None, the format will be implied from the fileĪudio clip containing samples loaded from the file. Note that this is a static method! Parameters :Ĭodec ( str or None) – Codec to use. The first channel is usually the left ear, and True if there are two channels of audio samples. True if there is only one channel of audio data. Parameters :įactor ( float or int) – Gain factor to multiply audio samples.Ĭhannel ( int or None) – Channel to apply gain to. Clipping isĪutomatically applied to samples after applying gain. This will modify the internal store of samples inplace. This value is computed using the specified sampling frequency and number The duration of the audio in seconds ( float). samples but in 16-bit WAV PCMĬreate an independent copy of this AudioClip. Get a copy of stored audio samples in WAV PCM format. If channels > 1, the audio clip is in stereo. Number of audio channels in the clip ( int). Mixed inplace resulting a the same object being returned. Parameters :Ĭopy ( bool) – If True an AudioClip containing a copy append ( snd2 ) asMono ( copy = True ) ¶Ĭonvert the audio clip to mono (single channel audio). This object with samples from clip appended. The AudioClip object must have the same sample rate and channels asĬlip ( AudioClip) – Audio clip to append. Return type :Īppend samples from another sound clip to the end of this one. RaiseError ( bool) – Raise an error (``) instead of returning a value. Parameters :Ĭodec ( str) – Codec identifier (e.g., ‘wav’, ‘mp3’, etc.) Used internally to check if the user specified a valid codec identifier. Static _checkCodecSupported ( codec, raiseError = False ) ¶Ĭheck if the audio format string corresponds to a supported codec. UserData ( dict or None) – Optional user data to associated with the audio clip. For convenience, module levelĬonstants with form SAMPLE_RATE_* are provided to specify many Usually, a sample rate of 48kHz is acceptable for mostĪpplications (DVD audio quality). If not, the audio may sound distorted when The value specified should match the frequency Rates usually result in better sounding audio (albeit a larger memoryįootprint and file size). The sample rate orįrequency is related to the quality of the audio, where higher sample SampleRateHz ( int) – Sampling rate used to obtain samples in Hertz (Hz). Values in the array representing the amplitude of the sound waveform Samples ( ArrayLike) – Nx1 or Nx2 array of audio samples for mono and stereo, respectively. wait ( 5.0 ) # wait for sound to finish playing core. sine ( duration = 5.0 ) # generate a tone mySound = sound. Import re as core import psyhcopy.sound as sound myTone = AudioClip.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |