Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
57e319a
comments, calling volume detector at 66hz
benejoseph Sep 30, 2016
e1f1c68
don't race the alarm with the voice connection refresh
Sep 30, 2016
507b216
Merge pull request #624 from hello/alarmrace
plasticchris Sep 30, 2016
3f021ee
removed unused stuff in audiofeatures, lots of cleanup
benejoseph Sep 30, 2016
7180d64
more cleanup, compiles
benejoseph Oct 1, 2016
147a26d
no lpc
Oct 1, 2016
ab7d54a
default volume to 60
Oct 1, 2016
3fc0d37
Merge branch 'master' of https://github.com/hello/kitsune
Oct 1, 2016
5f814d1
Merge branch 'master' into lossless
Oct 1, 2016
ef4018d
new pb
Oct 1, 2016
80c085e
Merge branch 'losslessww' into lossless
Oct 1, 2016
75a8b8f
more pb change
Oct 1, 2016
e841974
bad merge
Oct 1, 2016
14dd9f9
new pb
Oct 1, 2016
b9b5988
make it work
Oct 2, 2016
8b31941
add back the pb
Oct 2, 2016
5caf7dd
use the return code from the output stream only
Oct 3, 2016
1358056
move memory around to get one second of wakeup word
Oct 3, 2016
ed4d77e
decrease default volume
Oct 3, 2016
45dc127
Merge pull request #629 from hello/new_vol
plasticchris Oct 3, 2016
e973056
differential spk output
divkam Oct 3, 2016
77d5bd3
clean up
divkam Oct 3, 2016
7f404fd
remove unused defines
divkam Oct 3, 2016
3674cc6
fix DMA end pointer
divkam Oct 3, 2016
4ff5b53
Best to not use DMACHIS register
divkam Oct 3, 2016
a923ea2
register cleared by MAP_I2SIntClear()
divkam Oct 3, 2016
3d4089e
remove top boot flag
Oct 3, 2016
bc36e9d
defines for interrupt status bit mask
divkam Oct 3, 2016
b0a8b46
remove unused
divkam Oct 3, 2016
95903d7
update constants to account for change in sample siz
Oct 3, 2016
764995a
format is for server response
Oct 3, 2016
bf2037a
Merge pull request #628 from hello/newspeechpb
plasticchris Oct 3, 2016
6e6e463
Merge pull request #633 from hello/update_eos_defines
zer0page Oct 3, 2016
7f4196a
Merge pull request #630 from hello/spk-out-differential
divkam Oct 3, 2016
d6c46b8
Merge remote-tracking branch 'refs/remotes/origin/master' into notify…
Oct 3, 2016
87b1634
Revert "remove top boot flag"
Oct 3, 2016
16e0d66
Revert "Revert "remove top boot flag""
Oct 3, 2016
10ad8b0
moar cleanup, now audio is calibrated
benejoseph Oct 3, 2016
a20e969
ReadBuffer instead of memcpy
divkam Oct 3, 2016
e41073c
Revert "Revert "Revert "remove top boot flag"""
Oct 4, 2016
ad748ab
top ota bypass boo
Oct 4, 2016
3760b4b
more honest reporting of disturbance time in ms
benejoseph Oct 4, 2016
6d1fe2a
do not update if file doesnt work
Oct 4, 2016
3574fd0
do not need
Oct 4, 2016
18ffae6
Revert "do not need"
Oct 4, 2016
0687c65
v2 endpoint
Oct 4, 2016
0405242
fixed index calc for A-weighting
benejoseph Oct 4, 2016
971d37e
averaging loudness over 4 frames to match human perception
benejoseph Oct 4, 2016
aa78198
use system volume for alarm
Oct 5, 2016
6b4f876
fix compile
Oct 5, 2016
6746c43
Merge pull request #634 from hello/alarm_use_system_volume
plasticchris Oct 5, 2016
ec26919
Merge pull request #632 from hello/audio-dma-clean-up
plasticchris Oct 6, 2016
435422c
Merge pull request #631 from hello/notify_top_boot
plasticchris Oct 6, 2016
808cf5a
put back in neural net print statements
benejoseph Oct 6, 2016
1241af9
octogram crap only in octogram
benejoseph Oct 6, 2016
c0be3bc
changed AUDIO_FFT_SIZE --> OCTOGRAM_FFT_SIZE
benejoseph Oct 6, 2016
3e964f0
oops, one more change in octogram vs audio naming
benejoseph Oct 6, 2016
67526c6
stub
Oct 6, 2016
64a8865
Merge pull request #623 from hello/equivalent-volume-and-disturbance-…
plasticchris Oct 7, 2016
f0e6d51
adjust TMG4903 settings to improve light_off results:
mburnshello Oct 7, 2016
270d40a
Merge pull request #637 from hello/sense_in_motion
plasticchris Oct 7, 2016
c96c350
Merge pull request #638 from hello/light_off_fix
plasticchris Oct 7, 2016
3342045
another net update from david
Oct 7, 2016
62dfccf
Merge remote-tracking branch 'origin/master' into another-net
Oct 7, 2016
962dd68
compensate temperature before pressure, so that t_fine is up to date
mburnshello Oct 7, 2016
e0439f1
update duration, threshold
Oct 7, 2016
ff3c52f
Merge pull request #640 from hello/pressure_fix
plasticchris Oct 7, 2016
1475b1c
Merge pull request #639 from hello/another-net
plasticchris Oct 7, 2016
dad4d07
hack stuff up
Oct 8, 2016
d355ceb
weird place
Oct 10, 2016
e0e131d
reduce volume
Oct 11, 2016
a40440d
volume
Oct 11, 2016
2b5bc44
play sound before starting control task
Oct 11, 2016
33c08ef
decrease light off threshold
divkam Oct 11, 2016
6fbfce1
overflow fixes in tinytensor
benejoseph Oct 11, 2016
f3148c4
preinit als
Oct 11, 2016
e3c77ec
added function to return an estimate of the lx
Oct 11, 2016
c2f485c
led use adjusted brightness
Oct 11, 2016
fa46984
lights out detection use combined lights
Oct 11, 2016
30001c2
comments
divkam Oct 11, 2016
fbcb407
fix IR calc
divkam Oct 11, 2016
24e83bb
disable median filter for wave
Oct 11, 2016
2a68a02
decrease light level
Oct 11, 2016
38038d0
max light adjust
Oct 11, 2016
a064e90
lpf
Oct 11, 2016
8b0c9b3
better softmax
benejoseph Oct 11, 2016
ef8b2e5
somehow an include got removed
benejoseph Oct 11, 2016
5362662
use white light
Oct 11, 2016
6849efa
rez connected ssid
Oct 11, 2016
b532a87
Revert "disable median filter for wave"
Oct 11, 2016
195d4f4
raised thresholds for stop and snooze since network is working properly
benejoseph Oct 11, 2016
32fe447
Merge pull request #645 from hello/tinytensor-overflow-fixes
benejoseph Oct 11, 2016
25a54f6
do not use lpf for lights off detection
Oct 11, 2016
c917eb3
reduced threshold for black sense
Oct 12, 2016
612970d
fade smoothly if audio upload err
divkam Oct 12, 2016
bb52eb3
Revert "decrease light off threshold"
divkam Oct 12, 2016
444b6d9
Merge pull request #644 from hello/combined_powers
zer0page Oct 12, 2016
fb1a1bd
optimal thresholds based on training data with fixed tinytensor
benejoseph Oct 12, 2016
b7d5120
lowering AGC target gain to reduce false positives
benejoseph Oct 12, 2016
54b2482
further tweak of target gain
benejoseph Oct 12, 2016
98f1e79
is harder
Oct 12, 2016
63c39f9
show impul
Oct 12, 2016
aefede5
divide instead of right shift
divkam Oct 13, 2016
d68b711
Merge pull request #647 from hello/fix-lights-out
divkam Oct 13, 2016
90e4144
Merge pull request #648 from hello/harder_to_wave
zer0page Oct 13, 2016
f28a2cc
lower nominal gain + comments
benejoseph Oct 13, 2016
8f71040
Merge pull request #649 from hello/optimal-thresholds-for-fixed-tinyt…
benejoseph Oct 13, 2016
270c3ad
from 20 to 35
benejoseph Oct 13, 2016
07d4e6f
35 --> 40
benejoseph Oct 13, 2016
bbe4872
Merge pull request #650 from hello/higher-agc-target
benejoseph Oct 13, 2016
c3f1e92
only upload on right keyword
Oct 13, 2016
c5d4a21
sys vol update fixed, cmd to get sys vol
divkam Oct 13, 2016
535c2ac
Merge remote-tracking branch 'origin/master' into div-fix-vol
divkam Oct 13, 2016
7d5f77e
revert change
divkam Oct 13, 2016
be7c1df
Merge pull request #652 from hello/div-fix-vol
divkam Oct 13, 2016
3591f3c
Merge pull request #651 from hello/STAHP
zer0page Oct 13, 2016
b2a41a4
cap the volume
Oct 13, 2016
96aa6e0
flush led anim during voice command
divkam Oct 13, 2016
59db1e8
clamp both sides
Oct 13, 2016
248f6b7
revert. this ends animation too soon
divkam Oct 13, 2016
0588670
Merge pull request #653 from hello/cap_volume
zer0page Oct 13, 2016
185b0c4
Merge pull request #642 from hello/make_startup_sound_again
zer0page Oct 14, 2016
61327fa
log error
Oct 14, 2016
0a1419b
use enum
Oct 14, 2016
7a48a73
avoid floating poin
Oct 14, 2016
04e9e14
more sensitive for black senses
Oct 14, 2016
7761e83
no not need to keep setting
Oct 14, 2016
7f8b057
Merge pull request #655 from hello/tweaks
zer0page Oct 14, 2016
f179678
Merge pull request #654 from hello/fix-led-anim
divkam Oct 14, 2016
6d39f68
trying to cast and int32 to an int16 without checking overflow is a b…
benejoseph Oct 15, 2016
5518cc9
new net, fewer false positives
benejoseph Oct 15, 2016
c403ccb
revert agc gain change. STOP works much better at AGC target of 50
benejoseph Oct 15, 2016
abd69fd
Merge pull request #657 from hello/nn-softmax-overflow
plasticchris Oct 15, 2016
b41f7b5
all large weights to the weights section of memory
benejoseph Oct 15, 2016
a42d0ff
Merge pull request #658 from hello/even-fewer-false-positives
plasticchris Oct 15, 2016
97771cd
Merge branch 'master' into losslessww
Oct 17, 2016
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
67 changes: 0 additions & 67 deletions kitsune/audio_codec_pps_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,36 +149,10 @@ static const reg_value REG_Section_program[] = {
{ 3,0x00},
// # reg[0][1][4 ] = 0x00 ; reg(0)(1)(0x04 => 4 ) RDAC FIR
{ 4,0x00},
#if 0
// # reg[0][1][31] = 0x80 ; reg(0)(1)(0x1F =>31 ) HP in ground Centered mode; HPL gain 0 dB
{ 31,0x80},
// # reg[0][1][32] = 0x00 ; reg(0)(1)(0x20 =>32 ) HPR independent gain 0 dB
{ 32,0x00},
// # reg[0][1][33] = 0x28 ; reg(0)(1)(0x21 =>33 ) Charge pump runs on Osc./4
{ 33,0x28},
// # reg[0][1][34] = 0x33 ;0x3e ; reg(0)(1)(0x22 =>34 ) Set CP mode
{ 34,0x33},
// # reg[0][1][35] = 0x10 ; reg(0)(1)(0x23 =>35 ) Power up CP with HP
{ 35,0x10},
// # reg[0][1][52] = 0x40 ; reg(0)(1)(0x34 => 52) ADC IN1_L is selected for left P
{ 52,0x40},
// # reg[0][1][54] = 0x40 ; reg(0)(1)(0x36 => 54) ADC CM1 is selected for left M
{ 54,0x40},
// # reg[0][1][55] = 0x40 ; reg(0)(1)(0x37 => 55) ADC IN1_R is selected for right P
{ 55,0x40},
// # reg[0][1][57] = 0x40 ; reg(0)(1)(0x39 => 57) ADC CM1 is selected for right M
{ 57,0x40},

#endif
// # reg[0][1][121] = 0x33 ; reg(0)(1)(0x79 => 121) Quick charge time for Mic inputs
{121,0x33},
// # reg[0][1][122] = 0x01 ; reg(0)(1)(0x7A => 122) Vref charge time - 40 ms.
{122,0x01},
#if (KITSUNE_CODE==1)
#if 0
{ 51, (4<<0)},
#endif
#endif
};

