license import * as tf from '@tensorflow/tfjs-core' ; import { BrowserFftSpeechCommandRecognizer } from './browser_fft_recognizer' ; import { playRawAudio } from './browser_fft_utils' ; import { concatenateFloat32Arrays } from './generic_utils' ; import { FFT_TYPE , SpeechCommandRecognizer , SpeechCommandRecognizerMetadata } from './types' ; import { normalizeFloat32Array , normalize } from './browser_fft_utils' ; param fftType param vocabulary param customModelArtifactsOrURL param customMetadataOrURL returns throws export function create ( fftType , vocabulary ? , customModelArtifactsOrURL ? , customMetadataOrURL ? ) { tf . util . assert ( customModelArtifactsOrURL == null && customMetadataOrURL == null || customModelArtifactsOrURL != null && customMetadataOrURL != null , ( ) => `customModelURL and customMetadataURL must be both provided or ` + `both not provided.` ) ; if ( customModelArtifactsOrURL != null ) { tf . util . assert ( vocabulary == null , ( ) => `vocabulary name must be null or undefined when modelURL ` + `is provided.` ) ; } if ( fftType === 'BROWSER_FFT' ) { return new BrowserFftSpeechCommandRecognizer ( vocabulary , customModelArtifactsOrURL , customMetadataOrURL ) ; } else if ( fftType === 'SOFT_FFT' ) { throw new Error ( 'SOFT_FFT SpeechCommandRecognizer has not been implemented yet.' ) ; } else { throw new Error ( `Invalid fftType: '${ fftType }'` ) ; } } const utils = { concatenateFloat32Arrays , normalizeFloat32Array , normalize , playRawAudio } ; export { BACKGROUND_NOISE_TAG , Dataset , GetDataConfig as GetSpectrogramsAsTensorsConfig , getMaxIntensityFrameIndex , spectrogram2IntensityCurve , SpectrogramAndTargetsTfDataset } from './dataset' ; export { AudioDataAugmentationOptions , Example , FFT_TYPE , RawAudioData , RecognizerParams , SpectrogramData , SpeechCommandRecognizer , SpeechCommandRecognizerMetadata , SpeechCommandRecognizerResult , StreamingRecognitionConfig , TransferLearnConfig , TransferSpeechCommandRecognizer } from './types' ; export { deleteSavedTransferModel , listSavedTransferModels , UNKNOWN_TAG } from './browser_fft_recognizer' ; export { utils } ; export { version } from './version' ;