code wiki / (root) / nx_audio_osc.nx

nx_audio_osc.nx

buildroot/runtime/nx_audio_osc.nx

4280 B101 linesdepth 2pulls 2 transitivereach 230 importersview sourcekind librarytopic audio
docsdependenciesstructsconstsfunctions

about

nx_audio_osc.nx -- SOVEREIGN AUDIO ENGINE rung R3: oscillators (synth source). Generates waveforms via a phase accumulator -- the source side of synthesis (the mixer/resampler/pan are the processing side). Square/saw/triangle are trig-free integer math; sine (table/approx) is a later rung. Phase is Q16 in [0, OSC_PHASE); phase increment = freq*OSC_PHASE/rate. Amplitude in i16 range. license_tier: ORIGINAL.

dependencies 1 imports · 71 importers

nx_syscalls.nx nx_audio_osc.nx nx_audio_bark.nx nx_audio_critters.nx nx_audio_demo_test.nx nx_audio_osc_test.nx nx_audio_wav_test.nx nx_bioacoustic_bench.nx nx_fft.nx nx_game_page_affine_candidate_t361 nx_game_page_authored_material_t54 nx_game_page_body_t138.nx

diagram shows first 10 each side; +0 more imports, +61 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_audio_bark.nxnx_audio_critters.nxnx_audio_demo_test.nxnx_audio_osc_test.nxnx_audio_wav_test.nxnx_bioacoustic_bench.nxnx_fft.nxnx_game_page_affine_candidate_t361.nxnx_game_page_authored_material_t54.nxnx_game_page_body_t138.nxnx_game_page_canonical_t135.nxnx_game_page_catwalk_lighting_candidate_t316.nxnx_game_page_emit.nxnx_game_page_emit_sand_review.nxnx_game_page_eye_t138.nxnx_game_page_gait_candidate_t139.nxnx_game_page_garment_t132.nxnx_game_page_gpu_timing_current_candidate.nxnx_game_page_gpu_timing_pool_candidate.nxnx_game_page_hair_attachment_candidate_t263.nxnx_game_page_hair_attachment_t283.nxnx_game_page_hair_guides_candidate_t263.nxnx_game_page_hair_t138.nxnx_game_page_host_candidate_t341.nxnx_game_page_identity_candidate.nxnx_game_page_imported_body_t45.nxnx_game_page_imported_t262.nxnx_game_page_inspection_distance_t235.nxnx_game_page_inspection_t142.nxnx_game_page_integrated_t73.nxnx_game_page_knight_bind_t25.nxnx_game_page_knight_feedback_t28.nxnx_game_page_knight_feedback_t29.nxnx_game_page_knight_support_t31.nxnx_game_page_knight_support_t31_before_t44.nxnx_game_page_length_diag_t140.nxnx_game_page_lit_candidate_t181.nxnx_game_page_material_body_t61.nxnx_game_page_material_candidate_t181.nxnx_game_page_material_compose_t55.nxnx_game_page_material_schema_candidate_t181.nxnx_game_page_metadata_candidate_t220.nxnx_game_page_mip_candidate_t241.nxnx_game_page_motion_candidate_t328.nxnx_game_page_motion_inventory_candidate_t330.nxnx_game_page_move_t72.nxnx_game_page_owned_candidate_t181.nxnx_game_page_pipeline_t64.nxnx_game_page_pre_inspection_t142.nxnx_game_page_pre_toon_region_t143.nxnx_game_page_procedural_review_candidate_t333.nxnx_game_page_recovery_feedback_t28.nxnx_game_page_recovery_t23.nxnx_game_page_rig_comparison_t332.nxnx_game_page_rig_inspection_t230.nxnx_game_page_rig_observation_candidate_t331.nxnx_game_page_scene_light_candidate_t364.nxnx_game_page_search_t53.nxnx_game_page_shared_candidate_t340.nxnx_game_page_skin_t138.nxnx_game_page_static_candidate_t338.nxnx_game_page_toon_region_candidate_t143.nxnx_game_page_visitors_inspection_t142.nxnx_game_page_visitors_t140.nxnx_game_page_workbench_candidate_t342.nxnx_game_page_workspace_body_t49.nxnx_game_page_workspace_body_t59.nxnx_game_page_workspace_t48.nxnx_mdct.nxnx_movement_base_page_t139.nxnx_perceptual.nx

structs

none

consts

10const OSC_MAGIC_5040: i64 = 5040
11const OSC_MAGIC_65536: i64 = 65536
12const OSC_MAGIC_40320: i64 = 40320
13const OSC_MAGIC_32768: i64 = 32768
14const OSC_MAGIC_16384: i64 = 16384
15const OSC_MAGIC_411774: i64 = 411774
16const OSC_MAGIC_51472: i64 = 51472
17const OSC_MAGIC_102944: i64 = 102944
19const OSC_PHASE: i64 = 65536 // one cycle (Q16)

functions

22func osc_square(out: *i64, n: i64, freq: i64, rate: i64, amp: i64) -> i64
called by 3: mainmainmain
37func osc_saw(out: *i64, n: i64, freq: i64, rate: i64, amp: i64) -> i64
called by 2: mainmain
51func osc_triangle(out: *i64, n: i64, freq: i64, rate: i64, amp: i64) -> i64
called by 1: main
67func osc_qm(a: i64, b: i64) -> i64 { return (a * b) >> 16 }
called by 2: osc_sin_sosc_cos_s
68func osc_sin_s(x: i64) -> i64 { let x2: i64=osc_qm(x,x); let x3: i64=osc_qm(x2,x); let x5: i64=osc_qm(x3,x2); let x7: i64=osc_qm(x5,x2); return x - x3/6 + x5/120 - x7/OSC_MAGIC_5040 }
called by 1: osc_sin_unit calls 1: osc_qm
69func osc_cos_s(x: i64) -> i64 { let x2: i64=osc_qm(x,x); let x4: i64=osc_qm(x2,x2); let x6: i64=osc_qm(x4,x2); let x8: i64=osc_qm(x4,x4); return OSC_MAGIC_65536 - x2/2 + x4/24 - x6/720 + x8/OSC_MAGIC_40320 }
called by 2: add_formantosc_sin_unit calls 1: osc_qm
71func osc_sin_unit(ph: i64) -> i64
82func osc_sine(out: *i64, n: i64, freq: i64, rate: i64, amp: i64) -> i64
calls 1: osc_sin_unit
90func osc_sweep(out: *i64, n: i64, f0: i64, f1: i64, rate: i64, amp: i64) -> i64
called by 1: place_sweep calls 1: osc_sin_unit