Libraryless. Click here for Pure Java version (14642L/101K).
!7 import static x30_pkg.x30_util.VF1; sclass NoticeLoudNoise > DynPrintLog { float threshold = 20f; transient VF1<short[]> audioListener; transient float lastVolume; transient Q q; void start { ownTimer(q = startQ()); audioListener = voidfunc(short[] data) { // Quickly calculate the volume final float vol = shortSamplesToPercentVolume(data); // Do everything else in our own thread q.add(r { //print("vol: " + vol); if (vol >= threshold && lastVolume < threshold) printWithTime("Got noise (" + iround(vol) + "%)"); lastVolume = vol; }); }; // Link to audio input module dm_addAudioListener(audioListener); } }
Began life as a copy of #1016700
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017157 |
Snippet name: | Notice Loud Noise [Dyn Module] |
Eternal ID of this version: | #1017157/10 |
Text MD5: | 91f9d0e9b3f3d3f2be6173c6b389096a |
Transpilation MD5: | fb4fcc2c888e4fffbf0403ee7bacd6df |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-13 13:40:05 |
Source code size: | 757 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 418 / 549 |
Version history: | 9 change(s) |
Referenced in: | [show references] |