load81 icon indicating copy to clipboard operation
load81 copied to clipboard

Feature request: sound

Open seclorum opened this issue 13 years ago • 5 comments

It would be very nice to have sound in LOAD81, and following the 8-bit ideology, if it were a synthesis-oriented approach (as opposed to .WAV sample playback) this would be very neat.

What I have in mind is some sort of mini-synth such as the one found in sfxr:

http://www.drpetter.se/project_sfxr.html

A Lua table could be used to set the sound parameters for each synth voice (maybe it can be multi-timbral?):

sound[1].envelope(0,0.5,0.275,1) -- ADSR sound[1].filterType(LOPASS) &etc.

.. and then triggered with something like sound[1].play() / sound[2].play() and .stop() and .pause() and so on. This would make it very easy to set up a series of sound effects in tables and trigger them according to programmer needs.

seclorum avatar Mar 07 '12 11:03 seclorum

Hello!

Indeed sound is one of the first things I would like to address, and I'm thinking about something like the C64 SID chip, not exactly an emulator, but more or less the same API from the point of view of the programmer, exactly as you say: wavefor, envelope, filter, ... and then start/stop of the channel. It makes sense to also provide three channels like the C64, they are enough for a lot of fun.

I'll start hacking on that in the weekend.

Cheers, Salvatore

antirez avatar Mar 08 '12 11:03 antirez

Great! I think its quite enough to have 3 voices, should be more than enough for simple stuff. Also, if its a 'real' synthesizer, we can start to add sound modules - PING, ZAP, EXPLODE!

seclorum avatar Mar 08 '12 16:03 seclorum

Just a ping on this - I'd really like to add libsfxr support to load81 if that is of interest. Do you have other plans for sound @antirez ?

seclorum avatar Jan 07 '19 10:01 seclorum

On the off chance that someone still cares about this, I added sfxr basic effects just to make asteroids.lua less quiet

  • sfx(i): play sound effect #i
  • sound(file): play sound

0: pickup/coin 1: laser/shoot 2: explosion 3: powerup 4: hit/hurt 5: jump 6: blip/select 7: thrust (new)

https://github.com/afbjorklund/load81/tree/audio

afbjorklund avatar Jul 07 '24 12:07 afbjorklund

Nice one, makes a lot of sense to add sfxr .. Hope @antirez antirez will consider merging it to the main branch...

seclorum avatar Jul 07 '24 14:07 seclorum