; ; downlink_voice_enhancer.dspg ; graphName downlink_voice_enhancer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Macros ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [def FFT_BLOCK_SIZE 240] [def IO_BLOCK_SIZE 240] [def IO_SAMPLE_RATE 24000] [def VOICE_INPUT_CHANNEL_COUNT 1] [def VOICE_OUTPUT_CHANNEL_COUNT 1] [def ENABLE_OCNS 0] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Constants ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [def kAUOneChannelNSParam_SpeechProbability 1] [def kSpeechEnh_Parameter_SpeechProb 52] [def kSpeechEnh_Property_NoiseSpectrum 1001] [def kSpeechEnh_Property_UplinkSampleRate 1003] [def kSpeechEnh_Property_UplinkMaxFrameSize 1004] [def kAudioUnitProperty_BypassEffect 21] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; I/O ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; in Input out Output ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Boxes ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; box PreEQ (aufx nbeq appl) 1 1 box VoiceEQ (aufx tmst appl) 1 1 box Deesser (aufx dees appl) 1 1 box Gain dbgn 1 1 box FFT fft 1 1 box VoiceEnhancer (aufx spen appl) 1 1 box IFFT fft 1 1 [if [and [== [ENABLE_OCNS] 1] [and [== [VOICE_INPUT_CHANNEL_COUNT] 1] [== [IO_BLOCK_SIZE] [FFT_BLOCK_SIZE]]]] { box OCNS (aufx ons4 appl) 1 1 }{}] [if [!= [VOICE_INPUT_CHANNEL_COUNT] [VOICE_OUTPUT_CHANNEL_COUNT]] { box ChannelSelector (aufx clsl appl) 1 1 }{}] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Wires ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; wire Input PreEQ ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire PreEQ VoiceEQ ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire VoiceEQ Deesser ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire Deesser Gain ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire Gain FFT ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) [if [and [== [ENABLE_OCNS] 1] [and [== [VOICE_INPUT_CHANNEL_COUNT] 1] [== [IO_BLOCK_SIZE] [FFT_BLOCK_SIZE]]]] { wire FFT OCNS (freq [IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire OCNS VoiceEnhancer (freq [IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire VoiceEnhancer IFFT (freq [IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) [if [== [VOICE_INPUT_CHANNEL_COUNT] [VOICE_OUTPUT_CHANNEL_COUNT]] { wire IFFT Output ([IO_SAMPLE_RATE] [VOICE_OUTPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) }{ wire IFFT ChannelSelector ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire ChannelSelector Output ([IO_SAMPLE_RATE] [VOICE_OUTPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) }] }{ [if [== [VOICE_INPUT_CHANNEL_COUNT] [VOICE_OUTPUT_CHANNEL_COUNT]] { wire FFT VoiceEnhancer (freq [IO_SAMPLE_RATE] [VOICE_OUTPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire VoiceEnhancer IFFT (freq [IO_SAMPLE_RATE] [VOICE_OUTPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire IFFT Output ([IO_SAMPLE_RATE] [VOICE_OUTPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) }{ wire FFT VoiceEnhancer (freq [IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire VoiceEnhancer IFFT (freq [IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire IFFT ChannelSelector ([IO_SAMPLE_RATE] [VOICE_INPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) wire ChannelSelector Output ([IO_SAMPLE_RATE] [VOICE_OUTPUT_CHANNEL_COUNT] [IO_BLOCK_SIZE]) }] }] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Parameters ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [if [and [== [ENABLE_OCNS] 1] [and [== [VOICE_INPUT_CHANNEL_COUNT] 1] [== [IO_BLOCK_SIZE] [FFT_BLOCK_SIZE]]]] { param dnsp 0 out wireGraphParam dnsp (OCNS [kAUOneChannelNSParam_SpeechProbability]) }{}] param uspb 0 in wireGraphParam uspb (VoiceEnhancer [kSpeechEnh_Parameter_SpeechProb]) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Properties ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; property sebp in wireGraphProperty sebp (VoiceEnhancer [kAudioUnitProperty_BypassEffect] 0) property nois in wireGraphProperty nois (VoiceEnhancer [kSpeechEnh_Property_NoiseSpectrum] 0 0) property uebs in wireGraphProperty uebs (VoiceEnhancer [kSpeechEnh_Property_UplinkMaxFrameSize] 0 0) property uesr in wireGraphProperty uesr (VoiceEnhancer [kSpeechEnh_Property_UplinkSampleRate] 0 0)