Realm

Audio viewer

Source-owned programs from the current OA SDK. Rust and Python examples follow their respective public APIs.

Rust · Python

Example

1use oa::{Result, Viewer, ViewerAudioView, ViewerConfig, ViewerMode};
2
3fn main() -> Result<()> {
4 let args: Vec<String> = std::env::args().collect();
5 let default_path = oa::Path::asset_rel("audio/oaNarration.flac");
6 let default_str = default_path.to_string_lossy().into_owned();
7 let path = args.get(1).map(String::as_str).unwrap_or(&default_str);
8
9 let audio_view = match args.get(2).map(String::as_str) {
10 Some("spectrum") => ViewerAudioView::Spectrum,
11 Some("mel") => ViewerAudioView::Mel,
12 _ => ViewerAudioView::Waveform,
13 };
14
15 let config = ViewerConfig {
16 mode: ViewerMode::Audio,
17 path: path.to_owned(),
18 audio_view,
19 title: "oa::Viewer · Audio".to_owned(),
20 width: 960,
21 height: 360,
22 ..ViewerConfig::default()
23 };
24
25 Viewer::new(config).run_standalone()
26}
27

Run Rust tutorials from the OA checkout with cargo run --release --example <name>. Run Python with the environment containing the OA native extension. Consult each program's arguments and capability checks before running it.