Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .harper-dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BCP
ContextSwitch
FreeSWITCH
Inband
seekable
subtag
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tokio = { workspace = true }
async-trait = { workspace = true }
tracing-futures = "0.2.5"

# todo: is this needed?
# TODO: Is this needed?
uuid = { workspace = true }

# audio tracing
Expand Down
2 changes: 1 addition & 1 deletion audio-knife/src/app_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use axum::{
#[allow(unused)]
pub struct AppError(anyhow::Error);

// Tell axum how to convert `AppError` into a response.
// Tell Axum how to convert `AppError` into a response.
impl IntoResponse for AppError {
fn into_response(self) -> Response {
(StatusCode::BAD_REQUEST, self.0.to_string()).into_response()
Expand Down
8 changes: 4 additions & 4 deletions audio-knife/src/event_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use context_switch::{AudioFormat, OutputModality, OutputPath, ServerEvent};

/// Runs an event scheduler that manages the timing of events sent to FreeSWITCH.
///
/// This delays audio pakets if more than 5 seconds are pending, and control pakets if currently
/// This delays audio packets if more than 5 seconds are pending, and control packets if currently
/// audio is being assumed to be played back.
pub async fn event_scheduler(
mut receiver: UnboundedReceiver<ServerEvent>,
Expand Down Expand Up @@ -60,7 +60,7 @@ pub async fn event_scheduler(
}
// Control path events are sent out immediately.
sender.send(event).context("Sending control event")?;
// Even though only a control event was short circuited we need to kick the the
// Even though only a control event was short circuited we need to kick the
// media scheduler.
}
OutputPath::Media => {
Expand Down Expand Up @@ -102,7 +102,7 @@ impl MediaEventScheduler {
}
}

/// TODO: There could be situation in which ... when there is a conversation crossover ... the
/// TODO: There could be situation in which when there is a conversation crossover the
/// started event was not sent yet when we received audio here. In this case, we have to ignore
/// the audio and warn about it.
pub fn notify_started(&mut self, modalities: &[OutputModality]) -> Result<()> {
Expand All @@ -119,7 +119,7 @@ impl MediaEventScheduler {
if let ServerEvent::ClearAudio { .. } = event {
self.input_media_events
.retain(|e| !matches!(e, ServerEvent::Audio { .. }));
// All the non-audio event before `ClearAudio` must be sent asap, too.
// All the non-audio event before `ClearAudio` must be sent as soon as possible, too.
self.audio_finished = now;
self.timed_events.iter_mut().for_each(|(t, _)| *t = now);
}
Expand Down
2 changes: 1 addition & 1 deletion audio-knife/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async fn main() -> Result<()> {
)
.with_state(state);

// IMPORTANT: attempt to set TCP_NODELAY on every incoming connection.
// IMPORTANT: attempt to set `TCP_NODELAY` on every incoming connection.
// We need to disable the Nagle algorithm to properly support low latency
// live streaming small audio packets.
let listener = TcpListener::bind(addr).await?.tap_io(|tcp_stream| {
Expand Down
2 changes: 1 addition & 1 deletion audio-knife/src/mod_audio_fork.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! mod_audio_fork specific types and audio processing.
//! `mod_audio_fork` specific types and audio processing.

use anyhow::Result;
use axum::extract::ws::{Message, WebSocket};
Expand Down
2 changes: 1 addition & 1 deletion audio-knife/src/server_event_router.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A component that routes server events that are received from ContextSwitch to multiple
//! conversation targets.
//!
//! Conceptually, this is similar to a reverse proxy.
//! Conceptually this is similar to a reverse proxy.
use std::collections::{HashMap, hash_map::Entry};

use anyhow::{Context, Result, bail};
Expand Down
6 changes: 3 additions & 3 deletions core/src/billing_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ pub struct BillingRecords {
records: Vec<BillingRecord>,
}

/// Type definition for the inner HashMap key in BillingCollector
/// Contains (service, scope, name)
/// Type definition for the inner `HashMap` key in `BillingCollector`
/// Contains `(service, scope, name)`
type BillingRecordKey = (String, Option<String>, String);

#[derive(Debug, Default)]
pub struct BillingCollector {
/// The inner HashMap uses (service, scope, name) as the key and stores the BillingRecordValue.
/// The inner `HashMap` uses `(service, scope, name)` as the key and stores the `BillingRecordValue`.
/// The scope is optional.
records: HashMap<BillingId, HashMap<BillingRecordKey, BillingRecordValue>>,
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/conversation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl ConversationInput {
}
}

// For billing, or other purposes, it's very convenient the the output can be cloned. See
// For billing, or other purposes, it's very convenient the output can be cloned. See
// azure-transcribe for example.
#[derive(Debug, Clone)]
pub struct ConversationOutput {
Expand Down
8 changes: 4 additions & 4 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ impl AudioConsumer {
}
}

// TODO: This might be overengineered, we probably are fine with Sender<AudioFrame> and
// Receiver<AudioFrame> without checking the format for which I guess the receiver is actually
// responsible, _and_ it might even ok for the receiver to receive different audio formats, e.g. in
// TODO: This might be overengineered, we probably are fine with `Sender<AudioFrame>` and
// `Receiver<AudioFrame>` without checking the format for which I guess the receiver is actually
// responsible, _and_ it might even okay for the receiver to receive different audio formats, e.g. in
// low QoS situations?
#[derive(Debug)]
pub struct AudioProducer {
Expand All @@ -132,7 +132,7 @@ impl AudioProducer {
}
}

/// Create an unidirectional audio channel.
/// Create a unidirectional audio channel.
pub fn audio_channel(format: AudioFormat) -> (AudioProducer, AudioConsumer) {
let (producer, consumer) = mpsc::unbounded_channel();
(
Expand Down
2 changes: 1 addition & 1 deletion core/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Registry {
}
}

/// We wrap the service to able to do Params deserialization.
/// We wrap the service to able to do Parameters deserialization.
#[async_trait]
pub trait WrappedService: fmt::Debug {
async fn converse(&self, params: Value, conversation: Conversation) -> Result<()>;
Expand Down
2 changes: 1 addition & 1 deletion core/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! handling and lifetime.
//!
//! ADR: Output is provided through a channel. Compared to async streams, this simplifies the
//! implementation and does not couple the straem production code to the receiver.
//! implementation and does not couple the stream production code to the receiver.
//!
//! ADR: Asynchronous stopping of a conversation done by dropping the input channel. After that,
//! more output may be supplied (say for example intermediate recognized text).
Expand Down
2 changes: 1 addition & 1 deletion external/openai-api-rs
2 changes: 1 addition & 1 deletion filter-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Args {
inputs: Vec<PathBuf>,

/// Threshold for the speech gate (0.0 - 1.0)
/// Higher values (0.1-0.2) provide more aggressive noise reduction
/// Higher values `(0.1-0.2)` provide more aggressive noise reduction
/// A value of 0.05 provides balanced noise reduction for most audio
#[arg(short, long, default_value = "0.05")]
threshold: f32,
Expand Down
2 changes: 1 addition & 1 deletion services/aristech/src/synthesize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Service for AristechSynthesize {
conversation.require_text_input_only()?;
let output_format = conversation.require_single_audio_output()?;

// Resolve default voice if none is set
// Resolve to default voice if none is set
// TODO: Add the possibility to determine this from a language parameter and the
// `get_voices` function if no voice_id is provided.
let voice = params.voice.unwrap_or_else(|| "anne_de_DE".to_string());
Expand Down
2 changes: 1 addition & 1 deletion services/azure/src/synthesize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ enum BillingScope {
}

fn voice_to_billing_scope(voice: &str) -> Result<BillingScope> {
// The voice name typically follows a pattern like "en-US-JennyNeural" or "en-US-JennyMultilingualNeural"
// The voice name typically follows a pattern like `en-US-JennyNeural` or `en-US-JennyMultilingualNeural`
match voice {
v if v.ends_with("TurboMultilingualNeural") => Ok(BillingScope::TurboMultilingualNeural),
v if v.ends_with("MultilingualNeuralHD") => Ok(BillingScope::MultilingualNeuralHD),
Expand Down
2 changes: 1 addition & 1 deletion services/elevenlabs/src/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Params {
pub api_key: String,
/// Optional realtime model. Defaults to `scribe_v2_realtime` when omitted.
pub model: Option<String>,
/// Optional websocket endpoint override.
/// Optional WebSocket endpoint override.
pub host: Option<String>,
/// Optional language hint in BCP 47 format (for example `en-US`).
pub language: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub enum ServerEvent {
speaker: Option<String>,
},
/// A completed event is sent when the client request that triggered Audio or Text responses has
/// has been fully processed.
/// been fully processed.
#[serde(rename_all = "camelCase")]
RequestCompleted {
id: ConversationId,
Expand Down
Loading