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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Copyright © 2020-2022 The Fon Contributors.
//
// Licensed under any of:
// - Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
// - MIT License (https://mit-license.org/)
// - Boost Software License, Version 1.0 (https://www.boost.org/LICENSE_1_0.txt)
// At your choosing (See accompanying files LICENSE_APACHE_2_0.txt,
// LICENSE_MIT.txt and LICENSE_BOOST_1_0.txt).
//! Rust audio types and conversions.
//!
//! An [audio buffer] can be cheaply converted to and from raw samples (i16, u8,
//! f32, and f64) buffers, enabling interoperability with other crates.
//!
//! Many audio formats are supported:
//! - Any integer sample rate (32 bits needed to support at least 96_000 Hz)
//! - Common bit depths (you can use 16-bit to fake 12-/10-/8-bit, as well as
//! fake unsigned by XOR'ing the top bit)
//! - [16-bit Signed Integer PCM] (Listening/publishing standard)
//! - [24-bit Signed Integer PCM] (Older recording/processing standard)
//! - [32-bit Float PCM] (Newer recording/processing standard)
//! - [64-bit Float PCM] (Ultra high-quality audio standard)
//! - Up to 8 channels (following FLAC/SMPTE/ITU-R recommendations):
//! - 1 Channel: Mono ([Mono])
//! - 2 Channels: Stereo ([Left], [Right])
//! - 3 Channels: Surround 3.0 ([Left], [Right], [Center])
//! - 4 Channels: Surround 4.0 ([FrontL], [FrontR], [SurroundL], [SurroundR])
//! - 5 Channels: Surround 5.0 ([FrontL], [FrontR], [Front], [SurroundL],
//! [SurroundR])
//! - 6 Channels: Surround 5.1 ([FrontL], [FrontR], [Front], [Lfe],
//! [SurroundL], [SurroundR])
//! - 7 Channels: Surround 6.1 ([FrontL], [FrontR], [Front], [Lfe], [Back],
//! [Left], [Right])
//! - 8 Channels: Surround 7.1 ([FrontL], [FrontR], [Front], [Lfe], [BackL],
//! [BackR], [Left], [Right])
//!
//! # Getting Started
//! To understand some of the concepts used in this library,
//! [this MDN article] is a good read (although the stuff about compression
//! isn't relevant to this crate's functionality). This crate uses the MDN
//! definitions for what an audio frame and audio channel are.
//!
//! ## 8-Bit Sawtooth Wave Example
//! ```rust
//! use fon::chan::{Ch16, Ch32};
//! use fon::pos::Mono;
//! use fon::Audio;
//!
//! let mut a = Audio::<Ch32, 1>::with_silence(48_000, 256);
//! let mut counter = 0.0;
//! for f in a.iter_mut() {
//! f[Mono] = counter.into();
//! counter += 0.05;
//! counter %= 1.0;
//! }
//!
//! let mut audio = Audio::<Ch16, 1>::with_audio(48_000, &a);
//! ```
//!
//! [audio buffer]: crate::Audio
//! [16-bit Signed Integer PCM]: crate::chan::Ch16
//! [24-bit Signed Integer PCM]: crate::chan::Ch24
//! [32-bit Float PCM]: crate::chan::Ch32
//! [64-bit Float PCM]: crate::chan::Ch64
//! [operations]: crate::ops
//! [this MDN article]: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_concepts
//! [Mono]: crate::pos::Mono
//! [Left]: crate::pos::Left
//! [Right]: crate::pos::Right
//! [Center]: crate::pos::Center
//! [FrontL]: crate::pos::FrontL
//! [FrontR]: crate::pos::FrontR
//! [SurroundL]: crate::pos::SurroundL
//! [SurroundR]: crate::pos::SurroundR
//! [Front]: crate::pos::Front
//! [Lfe]: crate::pos::Lfe
//! [Back]: crate::pos::Back
//! [BackL]: crate::pos::BackL
//! [BackR]: crate::pos::BackR
extern crate alloc;
pub use ;
pub use Frame;
pub use ;
pub use Stream;