Had to delete and rephrase this post on several occasions because I found different quirks to the problem, or found my original idea was not actually correctly assessing the issue.
I believe that for whatever reason, when stacking effects (and not even that many, i think?) on an audio channel I generate crashes on-device. The simulator can handle tons of effects, but 3-5 seem to be enough to crash the playdate.
Now, I could be completely wrong in my assessment of what's going on, so I've included my entire current working project. It's just an extremely simple draft of a main menu, and some music. Midi and everything is included if you want the exact setup i had, but just the song function is included below for your examination.
I appreciate any feedback or help in troubleshooting this, and I'd really love to utilize the on-board synths. They sound fantastic and so dreamy when I can effect them properly. If the CPU simply can't handle too many effects, I'll have to rethink my use of synths vs recorded audio.
scapia-main.zip (274.5 KB)
Does anyone know of any use of effects in music on the playdate?
Is there something obvious I'm doing wrong in regards to the audio components of the playdate?
Here is the whole function which holds the audio code:
function main_theme() local midi = 'assets/midi/main_theme.mid' local main_theme_sequence = sfx.sequence.new(midi) local piano_channel = sfx.channel.new() piano_channel:setVolume(.80) local piano_track = main_theme_sequence:getTrackAtIndex(2) -- 4 polyphony local soprano_synth = sfx.synth.new(sfx.kWavePOVosim) soprano_synth:setADSR(.05, .5, .18, .18) soprano_synth:setEnvelopeCurvature(.05) soprano_synth:setVolume(.36) soprano_synth:setLegato(true) local alto_synth = sfx.synth.new(sfx.kWaveSine) alto_synth:setADSR(.08, .4, .9, .9) alto_synth:setEnvelopeCurvature(.15) alto_synth:setVolume(.20) local tenor_synth = sfx.synth.new(sfx.kWaveSine) tenor_synth:setADSR(.04, .47, .22, .16) alto_synth:setVolume(.21) local bass_synth = sfx.synth.new(sfx.kWaveSquare) bass_synth:setADSR(.45, .53, .11, .11) bass_synth:setVolume(.10) bass_synth:setParameter(1, .2) local piano_inst = sfx.instrument.new() piano_inst:addVoice(soprano_synth) piano_inst:addVoice(alto_synth) piano_inst:addVoice(tenor_synth) piano_inst:addVoice(bass_synth) piano_track:setInstrument(piano_inst) piano_channel:addSource(piano_inst) local bitcrush = sfx.bitcrusher.new() bitcrush:setMix(.10) bitcrush:setAmount(.8) piano_channel:addEffect(bitcrush) local overdrive = sfx.overdrive.new() overdrive:setMix(.05) overdrive:setGain(2) overdrive:setLimit(3) piano_channel:addEffect(overdrive) local low_pass_filter = sfx.onepolefilter.new() low_pass_filter:setMix(1) low_pass_filter:setParameter(-.50) piano_channel:addEffect(low_pass_filter) local high_pass_filter = sfx.onepolefilter.new() high_pass_filter:setMix(1) high_pass_filter:setParameter(.30) piano_channel:addEffect(high_pass_filter) local delay = sfx.delayline.new(.55) delay:setMix(.14) delay:setFeedback(.33) delay:addTap(.14) piano_channel:addEffect(delay) main_theme_sequence:play() end