Tutorial / チュートリアル¶
This tutorial will teach you the basics of the Wandas library in 5 minutes. このチュートリアルでは、Wandasライブラリの基本的な使い方を5分で学べます。
Installation / インストール¶
Recommended for the learning apps, WDF examples, and psychoacoustic cells: 学習アプリ、WDF 例、音響解析セルを使う場合の推奨インストール:
pip install "wandas[marimo,io,psychoacoustic]"
Core-only install: core-only インストール:
pip install wandas
Basic Usage / 基本的な使い方¶
1. Import the Library / ライブラリのインポート¶
2. Load Audio Files / 音声ファイルの読み込み¶
# Read a signal file / 信号ファイルを読み込む
url = "https://raw.githubusercontent.com/kasahart/wandas/main/learning-path/sample_audio.wav"
audio = wd.read(url, end=15).get_channel(0)
print(f"Sampling rate / サンプリングレート: {audio.sampling_rate} Hz")
print(f"Number of channels / チャンネル数: {audio.n_channels}")
print(f"Duration / 長さ: {audio.duration} s")
Sampling rate / サンプリングレート: 44100.0 Hz
Number of channels / チャンネル数: 1
Duration / 長さ: 15.0 s
3. Visualize Signals / 信号の可視化¶
# Display waveform / 波形を表示
audio.describe(fmin=20, fmax=8_000, vmin=-80, vmax=-20, image_save="read_wav_describe.png")

4. Basic Signal Processing / 基本的な信号処理¶
# Apply a low-pass filter (passing frequencies below 1kHz)
# ローパスフィルタを適用(1kHz以下の周波数を通過)
filtered = audio.low_pass_filter(cutoff=1000)
# Visualize and compare results
# 結果を可視化して比較
filtered.previous.plot(title="Original")
filtered.plot(title="filtered")

Channel selection with query / チャンネル選択(query 引数)¶
get_channel can select channels using a query argument based on metadata instead of indices or labels. Supported queries:
get_channel はインデックスやラベルの代わりにメタデータを用いた query 引数でチャネルを選択できます。サポートされるクエリ:
str: Exact match for labels / ラベルの完全一致re.Pattern: Regular expression search on labels / ラベルに対する正規表現検索callable(ChannelMetadata) -> bool: Metadata predicate / メタデータ述語dict: Match against attributes ofChannelMetadata(can use regex for values) /ChannelMetadataの属性に対する一致(値に正規表現を使うことも可能)
Example / 例:
import re
# Get channel with label containing "acc" / ラベルに "acc" を含むチャネルを取得
cf.get_channel(0, query=re.compile(r"acc"))
# Get channel with unit 'g' using metadata predicate / メタデータ述語で取得(単位が g のチャネル)
cf.get_channel(0, query=lambda ch: ch.unit == 'g')
# Dict specification: match on model field and channel.extra key / dict 指定: model フィールド と channel.extra のキーでマッチ
cf.get_channel(0, query={"unit": "g", "gain": 0.8})
Note: Keys specified in dict are only allowed for dataclass fields of ChannelMetadata or existing keys in the channel's extra. Passing unknown keys will raise a KeyError.
注意: dict で指定するキーは ChannelMetadata のデータクラスフィールドまたは既に存在するチャネルの extra キーのみ許容されます。不明なキーを渡すと KeyError が発生します。
Next Steps / 次のステップ¶
- Per-Channel Calibration (marimo)
- Apply certificate or CSV-managed factors to audio, acceleration, and 100-channel signals, then read physical values from
frame.data. - 証明書やCSVで管理された係数を音・加速度・100ch信号へ適用し、物理値を
frame.dataから取得する。 - Cepstral Analysis / ケプストラム解析
- Separate a smooth spectral envelope from fine harmonic structure with a typed lazy workflow.
- 型付き遅延ワークフローで、滑らかなスペクトル包絡と細かな調波構造を分離する。
- Metadata-Driven Dataset Search (marimo)
- Use this when you have many recordings and want to select files before reading waveforms.
- 多数の録音から、波形を読む前に対象ファイルを選びたい場合に使う。
- Pipeline Recipes Examples / Recipe例
- Use this to extract a RecipePlan from frame operations and replay it on another input.
- frame操作からRecipePlanを抽出し、別の入力で再実行する方法を確認する。
- Reusable Pipeline Recipes (marimo)
- Build, serialize, load, and replay a RecipePlan with observable checks.
- RecipePlanの作成、保存、読込、再実行を実行可能な例で確認する。
- API Reference / APIリファレンス
- Detailed API specifications.
- 詳細な機能やAPI仕様を調べる。
- Theory Background / 理論背景
- Design philosophy and algorithm explanations.
- ライブラリの設計思想やアルゴリズムを理解する。
Learning Path / 学習パス¶
This section provides links to tutorial marimo apps that demonstrate more detailed features and application examples of the Wandas library. このセクションでは、Wandasライブラリのより詳細な機能や応用例を、以下のチュートリアル marimo アプリを通じて学ぶことができます。
- Learning Path — 00_Why Wandas (marimo): Overview and motivation / 概要と動機付け
- Learning Path — 01_Getting Started (marimo): Setup and basic configuration / セットアップと基本的な設定
- Learning Path — 02_Working With Data (marimo): Reading, inspecting, and simple transformations / 読み込み、検査、基本的な変換
- Learning Path — 03_Signal Processing Basics (marimo): Filtering and frequency analysis / フィルタリングと周波数分析
- Learning Path — 04_Advanced Processing (marimo): Spectrograms and time-frequency analysis / スペクトログラムと時間周波数解析
- Learning Path — 05_Custom Functions (marimo): Custom frame operations / custom frame操作
- Learning Path — 06_Reusable Pipeline Recipes (marimo): Reuse public Frame workflows / 公開Frame処理の再利用
- Learning Path — 07_Per-Channel Calibration (marimo): Apply known coefficients from certificates and CSV / 証明書・CSVの既知係数をチャンネルへ適用
- Learning Path — 08_Metadata-Driven Dataset Search (marimo): Select files from path or CSV metadata before loading waveforms / パス・CSVメタデータで波形ロード前にファイルを選択