code wiki / _hdl_build / nx_audio_beats_variants.nx
nx_audio_beats_variants.nx
buildroot/runtime/_hdl_build/nx_audio_beats_variants.nx
about
nx_audio_beats_variants.nx -- generate a SET of binaural-beat tracks (operator: "generate new options if they
tire of the current" -> give shuffle/new real variety). Each = two sustained pure tones (L=base, R=base+beat)
via an r=1 resonator -> the brain hears the BEAT frequency. delta (deep), alpha (relaxed focus), beta (alert).
Sovereign, no float, our own RIFF writer. Outputs web_assets/ng_beats_<name>.wav. 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
| 6 | const K_MAGIC_411774: i64 = 411774 |
| 8 | const Q16: i64 = 65536 |
| 9 | const SR: i64 = 22050 |
| 10 | const NS: i64 = 88200 // 4.0 s |
| 11 | const AMP: i64 = 10000 |
functions
| 13 | func vp(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 |
| 14 | func vpn(v: i64) -> i64 called by 1: main |
| 22 | func b_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } |
| 23 | func bqm(a: i64, b: i64) -> i64 { return (a*b)>>16 } |
| 24 | func cos_fp(x: i64) -> i64 { let x2: i64=bqm(x,x); let x4: i64=bqm(x2,x2); return Q16 - (x2>>1) + (x4/24) } |
| 25 | func sin_fp(x: i64) -> i64 { let x2: i64=bqm(x,x); let x3: i64=bqm(x2,x); return x - (x3/6) } |
| 27 | func gen_tone(buf: *i64, f: i64) -> i64 |
| 42 | func gen_track(path: *u8, fbase: i64, fbeat: i64) -> i64 |
| 53 | func main() -> i64 |