charlieroberts / gibber.audio.lib

music and audio library for Gibber
http://www.charlie-roberts.com/gibber
MIT License
82 stars 10 forks source link

Pitch differs depending on browser / computer (gh-pages) #19

Open JTriggerFish opened 4 years ago

JTriggerFish commented 4 years ago

This example seems to play a half tone higher on a old Mac ( with Mojave and Chrome ) than on a recent PC ( with Windows 10 and Chrome too ). I haven't checked with a tuner which one is correct - if any.

Clock.bpm = 82 Theory.root = 'b2' Theory.mode = 'ionian' verb = Bus2('spaceverb') //Synth defs { pad = PolySynth('stringPad', {gain:0.07, antialias:true}) pad.connect(verb, .7).connect()

sprinkle = Monosynth({antialias:true, decay: 1/24, Q: 0.9, cutoff:0.1}) sprinkle.connect( verb, .6 ).connect()

pluck = Monosynth('arpy') pluck.connect( verb, .35 ).connect()

bass = Monosynth('bassPad', {decay:2}) bass.connect(verb, 0.35).connect()

drums= Drums() drums.connect(verb, 0.1).connect() }

drums.tidal('[kd kd ~~]*2') sprinkle.octave = 3 sprinkle.note.seq([0,2,4,6,7,7,6,4,2,0], 1/36) sprinkle.gain.fade(0.2, 0, 2) pad.chord.seq([[0,2,4,6]], 3) pluck.cutoff.fade(0,1,4) pluck.note.seq([0,2,4,6,7,6,4,2],1/16) bass.note.seq([14],1)

charlieroberts commented 4 years ago

Yes, this is dependent on the sampling rate your computer is using, but obviously it shouldn't be dependent on that...

JTriggerFish commented 4 years ago

Ah makes sense. Is there a way to set the sampling rate in the audio worklet framework ? Otherwise if it’s easy to get the current sampling rate then hopefully it’s just a matter of normalising by it in the phasors.

charlieroberts commented 4 years ago

yes, exactly on the phasors... there are probably just a few places where I hardcoded some value that I shouldn't have.