rcute_cozmars.speaker¶
-
class
rcute_cozmars.speaker.Speaker(robot)¶ Speaker is only for Cozmars v2
-
beep(tones, repeat=1, tempo=120, fade=0.1)¶ play a sequence of tones
参数: - tones (collections.Iterable) – array of tones
- tempo (int) – playback speed, default is 120 BPM
- fade (float) – ratio of fade duration to the entire beat, 0~1, the default is 0.1
- repeat (int, optional) – play times, default is 1
注解
This API may change in the future when we come up with a more convenient API to play tones
-
block_duration¶ The duration (seconds) of each sound clip in the stream, the default is 0.1
Cannot be set when device is running, otherwise an exception will be thrown
-
channels¶ Number of channels, which is 1 and read only
-
closed¶ Is the data stream closed
-
dtype¶ Sampling data type, the default is ‘int16’(str).
Cannot be set when device is running, otherwise an exception will be thrown
-
gain¶ Volume gain (dBFS)
-
play(src, repeat=1, preload=5, **kw)¶ Playback sound
参数: - src (str/np.ndarray/bytes/iterable/file-like obj) – The sound resource to be played (file/URL/data)
- repeat (int, optional) – play times, default is 1
-
sample_rate¶ Cannot be set when device is running, otherwise an exception will be thrown
-