AmmosSource
guix
Last change
on this file since 6d0f203 was 6d0f203, checked in by Enrico Schwass <ennoausberlin@…>, 3 years ago |
apply changes from Franks session
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | import sys
|
---|
2 | import io
|
---|
3 | from pydub import AudioSegment
|
---|
4 | from pydub.playback import play
|
---|
5 |
|
---|
6 | from ammosreader.AmmosAudioReader import AmmosAudioReader
|
---|
7 |
|
---|
8 | if __name__ == '__main__':
|
---|
9 |
|
---|
10 | if len(sys.argv) != 2:
|
---|
11 | sys.exit()
|
---|
12 |
|
---|
13 | file_name = sys.argv[1]
|
---|
14 |
|
---|
15 | print("File name:", file_name)
|
---|
16 |
|
---|
17 | dat_file = AmmosAudioReader(file_name)
|
---|
18 |
|
---|
19 | dat_file.read_all_frames_left()
|
---|
20 | print("Sample rate:", dat_file.container.global_frames[0].global_frame_body.data_header.sample_rate)
|
---|
21 | print("Container size:", dat_file.container.size())
|
---|
22 | print("Frequencies", dat_file.container.frequencies())
|
---|
23 | print("Frame types:", dat_file.container.frame_types())
|
---|
24 | print("Frame sizes:", dat_file.container.frame_sizes())
|
---|
25 | print("Homogenic:", dat_file.container.is_homogenic())
|
---|
26 | pcm_data = dat_file.pcm_for_channel(0)
|
---|
27 | print("PCM data size total:", len(pcm_data))
|
---|
28 | data = AudioSegment.from_raw(io.BytesIO(pcm_data),
|
---|
29 | sample_width=2,
|
---|
30 | frame_rate=22050,
|
---|
31 | channels=1)
|
---|
32 | play(data)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.