Skip to content

Commit

Permalink
Merge pull request #30 from TheCacophonyProject/add-rec
Browse files Browse the repository at this point in the history
Add rec
  • Loading branch information
hardiesoft authored Nov 13, 2024
2 parents 00f4aab + a7121eb commit 7e0012b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use crate::recording_state::RecordingState;
const AUDIO_SHEBANG: u16 = 1;

const EXPECTED_RP2040_FIRMWARE_HASH: &str = include_str!("../_releases/tc2-firmware.sha256");
const EXPECTED_RP2040_FIRMWARE_VERSION: u32 = 15;
const EXPECTED_RP2040_FIRMWARE_VERSION: u32 = 14;
const EXPECTED_ATTINY_FIRMWARE_VERSION: u8 = 1;

const SEGMENT_LENGTH: usize = 9760;
Expand Down
12 changes: 12 additions & 0 deletions src/save_audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ pub fn save_audio_file_to_disk(mut audio_bytes: Vec<u8>, device_config: DeviceCo
fs::create_dir(&output_dir)
.expect(&format!("Failed to create AAC output directory {}", output_dir));
}
let debug_dir = String::from("/home/pi/temp");
if !fs::exists(&debug_dir).unwrap_or(false) {
fs::create_dir(&debug_dir)
.expect(&format!("Failed to create debug output directory {}", debug_dir));
let output_path: String = format!(
"{}/{}.raw",
output_dir,
recording_date_time.format("%Y-%m-%d--%H-%M-%S")
);
fs::write(&output_path, &audio_bytes).unwrap();
}

let output_path: String =
format!("{}/{}.aac", output_dir, recording_date_time.format("%Y-%m-%d--%H-%M-%S"));
Expand Down Expand Up @@ -119,6 +130,7 @@ pub fn save_audio_file_to_disk(mut audio_bytes: Vec<u8>, device_config: DeviceCo
args.push("-f");
args.push("mp4");
args.push(&output_path);
info!("Saving AAC file with args {:#?}", args);
// Now transcode with ffmpeg – we create an aac stream in an m4a wrapper in order
// to support adding metadata tags.
let mut cmd = Command::new("ffmpeg")
Expand Down

0 comments on commit 7e0012b

Please sign in to comment.