tomara-x / quartz

visual programming and dsp playground
https://codeberg.org/tomara-x/quartz
Apache License 2.0
90 stars 3 forks source link

why net stacked with iteslf isn't identical to split #86

Closed tomara-x closed 5 months ago

tomara-x commented 8 months ago

in the case of noise, yeah that's great, but why's an oscillator spitting different samples? the nets are cloned, they should be independent

try with other generators, maybe the ramp? what happens if it's the same oscillator going through a filter, then that's stacked?

tomara-x commented 8 months ago

even you, ramp()?! BETRAYAL! same with piping through a filter first (lol what did you expect?)

tomara-x commented 8 months ago

try with multiple! like 8! see if any of them are identical

tomara-x commented 8 months ago

i'm going to a commune in vermont and will deal with no unit of time shorter than a season

Screenshot_2024-03-03_09-27-58

tomara-x commented 8 months ago

this has something to do with ping() and the AttoHash

Pico sized hasher. It is used in computing deterministic pseudorandom phase hashes

tomara-x commented 8 months ago

but why would you assign a random phase to oscillators? it makes no sense

tomara-x commented 7 months ago

eh

tomara-x commented 5 months ago

fuck! i need to bisect to be sure, but i think 67c6f4d stopped this behavior? (or something since 0.4) (which is great! i'm happy that doesn't happen to oscillators anymore.. but the question is: why tf)

tomara-x commented 5 months ago

i love fundsp! i love how i can just do this

use fundsp::hacker32::*;

fn main() {
    let mut net1 = Net32::wrap(Box::new(sine_hz(440.)));
    let mut net2 = Net32::wrap(Box::new(sine_hz(440.)));
    let mut net3 = net1.clone() | net2.clone();
    let mut net4 = Net32::wrap(Box::new(net1.clone() | net2.clone()));
    println!("1: {:?}", net1.get_mono());
    println!("2: {:?}", net2.get_mono());
    println!("3: {:?}", net3.get_stereo());
    println!("4: {:?}", net4.get_stereo());
}

and yep, that confirms it

1: -0.46202415
2: -0.46202415
3: (-0.46202415, -0.46202415)
4: (-0.26424092, -0.99266475)
tomara-x commented 5 months ago

FunDSP uses a deterministic pseudorandom phase system for audio generators. Generator phases are seeded from network structure and node location.

network structure and node location..

tomara-x commented 5 months ago

fundsp bug https://discord.com/channels/590254806208217089/780429214809063444/1247429203993821318

now the question is: why did the pseudorandom phase never happen with ramp() (the new version) (it needs the hash method to be implemented, right?)

yup! everything makes sense now!

    /// Set node pseudorandom phase hash.
    /// This is called from `ping` (only). It should not be called by users.
    /// The node is allowed to reset itself here.
    #[allow(unused_variables)]
    fn set_hash(&mut self, hash: u64) {
        // Override this to use the hash.
        // The default implementation does nothing.
    }