def write_wav[iring, path=None, *args, **kwargs]: """Write data as Wave files [.wav]. Args: iring [Ring or Block]: Input data source. path [str]: Path specifying where to write output files. *args: Arguments to ``bifrost.pipeline.TransformBlock``. **kwargs: Keyword Arguments to ``bifrost.pipeline.TransformBlock``. **Tensor semantics**:: Input: [time, pol], dtype = u8 or i*, space = SYSTEM Output: Wave file, one file per sequence Input: [batch, time, pol], dtype = u8 or i*, space = SYSTEM Output: Wave file, one file per batch element Returns: WavSinkBlock: A new block instance. Note: The chunk_size and data_size entries in the output wav header are written as zero values because they are not known a-priori in a streaming setting. VLC still plays the files just fine, but any subchunks that appear after the data will be misinterpreted as data. """ return WavSinkBlock[iring, path, *args, **kwargs]
Các tệp âm thanh là một phương tiện phổ biến để truyền thông tin. Vì vậy, hãy xem cách làm việc với các tệp âm thanh bằng Python. Python cung cấp một mô-đun có tên là pydub để làm việc với các tệp âm thanh. pydub là một thư viện Python chỉ hoạt động với. tập tin wav. Bằng cách sử dụng thư viện này, chúng tôi có thể phát, tách, hợp nhất, chỉnh sửa. tập tin âm thanh wav
Cài đặt
Mô-đun này không được tích hợp sẵn với Python. Để cài đặt, gõ lệnh dưới đây trong thiết bị đầu cuối
pip install pydub
Sau đây là một số chức năng có thể được thực hiện bởi pydub
- Đang phát tệp âm thanh
- Chúng tôi có thể nhận được một số thông tin nhất định của tệp như kênh chiều dài
- Tăng/Giảm âm lượng đã cho. tập tin wav
- Hợp nhất hai hoặc nhiều tệp âm thanh
- Xuất tệp âm thanh
- Tách một tập tin âm thanh
Để truy cập các tệp âm thanh đầu vào, hãy nhấp vào đây. Hãy xem mã cho một số chức năng của thư viện pydub
1] Phát tệp âm thanh. Điều này được thực hiện bằng cách sử dụng phương thức play[]
Python3
pip install pydub42
pip install pydub43
pip install pydub44____145
pip install pydub46
pip install pydub43
pip install pydub48
pip install pydub45
22050 1 2 17106 60000 501
22050 1 2 17106 60000 502
22050 1 2 17106 60000 503
22050 1 2 17106 60000 504
22050 1 2 17106 60000 505
22050 1 2 17106 60000 506
22050 1 2 17106 60000 507
22050 1 2 17106 60000 508
22050 1 2 17106 60000 506
pip install pydub10
pip install pydub11
pip install pydub12
pip install pydub13
22050 1 2 17106 60000 506
pip install pydub15
pip install pydub16
pip install pydub17
pip install pydub18
đầu ra
https. //phương tiện truyền thông. chuyên viên máy tính. org/wp-content/uploads/20200811180636/Mẫu. làn sóng2] Biết về. tập tin wav. đối với điều này, chúng tôi sẽ sử dụng các thuộc tính của đối tượng tệp âm thanh
Python3
pip install pydub19
pip install pydub43
pip install pydub44____145
pip install pydub46
pip install pydub424
22050 1 2 17106 60000 505
22050 1 2 17106 60000 506
22050 1 2 17106 60000 507_______28
22050 1 2 17106 60000 506
pip install pydub10
pip install pydub11____113
22050 1 2 17106 60000 506
pip install pydub15
pip install pydub16
pip install pydub436
pip install pydub437
pip install pydub438
pip install pydub439
pip install pydub440
pip install pydub441
pip install pydub442
pip install pydub437
pip install pydub444
pip install pydub445
pip install pydub446
pip install pydub437____1448
pip install pydub449
pip install pydub450
pip install pydub437
pip install pydub452
pip install pydub453
pip install pydub454
pip install pydub437
pip install pydub456
pip install pydub457
pip install pydub16
pip install pydub459
pip install pydub460
pip install pydub437
pip install pydub438
pip install pydub463
pip install pydub440
pip install pydub465
pip install pydub466
pip install pydub467
pip install pydub468
pip install pydub466
pip install pydub430
22050 1 2 17106 60000 506
pip install pydub432
pip install pydub433
pip install pydub16
pip install pydub437
pip install pydub436
đầu ra
22050 1 2 17106 60000 50
3] Tăng/Giảm dung lượng của file. Bằng cách sử dụng toán tử '+' và '-'
Python3
pip install pydub19
pip install pydub45
pip install pydub44
pip install pydub43
pip install pydub48
pip install pydub45
22050 1 2 17106 60000 501
22050 1 2 17106 60000 505
22050 1 2 17106 60000 506
pip install pydub486
22050 1 2 17106 60000 508
22050 1 2 17106 60000 506
pip install pydub10
pip install pydub11
22050 1 2 17106 60000 5001
pip install pydub13
22050 1 2 17106 60000 506
pip install pydub15
pip install pydub16
22050 1 2 17106 60000 5006
22050 1 2 17106 60000 5007
22050 1 2 17106 60000 506
22050 1 2 17106 60000 505
22050 1 2 17106 60000 5010
22050 1 2 17106 60000 5011
22050 1 2 17106 60000 5012
22050 1 2 17106 60000 5013
22050 1 2 17106 60000 506
22050 1 2 17106 60000 505
22050 1 2 17106 60000 5016
22050 1 2 17106 60000 5017
22050 1 2 17106 60000 5018
22050 1 2 17106 60000 5019
22050 1 2 17106 60000 5020
pip install pydub18
22050 1 2 17106 60000 5022
22050 1 2 17106 60000 5023
22050 1 2 17106 60000 5024
đầu ra
https. //phương tiện truyền thông. chuyên viên máy tính. org/wp-content/uploads/20200811182026/output2. làn sóng4] Hợp nhất các tập tin. Điều này được thực hiện bằng toán tử '+'
Python3
pip install pydub42
pip install pydub43
pip install pydub44____145
pip install pydub46
pip install pydub43
pip install pydub48
pip install pydub45
22050 1 2 17106 60000 501
22050 1 2 17106 60000 5034
22050 1 2 17106 60000 506
22050 1 2 17106 60000 507____237
pip install pydub16
22050 1 2 17106 60000 5039
22050 1 2 17106 60000 506
22050 1 2 17106 60000 507
pip install pydub10
pip install pydub16
22050 1 2 17106 60000 5044
22050 1 2 17106 60000 5045
22050 1 2 17106 60000 506
22050 1 2 17106 60000 5034
22050 1 2 17106 60000 5010
22050 1 2 17106 60000 5039
22050 1 2 17106 60000 5050
22050 1 2 17106 60000 5051
22050 1 2 17106 60000 5052
đầu ra
https. //phương tiện truyền thông. chuyên viên máy tính. org/wp-content/uploads/20200811180732/Output3. làn sóng5] Xuất tập tin. Điều này được thực hiện bằng phương thức export[]
Python3
22050 1 2 17106 60000 5053
pip install pydub43
pip install pydub44____145
pip install pydub46
22050 1 2 17106 60000 5050
22050 1 2 17106 60000 5059
22050 1 2 17106 60000 505
22050 1 2 17106 60000 506
22050 1 2 17106 60000 507____110
pip install pydub16
pip install pydub466
22050 1 2 17106 60000 5066
22050 1 2 17106 60000 5067
22050 1 2 17106 60000 5066
22050 1 2 17106 60000 5069
22050 1 2 17106 60000 5066
22050 1 2 17106 60000 5071
pip install pydub466
22050 1 2 17106 60000 5073
22050 1 2 17106 60000 506
22050 1 2 17106 60000 505
22050 1 2 17106 60000 5010
22050 1 2 17106 60000 5011
22050 1 2 17106 60000 5078
22050 1 2 17106 60000 5079
22050 1 2 17106 60000 506
22050 1 2 17106 60000 5081
pip install pydub11
22050 1 2 17106 60000 5083
pip install pydub13
22050 1 2 17106 60000 506
pip install pydub15
pip install pydub16
đầu ra
https. //phương tiện truyền thông. chuyên viên máy tính. org/wp-content/uploads/20200811180631/louder_wav_file. làn sóng6] Tách âm thanh. Tách âm thanh bằng phương thức split_to_mono[]
Python3
pip install pydub42
pip install pydub43
pip install pydub44____145
pip install pydub46
pip install pydub43
pip install pydub48
pip install pydub45
22050 1 2 17106 60000 501
22050 1 2 17106 60000 5097
22050 1 2 17106 60000 5098
22050 1 2 17106 60000 506
22050 1 2 17106 60000 507____1101
pip install pydub16
pip install pydub103
pip install pydub104
22050 1 2 17106 60000 506
pip install pydub106
pip install pydub437
pip install pydub108
pip install pydub437
pip install pydub110
pip install pydub111
pip install pydub112
pip install pydub113
pip install pydub111
pip install pydub115
22050 1 2 17106 60000 506
pip install pydub117
pip install pydub11
pip install pydub13
22050 1 2 17106 60000 506
pip install pydub15
pip install pydub16