static const reg_value REG_Section_program2[] = {
Expand Down Expand Up @@ -227,13 +201,6 @@ static const reg_value REG_Section_program2[] = {
{ 63,0xC2},
// # reg[0][0][64] = 0x00 ; reg(0)(0)(0x40 => 64) DAC Left and Right DAC unmuted with indep. vol. ctrl
{ 64,0x00},
#if (KITSUNE_CODE==1)
#if 0
// digital volume control
{ 65, 0x30},
{ 66, 0x30},
#endif
#endif
// # reg[0][0][81] = 0xd6 ; reg(0)(0)(0x51 => d6) ADC Powerup ADC left and right channels in Digital mode(soft-stepping disable)
{ 81,0xD6},
// # reg[0][0][82] = 0x00 ; reg(0)(0)(0x51 => 81) ADC Powerup ADC left and right channels (soft-stepping disable); reg(0)(0)(0x52 => 82) ADC Unmute ADC left and right channels,L,R fine gain=0dB
Expand All @@ -246,8 +213,6 @@ static const reg_value REG_Section_program2[] = {
{ 45,0x06},
// # reg[0][1][46] = 0x0C ; -6db
{ 46,0x0C},
// # reg[0][1][47] = 0x0C ;
{ 47,0x0C},
#if (MUTE_SPK==1)
// # reg[0][1][48] = 0x21 ; 12db
{ 48,0x00},
Expand Down Expand Up @@ -358,38 +323,6 @@ static const reg_value REG_Section_program2[] = {

// # reg[0][0][82] = 0
{ 82,0x00},
#if 0 // AGC
// # reg[0][0][86] = 32
{ 86,0x20},
// # reg[0][0][87] = 254
{ 87,0xFE},
// # reg[0][0][88] = 0
{ 88,0x00},
// # reg[0][0][89] = 104
{ 89,0x68},
// # reg[0][0][90] = 168
{ 90,0xA8},
// # reg[0][0][91] = 6
{ 91,0x06},
// # reg[0][0][92] = 0
{ 92,0x00},
// # reg[0][0][84] = 0
{ 84,0x00},
// # reg[0][0][94] = 32
{ 94,0x20},
// # reg[0][0][95] = 254
{ 95,0xFE},
// # reg[0][0][96] = 0
{ 96,0x00},
// # reg[0][0][97] = 104
{ 97,0x68},
// # reg[0][0][98] = 168
{ 98,0xA8},
// # reg[0][0][99] = 6
{ 99,0x06},
// # reg[0][0][100] = 0
{100,0x00},
#endif
};

const static reg_value miniDSP_A_reg_values[] = {
Expand Down
47 changes: 5 additions & 42 deletions kitsune/audio_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,9 @@
#define MIN_CLASSIFICATION_ENERGY (100)


#define AUDIO_FFT_SIZE_2N (8)
#define AUDIO_FFT_SIZE (1 << AUDIO_FFT_SIZE_2N)
#define EXPECTED_AUDIO_SAMPLE_RATE_HZ (AUDIO_SAMPLE_RATE)

#define SAMPLE_RATE_IN_HZ (EXPECTED_AUDIO_SAMPLE_RATE_HZ / AUDIO_FFT_SIZE)
#define SAMPLE_RATE_IN_HZ (66)
#define SAMPLE_PERIOD_IN_MILLISECONDS (1000 / SAMPLE_RATE_IN_HZ)

#define NUM_AUDIO_FEATURES (16)

#define OCTOGRAM_SIZE (AUDIO_FFT_SIZE_2N - 1)

/*
// use simplelink.h instead
#define TRUE (1)
Expand All @@ -37,39 +29,13 @@
extern "C" {
#endif

typedef struct {
uint16_t psd_min_energy;

} AudioFeaturesOptions_t;

typedef struct {
uint16_t min_energy_classification;
} AudioClassifierOptions_t;

typedef enum {
segmentCoherent
} ESegmentType_t;

typedef struct {
int64_t t1;
int64_t t2;
int32_t duration;
ESegmentType_t type;

} Segment_t;

typedef struct {
int64_t samplecount;
int64_t samplecount;
int16_t logenergy;
int8_t feats4bit[NUM_AUDIO_FEATURES];
} AudioFeatures_t;


/* FOR SAVING AUDIO / UPLOADING AUDIO
*
* Yes, some of these flags are mutually exclusive. Others aren ot.
*/

#define AUDIO_TRANSFER_FLAG_AUTO_CLOSE_OUTPUT (1 << 0) /* automatically close output stream when done */


Expand All @@ -89,21 +55,18 @@ typedef struct {
uint32_t unix_time;
} DeviceCurrentInfo_t;

typedef struct {
int32_t logenergy[OCTOGRAM_SIZE];
} OctogramResult_t;

typedef struct {
int32_t num_disturbances;
int32_t num_samples;
int32_t peak_energy;
int32_t peak_background_energy;
int32_t disturbance_time_count;
uint8_t isValid;
} AudioOncePerMinuteData_t;
} AudioEnergyStats_t;

typedef void (*SegmentAndFeatureCallback_t)(const int16_t * feats, const Segment_t * pSegment);
typedef void (*AudioFeatureCallback_t)(const AudioFeatures_t * pfeats);
typedef void (*AudioOncePerMinuteDataCallback_t) (const AudioOncePerMinuteData_t * pdata);
typedef void (*AudioEnergyStatsCallback_t) (const AudioEnergyStats_t * pdata);
typedef void (*NotificationCallback_t)(void * context);
typedef void (*RecordAudioCallback_t)(const AudioCaptureDesc_t * request);

Expand Down
Loading