LIFsCode / ELOC-3.0

Firmware for ELOC 3.0 Hardware
MIT License
2 stars 3 forks source link

Implement wav file writing control from Bluetooth #46

Closed OOHehir closed 6 months ago

OOHehir commented 7 months ago

Currently the recording of wav files is 'hard coded' as being continuous, i.e. starts at boot-up.

As previously discussed this needs to be set/ controllable from the config structure.

Should this be polled from main.cpp or will the Bluetooth code set this directly on change?

OOHehir commented 7 months ago

Additionally to this the setting "MicBitShift" seems redundant, the code uses a combination of I2S_BITS_PER_SAMPLE & I2S_DEFAULT_VOLUME which is mic specific.

Perhaps the mic volume should be 'settable' instead?

LIFsCode commented 7 months ago

Additionally to this the setting "MicBitShift" seems redundant, the code uses a combination of I2S_BITS_PER_SAMPLE & I2S_DEFAULT_VOLUME which is mic specific.

Perhaps the mic volume should be 'settable' instead?

@OOHehir @EDsteve : agree, I would suggest "MicVolume2^x" to indicate it will cause a power of 2 volume change.

in config e.g.

{
  "mic": {
    "MicType": "ns",
    "MicVolume2^x":3,
    "MicSampleRate": 20000,
    "MicUseAPLL": true,
    "MicUseTimingFix": true
  }
}

For the BT app I would hide this limitation and simply provide a drop down meue with available "volume gain" or "gain", e.g. 0, 2, 4, 8, etc.

OOHehir commented 7 months ago

@LIFsCode Thanks. I'm just working on this BT implementation, at least an initial 'draft'. Hope to have something pushed this evening.

OOHehir commented 7 months ago

@LIFsCode @EDsteve I've just made a commit that is hopefully a starting point for this issue.

The wav file 'mode' is now set in response to the button press (GPIO0). At the moment it toggle between continuous & disabled states, perhaps there is a requirement to also include 'single' (i.e. when the AI detection reaches a threshold)?

I haven't had a chance to test the Bluetooth interface yet, some mundane things to do at home here..

EDsteve commented 7 months ago

@OOHehir I have just tested the GPIO0 button and it does toggle between continous recording and disabled. -> works It does not stop recording right away though. It still finishes the "recording time per file" (which can be set in the app). So when this value is set to one minute. I still have to wait for it to finish the minute. That's not really practical if the recording time per file is set to 1 or 12 hours :) Would be much nicer, if the recording could stops right away after pressing the button.

OOHehir commented 7 months ago

@EDsteve Sure, understandable. I wasn't sure on the functionality required for this. Do you need the switch to cycle through the available modes or just disabled & continuous?

EDsteve commented 7 months ago

@OOHehir Actually this button is not too important for the end user. The user should use the app. It's more like a backup solution without app. Or for us to test things. So it should start/stop recording. And with a long press (or double press) start/stop detecting. But that's not a too important thing. But if you have other ideas about it. Let me know :)

OOHehir commented 7 months ago

@OOHehir I have just tested the GPIO0 button and it does toggle between continous recording and disabled. -> works It does not stop recording right away though. It still finishes the "recording time per file" (which can be set in the app). So when this value is set to one minute. I still have to wait for it to finish the minute. That's not really practical if the recording time per file is set to 1 or 12 hours :) Would be much nicer, if the recording could stops right away after pressing the button.

@EDsteve This is implemented in this commit.