Home
last modified time | relevance | path

Searched refs:bytesPerSecond (Results 1 – 3 of 3) sorted by relevance

/development/samples/VoiceInteractionService/src/com/example/android/voiceinteractor/
DAudioUtils.java30 static int read(AudioRecord record, int bytesPerSecond, float secondsToRead, byte[] buffer) { in read() argument
31 Log.i(TAG, "read(): bytesPerSecond=" + bytesPerSecond in read()
38 (int) (bytesPerSecond * AUDIO_RECORD_READ_DURATION.getSeconds())); in read()
41 + (bytesPerSecond * AUDIO_RECORD_READ_DURATION.getSeconds())); in read()
48 int curSecond = numBytes / bytesPerSecond; in read()
50 && numBytes > (bytesPerSecond * curSecond) + 10) { in read()
53 buffer, bytesPerSecond * curSecond, in read()
54 (bytesPerSecond * curSecond) + 10))); in read()
57 if ((numBytes * 1.0 / bytesPerSecond) >= secondsToRead) { in read()
59 + ", secondsRead=" + (numBytes * 1.0 / bytesPerSecond)); in read()
DSampleHotwordDetectionService.java50 int bytesPerSecond, in createAudioRecord() argument
52 int audioRecordBufferSize = getBufferSizeInBytes(bytesPerSecond, in createAudioRecord()
55 + ", lengthSeconds=" + (audioRecordBufferSize / bytesPerSecond)); in createAudioRecord()
69 private static int getBufferSizeInBytes(int bytesPerSecond, float bufferLengthSeconds) { in getBufferSizeInBytes() argument
70 return (int) (bytesPerSecond * bufferLengthSeconds); in getBufferSizeInBytes()
92 int bytesPerSecond = in onDetect() local
107 AudioRecord record = createAudioRecord(eventPayload, bytesPerSecond, sessionId); in onDetect()
115 byte[] buffer = new byte[bytesPerSecond * (int) DSP_AUDIO_READ_DURATION.getSeconds()]; in onDetect()
116 Log.d(TAG, "starting read: bytesPerSecond=" + bytesPerSecond in onDetect()
122 AudioUtils.read(record, bytesPerSecond, DSP_AUDIO_READ_DURATION.getSeconds(), buffer); in onDetect()
DSampleVoiceInteractionService.java70 private static AudioRecord createAudioRecord(EventPayload eventPayload, int bytesPerSecond) { in createAudioRecord() argument
71 int audioRecordBufferSize = getBufferSizeInBytes(bytesPerSecond, in createAudioRecord()
74 + ", lengthSeconds=" + (audioRecordBufferSize / bytesPerSecond)); in createAudioRecord()
86 private static int getBufferSizeInBytes(int bytesPerSecond, float bufferLengthSeconds) { in getBufferSizeInBytes() argument
87 return (int) (bytesPerSecond * bufferLengthSeconds); in getBufferSizeInBytes()
219 int bytesPerSecond = in onDetected() local
236 AudioRecord record = createAudioRecord(eventPayload, bytesPerSecond); in onDetected()
246 byte[] buffer = new byte[bytesPerSecond * (int) AUDIO_READ_DURATION.getSeconds()]; in onDetected()
251 int numBytes = AudioUtils.read(record, bytesPerSecond, AUDIO_READ_DURATION.getSeconds(), in onDetected()
266 Log.i(TAG, "numBytes=" + numBytes + " audioSeconds=" + numBytes * 1.0 / bytesPerSecond); in onDetected()