Log In  


Basic, easy to use sound/music support is nice, but I'd love access to sound "hardware". Think of it like playing music/sound on your C64 using a mod player vs. writing a program to drive SID directly. This would give us many awesome possibilities that are either impossible or very hard to achieve with the sound system that is in Pico-8. I mean, we can access rendering hardware directly, so why not do the same for sounds?

All it would take is to add following command (name may be different, but gist about the same)

asnd waveform,freq,vol,channel

(asnd from advanced sound). It'll play waveform with specific frequency and volume (if either set to 0, it'd just stop playing it) on channel until another "regular" sound is played on that channel, either via music player or via sound command) or another asnd command is issued with that channel name. If channel is omitted, it'll play on first unused channel (with nothing playing on it).

As for waveforms, they're pretty much the same you can set in the sound editor.

3


I second this. It would then be easy to do things like siren sounds programmatically (and they could be dynamic).


I would LOVE for this to happen.


+1


Yeah, that would be nice.


Found this old post and think the request is still useful :-)


5

This can be done without much trouble, actually. You just need to create instruments using poke():

do
  local state={}
  function play(form,freq,vol,ch)
    local id=state[ch]
    if not id then
      id=flr(rnd(4))
      for k,v in pairs(state) do
        if v==id then state[k]=nil end
      end
    end 
    state[ch]=id
    local n=63-id
    local p=0x3200+68*n
    poke(p,band(freq,63)+band(form,3)*64)
    poke(p+1,band(vol,7)*2+band(form,4)/4)
    poke2(p+66,256)
    sfx(n,id)
  end
end

Here is an example of how to use it:

a=0
function _update60()
  a+=.01
  play(0,50+10*sin(a),5,"wave 1")
  play(1,30+20*rnd(),5,"rand")
  play(6,20+5*sin(2*a),5,"noise")
end

Perfect! (I was already doing tests with code quite similar to this! :-) )


Wow. May I use your code, Sam?


Sure, it’s all free to use and modify.



[Please log in to post a comment]