antirez / load81

SDL based Lua programming environment for kids similar to Codea
BSD 2-Clause "Simplified" License
601 stars 62 forks source link

Feature request: sound #11

Open seclorum opened 12 years ago

seclorum commented 12 years ago

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.

antirez commented 12 years ago

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

seclorum commented 12 years ago

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 commented 5 years ago

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 ?

afbjorklund commented 3 months ago

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

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

seclorum commented 3 months ago

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