PilferShush

nội dung

Basic information about how the SDKs code function. They start with a call to the Android/Java API that deals with audio recording and playback. From there with a buffer array full of some audio data, it can then be sent to a native code library that is also installed as part of the SDK. These libraries handle the more CPU intensive work such as sifting through the data using various common methods (Goertzel et al) to find audio signals of interest. This first section shows some of the Android/Java function calls and parameters used.

alphonso

ALPHONSO_VERSION = "2.0.46";

private static final int RECORDER\_AUDIO\_BYTES\_PER\_SEC = 16000;
private static final int RECORDER\_AUDIO\_ENCODING = 2;
private static final int RECORDER\_BIG\_BUFFER\_MULTIPLIER = 16;
private static final int RECORDER\_CHANNELS = 16;
private static final int RECORDER\_SAMPLERATE\_44100 = 44100;
private static final int RECORDER\_SAMPLERATE\_8000 = 8000;
private static final int RECORDER\_SMALL\_BUFFER\_MULTIPLIER = 4;
public static final byte ACR\_SHIFT\_186 = (byte) 0;
public static final byte ACR\_SHIFT\_93 = (byte) 1;
public static final int ACR\_SPLIT = 2;

bitsound
VERSION_NAME = "v4.2.2"

public void a(int i) {
  try {
    this.d = new AudioRecord(6, this.b, 16, 2, i);
    if (this.d.getState() == 1) {
      try {
        this.d.startRecording();
        if (this.d.getRecordingState() != 3) {
          b.c(a, "Audio recording startDetection fail");
          this.d.release();
          this.e = false;
          return;
        }
        a(this.d);
        this.e = true;
        return;

cifrasoft
VERSION_NAME = "1.0.3"

public static final int AUDIO\_BUFFER\_SIZE\_MULTIPLIER = 4;
public static final int AUDIO\_THREAD\_STOP\_TIMEOUT = 3000;
public static final int MAX\_EMPTY\_AUDIO\_BUFFER\_SEQUENTIAL\_READS = 10;
this.SAMPLE\_RATE = 44100;
private int readAudioData(int currentPcmOffset, byte\[\] pcm) {
  AudioRecordService.handler.sendEmptyMessageDelayed(1, 3000);
  int result = this.mAudioRecord.read(pcm, currentPcmOffset \* 2, this.bufferLength \* 2);
  AudioRecordService.handler.removeMessages(1);
  return result;
}

copsonic
CORE_VERSION = "SonicAuth_CORE_v1.2.2.1";

"signalType": "ULTRASONIC\_TONES",
"content" : {
    "frequencies" : \[ \[18000, 20000, "TwoTones"\] \]
"signalType": "ZADOFF\_CHU",
"content": {
  "config": {
    "samplingFreq": 44100,
    "minFreq": 18000,
    "maxFreq": 19850,
    "filterRolloff": 0.5,
    "totalSignalTime": 0.3,
    "nMsgSymbols": 2,
    "filterSpan": 8
  },
  "set": {
    "centralFreq": 18925,
    "nElemSamples": 36,
    "nSymbolElems": 181

dv (dov-e)
VERSION_NAME = "1.1.7"

private void recorderWork() {
  if (this.recordingActive) {
    int bytesReadNumber = this.myRecorder.read(this.myBuffer, 0, this.myBuffer.length);
    if (this.recordingActive) {
      DVSDK.getInstance().DVCRxAudioSamplesProcessEvent(this.myBuffer, 0, bytesReadNumber / 2);
    }
  }
}

fanpictor
VERSION_NAME = "3.2.3"

enum FNPFrequencyBand {
  Default,
  Low,
  High
}

fidzup

a. this.frequency = paramBasicAudioAnalyzerConfig.frequency;   // 19000.0f
b. this.samplingFrequency = paramBasicAudioAnalyzerConfig.samplingRate;    // 44100.0f
c. this.windowSize = paramBasicAudioAnalyzerConfig.windowSize;   // 0x200 (512)
d. /\* pulseDuration = 69.66f \*/
e. this.pulseWidth = Math.round(paramBasicAudioAnalyzerConfig.pulseDuration \* (this.samplingFrequency / 1000.0F));
f. this.pulseRatio = paramBasicAudioAnalyzerConfig.pulseRatio;   // 32.0f
/\* signalSize = 0x20 (32)
g. this.signalPeriodPulses = paramBasicAudioAnalyzerConfig.signalSize;
h. this.bitCounts = paramBasicAudioAnalyzerConfig.bitcounts;   // 0xb (11)
paramf.a = 19000.0F;            
paramf.b = 44100.0F;            
paramf.c = 512;                 
paramf.d = 69.66F;              
paramf.e = 0.33333334F;         
paramf.f = ((int)(paramf.d \* 32.0F \* 3.2F)); // 7133.184
paramf.g = 32;                 
paramf.h = new int\[\] { 15, 17, 19, 13, 11, 21, 23, 9, 7, 25, 27 };

fluzo VERSION = "1.3.001"

this.p = jSONObject.getInt("frame\_length\_milliseconds");
this.q = jSONObject.getInt("frame\_step\_milliseconds");
this.r = (float) jSONObject.getDouble("preemphasis\_coefficient");
this.s = jSONObject.getInt("num\_filters");
this.t = jSONObject.getInt("num\_coefficients");
this.u = jSONObject.getInt("derivative\_window\_size");

instreamatic VERSION_NAME = "7.16.0"

private static final int BUFFER\_SECONDS = 5;
private static int DESIRED\_SAMPLE\_RATE = 16000;

lisnr
VERSION_NAME = "5.0.1.1";

// LisnrIDTone          
public long calculateToneDuration() {
    return ((long) (((double) (this.lastIteration + 1)) \* 2.72d)) \* 1000;
}
// LisnrTextTone
public long calculateToneDuration() {
    return (long) (((this.text.length() \* 6) \* 40) + 1280);
}
// LisnrDataTone
public long calculateToneDuration() {
    return (long) (((this.data.length \* 6) \* 40) + 1280);
}
AudioRecord audioRecord = new AudioRecord(0, d, 16, 2, 131072);
ArrayAudioPlayer.this.audioOutput = new AudioTrack(3, ArrayAudioPlayer.this.samplerate, 4, 2, 16000, 1);
ArrayAudioPlayer.this.audioOutput.play();
int written = 0;
while (!ArrayAudioPlayer.this.threadShouldStop) {
  try {
    if (ArrayAudioPlayer.this.buffer.getBufferLeftToRead() > 0) {
      int size = ArrayAudioPlayer.this.buffer.getBufferLeftToRead();
      written += size;
      ArrayAudioPlayer.this.audioOutput.write(ArrayAudioPlayer.this.buffer.readFromBuffer(size), 0, size);
      } else {
        ArrayAudioPlayer.this.threadShouldStop = true;
      }
    } catch (IOException e) {
      e.printStackTrace();
    }

moodmedia
getVersion() = "1.2.1";

b = new AudioRecord(5, 44100, 16, 2, Math.max(AudioRecord.getMinBufferSize(44100, 16, 2) \* 4, 32768));
this.b = Type.SONIC;
this.b = Type.ULTRASONIC;
if (num.intValue() == 44100 || num.intValue() == 48000)
this.j.setName("Demodulator");
this.k.setName("Decoder");
this.l.setName("HitCounter");

prontoly (sonarax)
VERSION_NAME = "4.2.0";

contentValues.put("time", cVar.a);
contentValues.put("type", cVar.b.name());
contentValues.put(NotificationCompat.CATEGORY\_EVENT, cVar.c);
contentValues.put("communication\_type", cVar.d);
contentValues.put("sample\_rate", cVar.e);
contentValues.put("range\_mode", cVar.f);
contentValues.put("data", cVar.g);
contentValues.put("duration", cVar.h);
contentValues.put("count", cVar.i);
contentValues.put("volume", cVar.j);

realitymine
getSdkVersion = "5.1.6";

this.e = AudioRecord.getMinBufferSize(44100, 16, 2);
int i = this.e;
this.d = new byte\[i\];
this.c = new AudioRecord(1, 44100, 16, 2, i);

redbricklane (zapr)
SDK_VERSION = "3.3.0";

AudioRecord localAudioRecord = new AudioRecord(1, 8000, 16, 2, 122880);
if (localAudioRecord.getState() == 1) {
  this.logger.write\_log("Recorder initialized", "finger\_print\_manager");
  this.logger.write\_log("Recording started", "finger\_print\_manager");
  localAudioRecord.startRecording();

runacr
release = "1.0.4"

int minBufferSize = AudioRecord.getMinBufferSize(11025, 16, 2);
this.K = new AudioRecord(6, 11025, 16, 2, minBufferSize \* 10);

shopkick

.field bitDetectThreshold:Ljava/lang/Double;
.field carrierThreshold:Ljava/lang/Double;
.field detectThreshold:Ljava/lang/Double;
.field frFactors:Ljava/lang/String;
.field gapInSamplesBetweenLowFreqAndCalibration:Ljava/lang/Integer;
.field maxFracOfAvgForOne:Ljava/lang/Double;
.field maxIntermediates:Ljava/lang/Integer;
.field minCarriers:Ljava/lang/Integer;
.field noiseThreshold:Ljava/lang/Double;
.field numPrefixBitsRequired:Ljava/lang/Integer;
.field numSamplesToCalibrateWith:Ljava/lang/Integer;
.field presenceDetectMinBits:Ljava/lang/Integer;
.field presenceNarrowBandDetectThreshold:Ljava/lang/Double;
.field presenceStrengthRatioThreshold:Ljava/lang/Double;
.field presenceWideBandDetectThreshold:Ljava/lang/Double;
.field useErrorCorrection:Ljava/lang/Boolean;
.field wideBandPresenceDetectEnabled:Ljava/lang/Boolean;
.field highPassFilterType:Ljava/lang/Integer;
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setDopplerCorrectionEnabledParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setHighPassFilterEnabledParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setWideBandDetectEnabledParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setNumPrefixBitsRequiredParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setPresenceDetectNarrowBandDetectThresholdFCParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setGapInSamplesBtwLowFreqAndCalibFCParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setCarrierThresholdFCParam
Java\_com\_shopkick\_app\_presence\_NativePresencePipeline\_setHighPassFilterTypeHPFParam

signal360 (sonic notify)
VERSION_NAME = "4.90.123";

private static final int BUFFER\_SIZE = 131072;
private static final int FREQ\_STEPS = 128;
private static final int PAYLOAD\_LENGTH = 48;
private static final int READ\_BUFFER\_SIZE = 16384;
public static final int SAMPPERSEC = 44100;
private static final int STEP\_SIZE = 256;
private static final int TIMESTEPS\_PER\_CHUNK = 64;
private static final int USABLE\_LENGTH = 256;

silverpush
String d = "1.1.0";

for (int i : new int\[\]{4096, 8192}) {
  AudioRecord audioRecord = new AudioRecord(1, 44100, 16, 2, i);
  if (audioRecord.getState() == 1) {
    audioRecord.release();
    return i;
  }
}

soniccode
getVersion() { return "2.2"; }

// player
float\[\] decodeLocationFloat = decodeLocationFloat(str);
AudioTrack audioTrack = new AudioTrack(8, 44100, 2, 2, AudioTrack.getMinBufferSize(44100, 2, 2), 1);
this.audioGenerator = new STAudioGenerator();
this.audioGenerator.setAudioTrack(audioTrack);
this.audioGenerator.setAmplitude(this.\_amplitude);
this.audioGenerator.setBlockTime(this.\_blockTime);
this.audioGenerator.setFrequencies(decodeLocationFloat);

soundpays
SDK_VERSION = "2.0"

this.a.a(18400.0f, 20000.0f);
this.a.a(new float\[\]{18475.0f, 18550.0f, 18625.0f, 18700.0f, 18775.0f, 18850.0f, 18925.0f, 19000.0f, 19075.0f, 19150.0f, 19225.0f, 19300.0f, 19375.0f, 19450.0f, 19525.0f, 19600.0f, 19675.0f, 19750.0f, 19825.0f, 19900.0f});

tonetag
String f = "2.1.3"

if (stringBuilder2.matches("^\[0-9\]{1,5}\[.\]\[0-9\]{1,2}$"))
this.aY = new AudioRecord(1, 44100, 16, 2, 50000);
private static native void initRecordingNative(int i, int i2, int i3, String str);
private static native void initRecordingUltraToneNative(int i, int i2, String str);
private native void processUltraFreqsNative(double\[\] dArr, String str);
\_8KHZ(40),
\_10KHZ(50),
\_12KHZ(60),
\_14KHZ(70),
\_16KHZ(80),
\_18KHZ(90);              

trillbit
VERSION_NAME = "1.0";

private static final int SAMPLE\_RATE = 44100;
private static final String TAG = "AutoToneDetectorClass";
private static final int WINDOW\_SIZE = 4096;
private static final int CHUNKS\_AFTER\_TRIGGER = 23;
private static final int CHUNKS\_BEFORE\_TRIGGER = 2;
private static final int CHUNK\_SIZE = 4096;
this.recorder = new AudioRecord(this.AUDIO\_SOURCE, SAMPLE\_RATE, 16, 2, 4096);
int recorderState = this.recorder.getState();
Log.i(TAG, "RECORDER STATE : " + String.valueOf(recorderState));
if (recorderState == 1) {
  try {
    this.recorder.startRecording();
    Log.i(TAG, "Recording Started");
    startAsyncTasks();
  } catch (Exception e) {
    e.printStackTrace();
  }
} 
try {
  data = new DataPart("temp.mp3", UploadToServer.this.getDatafromFile(str));
} catch (IOException e) {
  e.printStackTrace();
}
params.put("mp3file", data);
return params; 
Log.d("V2", "Sending Information to backend");
js.put("Device", Build.MANUFACTURER + " " + Build.MODEL);
js.put("audio\_chunks", jsonArr);
js.put("MIC\_SRC", "MIC");
js.put("FREQ\_PLAYED", "3730");
js.put("MIN\_BUFFER", "4096");
int\[\] original = new int\[\]{5, 5, 1, 2, 3, 4};
Tóm tắt
The article discusses how SDKs code functions by starting with a call to the Android/Java API for audio recording and playback. The audio data is then sent to a native code library within the SDK for CPU-intensive tasks like analyzing audio signals. Various SDKs like Alphonso, Bitsound, Cifrasoft, Copsonic, DV, Fanpictor, Fidzup, Fluzo, Instreamatic, Lisnr, Moodmedia, Prontoly, Realitymine, and Redbricklane have different versions and features related to audio processing. Each SDK has specific parameters and methods for handling audio data, such as buffer sizes, sampling rates, and signal processing techniques like Goertzel. The article provides snippets of code from different SDKs showcasing functions like audio recording, signal processing, and data analysis.