Skip to content

Commit

Permalink
change force-db from Argument to Option in plot
Browse files Browse the repository at this point in the history
  • Loading branch information
dunossauro committed Aug 31, 2023
1 parent 9b8e666 commit d6dff15
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,20 +497,20 @@ Create a comparative plot of multiple audio waves. Useful for comparing the effe

```
vmh plot compare-waves --help
Usage: vmh plot compare-waves [OPTIONS] FILES... FIG_NAME [FORCE_DB]
Usage: vmh plot compare-waves [OPTIONS] FILES... FIG_NAME
Plot a figure with N audio waves for comparison.
╭─ Arguments ───────────────────────────────────────────────────────────────────────╮
│ * files FILES... [default: None] [required] │
│ * fig_name TEXT [default: None] [required] │
│ force_db [FORCE_DB] Force to use 1 to -1 dbs in plot [default: True] │
╰───────────────────────────────────────────────────────────────────────────────────
╭─ Options ─────────────────────────────────────────────────────────────────────────╮
│ --fig-size <FLOAT FLOAT>... [default: 10, 12]
│ --help Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────╯
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────────────────
│ * files FILES... [default: None] [required]
│ * fig_name TEXT [default: None] [required]
╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────╮
│ --fig-size <FLOAT FLOAT>... [default: 10, 12] │
│ --force-db --no-force-db Force to use 1 to -1 dbs in plot [default: force-db]
│ --help Show this message and exit.
╰────────────────────────────────────────────────────────────────────────────────────────────────────────
```

### All options
Expand Down
13 changes: 13 additions & 0 deletions examples/cut-video/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ Some examples, changing the `distance` parameter.

![example](./out.png)

CLI to generate this image:
```bash
vmh plot compare-waves \
examples/cut-video/default.mkv \
examples/cut-video/result_large.mp4 \
examples/cut-video/result_medium.mp4 \
examples/cut-video/result_small.mp4 \
examples/cut-video/result_tiny.mp4 \
examples/cut-video/result_negative.mp4 \
examples/cut-video/out.png \
--no-force-db
```

All these examples using defaults parameters to `threshold`, `silence-time`, `bitrate` and `codec`.

The `--preset` used is `ultrafast`
Expand Down
Binary file modified examples/cut-video/out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions vmh/plot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import matplotlib.pyplot as plt
from librosa import load
from librosa.display import waveshow
from typer import Typer, Argument
from typer import Typer, Option

plot = Typer(no_args_is_help=True)

Expand All @@ -20,7 +20,7 @@ def compare_waves(
files: list[str],
fig_name: str,
fig_size: tuple[float, float] = (10, 12),
force_db: bool = Argument(True, help='Force to use 1 to -1 dbs in plot'),
force_db: bool = Option(True, help='Force to use 1 to -1 dbs in plot'),
) -> None:
"""Plot a figure with N audio waves for comparison."""
_, ax = plt.subplots(
Expand Down

0 comments on commit d6dff15

Please sign in to comment.