-
Notifications
You must be signed in to change notification settings - Fork 8
/
tutorial.py
46 lines (40 loc) · 1011 Bytes
/
tutorial.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pipewire_python.controller import Controller
# import asyncio
#########################
# PLAYBACK #
#########################
# normal way
audio_controller = Controller(verbose=True)
audio_controller.set_config(
rate=384000,
channels=2,
_format="f64",
volume=0.98,
quality=4,
# Debug
verbose=True,
)
audio_controller.playback(
audio_filename="docs/beers.wav",
# Debug
verbose=True,
)
# async way
# player = Player()
# asyncio.run(player.play_wav_file_async('docs/beers.wav',
# verbose=True))
#########################
# RECORD #
#########################
# normal way
audio_controller = Controller(verbose=True)
audio_controller.record(
audio_filename="docs/5sec_record.wav",
timeout_seconds=5,
# Debug
verbose=True,
)
# async way
# player = Player()
# asyncio.run(player.record_wav_file_async('docs/5sec_record.wav',
# verbose=True))