code wiki / _hdl_build / nx_audio_binaural_beats.nx
nx_audio_binaural_beats.nx
buildroot/runtime/_hdl_build/nx_audio_binaural_beats.nx
about
nx_audio_binaural_beats.nx -- binaural BEATS generator (operator 2026-06-23: s-class audio ecosystem + s-class
self-hypnosis help). Two PURE SUSTAINED tones, one per ear at slightly different frequencies (L=200Hz, R=207Hz)
-> the brain perceives a 7Hz THETA beat = a classic relaxation / self-hypnosis induction aid (the audio
ecosystem powering hypnosis). Sustained sines via a 2nd-order resonator with r=1 (no decay); fade in/out to
avoid clicks; our own RIFF writer. Sovereign, no float. license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_audio_wav.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 7 | const K_MAGIC_411774: i64 = 411774 |
| 9 | const OUTP: *u8 = "web_assets/ng_binaural_beats_theta.wav" |
| 10 | const Q16: i64 = 65536 |
| 11 | const SR: i64 = 22050 |
| 12 | const NS: i64 = 88200 // 4.0 s |
| 13 | const FBASE: i64 = 200 // left ear Hz |
| 14 | const FBEAT: i64 = 7 // beat Hz -> right ear = 207 Hz (theta, relaxation) |
| 15 | const AMP: i64 = 10000 |
functions
| 17 | func bp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 18 | func bpn(v: i64) -> i64 called by 1: main |
| 26 | func b_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: main |
| 27 | func bqm(a: i64, b: i64) -> i64 { return (a*b)>>16 } |
| 28 | func cos_fp(x: i64) -> i64 { let x2: i64=bqm(x,x); let x4: i64=bqm(x2,x2); return Q16 - (x2>>1) + (x4/24) } |
| 29 | func sin_fp(x: i64) -> i64 { let x2: i64=bqm(x,x); let x3: i64=bqm(x2,x); return x - (x3/6) } |
| 32 | func gen_tone(buf: *i64, f: i64) -> i64 |
| 51 | func zero_cross(buf: *i64) -> i64 called by 1: main |
| 57 | func main() -> i64 |