I'd actually recommend
magical 8bit plug instead, since that's what i use. :p
Nixola wrote:EDIT2: 10 seconds and a "man" command later, I can.
No worries, i extracted it and ran it that way, really neat thing you have there!
Nutte wrote:SMB theme, Disney Software theme, and Monkey Island are all programmed music, right? Can i program the Disney Software theme, using SoundData or not?
Thank you all for the help.
There are literally more than a hundred types of notations for music. MIDI would be the most prevalent, although in demoscene circles, mod/xm/s3m/it modules are more ambudant.
The original SMB tune used NES specific code, and nicely enough, the Monkey Island Theme song exists in various versions, for pc speaker, for the amiga (that was one type of a tracker module, by Chris Huelsbeck no less) and a few other versions. Most of them notated, and not like wav and mp3 files that are datastreams.
But to answer your question in a way you might learn from, here's some
pseudocode:
Code: Select all
function love.load()
-- load in waveforms for the 4 tracks of the smb theme
wf1 = love.audio.newSource('square.wav')
wf2 = love.audio.newSource('square.wav')
wf3 = love.audio.newSource('triangle.wav')
wf4 = love.audio.newSource('noise.wav')
-- Have a table for each source, each index containing a table with timings, note lengths and pitches; volume not necessary for the smb theme.
t1 = {}
t1[1] = {0, -- how many seconds should elapse from start
1/32, -- how long in seconds should the sounddata play
1.0} -- the pitch multiplier, since sources only have this. a bith of math is needed to figure out how to get another note frequency from the waveform's base frequency.
t1[2] = {1/16,
1/32,
1.0}
-- and so on, for each channel.
end
function love.update(dt)
-- have a timer variable that gets incremented in here by dt.
-- for each channel, decide whether a note should play, or if it's already playing, whether it should stop or not, and act accordingly.
end
Downsides of this include:
- Probably too low precision for the timings, unless you have vsync off.
- The pseudocode i wrote is horribly unoptimized, it could be done better.