Skip to content

Commit

Permalink
Updates to HiFi-Decode workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypm committed Apr 12, 2024
1 parent 09411f1 commit 8f30d2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
8 changes: 6 additions & 2 deletions vhsdecode/hifi/HifiUi.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
self.grc = False
self.preview: bool = False
self.preview_available: bool = True
self.audio_sample_rate: int = 44100
self.audio_sample_rate: int = 48000
self.standard: str = "PAL"
self.format: str = "VHS"
self.audio_mode: str = "Stereo"
Expand Down Expand Up @@ -82,7 +82,7 @@ def ui_parameters_to_decode_options(values: MainUIParameters):
decode_options = {
"input_rate": float(values.input_sample_rate) * 1e6,
"standard": "p" if values.standard == "PAL" else "n",
"format": "vhs" if values.format == "VHS" else "h8",
"format": "vhs" if values.format == "VHS" else "8mm",
"preview": values.preview,
"original": False,
"noise_reduction": values.noise_reduction,
Expand Down Expand Up @@ -283,6 +283,8 @@ def __init__(
self.input_samplerate_combo.addItems(
[
"DdD (40.0)",
"Clockgen (10.0)"
"RTLSDR (8.0)"
"cxadc (28.64)",
"cxadc3 (35.8)",
"10cxadc (14.32)",
Expand All @@ -292,6 +294,8 @@ def __init__(
)
self._input_combo_rates = [
40.0,
10.0,
8.0,
28.64,
35.8,
14.32,
Expand Down
30 changes: 17 additions & 13 deletions vhsdecode/hifi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,24 @@


parser, _ = common_parser_cli(
"Extracts audio from raw VHS HiFi FM capture",
"Extracts audio from RAW HiFi FM RF captures",
default_threads=round(cpu_count() / 2),
)

parser.add_argument(
"--audio_rate",
"--ar", "--audio_rate",
dest="rate",
type=int,
default=44100,
help="Output sample rate in Hz (default 44100)",
default=48000,
help="Output sample rate in Hz (default 48000)",
)

parser.add_argument(
"--bg", dest="BG", action="store_true", default=False, help="Do carrier bias guess"
"--bg", "--bias_guess",
dest="BG",
action="store_true",
default=False,
help="Do carrier bias guess"
)

parser.add_argument(
Expand Down Expand Up @@ -121,11 +125,11 @@
)

parser.add_argument(
"--h8",
dest="H8",
"--8mm",
dest="8mm",
action="store_true",
default=False,
help="Video8/Hi8, 8mm tape format",
help="Sony Video8/Hi8, 8mm tape formats",
)

parser.add_argument(
Expand All @@ -137,11 +141,11 @@
)

parser.add_argument(
"--ui",
"--ui", "--gui"
dest="UI",
action="store_true",
default=False,
help="Opens hifi-ui",
help="Opens hifi-decode GUI graphical user interface",
)

parser.add_argument(
Expand Down Expand Up @@ -319,7 +323,7 @@ def close(self):

# This part is what opens the file
# The samplerate here could be anything
def as_soundfile(pathR, sample_rate=44100):
def as_soundfile(pathR, sample_rate=48000):
path = pathR.lower()
if ".raw" in path or ".s16" in path:
return sf.SoundFile(
Expand Down Expand Up @@ -768,13 +772,13 @@ def main() -> int:

print("Initializing ...")

real_mode = "s" if not args.H8 else "mpx"
real_mode = "s" if not args.8mm else "mpx"
real_mode = args.mode if args.mode in ["l", "r", "sum"] else real_mode

decode_options = {
"input_rate": sample_freq * 1e6,
"standard": "p" if system == "PAL" else "n",
"format": "vhs" if not args.H8 else "h8",
"format": "vhs" if not args.8mm else "8mm",
"preview": args.preview,
"preview_available": SOUNDDEVICE_AVAILABLE,
"original": args.original,
Expand Down

0 comments on commit 8f30d2d

Please sign in to comment.