Cabbage Logo
Back to Cabbage Site

Sfile

It still seems like it will only allow me to play either the sample or the oscillator even though it finds no error.

That’s because it’s exactly what you’ve programmed it to do, i.e., play a sample on notes 60, 61, 62, and the oscillator on note 63. :man_shrugging:

Alright. I fixed it with creating and if statement for the output as well:

if (iNote == 63) then
; Bass drum synthesis code

kFreq expon 400, 0.1, 5
kAmp expon 1, 0.7, 0.00001
aSin oscil kAmp, kFreq

kNoiseAmp expon 1, 0.1, 0.00001
aNoise rand kNoiseAmp * 0.2

aOut = aSin + aNoise

; Output the audio
outs aOut, aOut

else
iLen filelen Sfile
xtratim iLen

; Play the selected sample without looping
a1, a2 diskin2 Sfile, 1, 0, 0 

; Output the audio
outs a1, a2

endif

endin

I guess this is not the most efficient way to do it! But it works at least.

1 Like