Music like in Nintendo games

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Sulunia
Party member
Posts: 201
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Music like in Nintendo games

Post by Sulunia » Mon Apr 25, 2016 7:11 pm

zorg wrote:Audio creation is sadly a no hands held business, and there's no simple way of doing it.
That pretty much sums it up.
If you give up on doing the pc speaker thingy though, but still want chiptune that sounds exactly like the NES, i can suggest the NES VST Plugin for audio DAWs.
(http://www.mattmontag.com/projects-page/nintendo-vst)
It's an awesome plugin for pulling off such pitch bend effects and arpeggios.
Thing is, you would need a DAW. I can suggest FL Studio, since it's easy to use, popular, and relatively cheap.
(http://www.image-line.com/flstudio/)
You would then generate a .mp3 or .ogg and play it on the the game as you would with any other common music file.

This is the "easy" way... Because composing good music is a whole different story.

I seriously want to learn how to compose songs, since i use FL studio for years but never really made anything "audible" though.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia

Nutte
Prole
Posts: 32
Joined: Sat Feb 27, 2016 1:08 pm

Re: Music like in Nintendo games

Post by Nutte » Mon Apr 25, 2016 7:47 pm

ivan wrote:Hello.
Sure, take a look at the sound data object:
https://love2d.org/wiki/SoundData
You have to study waveforms if you plan on using SoundData.
It may be possible to use the PC speaker via os.execute but that's not
really cross-platform and Love2D really isn't the best tool for that kind of stuff.

Most of the time you can get better results by simply:
1.mixing different tracks
2.playing samples with modified pitch.
Can you show me how you can do it?

To all:

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.

User avatar
Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Music like in Nintendo games

Post by Nixola » Mon Apr 25, 2016 7:57 pm

zorg wrote:Nixola: Any reason why your .love file gives me a no-game screen?
It's probably my fault. I created it with "git archive" instead of "zip", it worked and I didn't check the actual format. It doesn't work on my phone either (it's not supposed to be usable there, but a no-game screen is excessive). I'll try and make a proper love later.
EDIT: I substituted the .love in my previous post, it should now work. I wonder if I can get "git archive" to make zip files...
EDIT2: 10 seconds and a "man" command later, I can.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

User avatar
zorg
Party member
Posts: 2732
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Music like in Nintendo games

Post by zorg » Mon Apr 25, 2016 9:58 pm

Sulunia wrote: (http://www.mattmontag.com/projects-page/nintendo-vst)
It's an awesome plugin for pulling off such pitch bend effects and arpeggios.
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! :3

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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
ivan
Party member
Posts: 1531
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Music like in Nintendo games

Post by ivan » Tue Apr 26, 2016 7:07 am

SMB theme, Disney Software theme, and Monkey Island are all programmed music, right? Can i program the Disney Software theme, using SoundData or not?
I'm slightly confused by your question - are you asking how to compose music or how to play it?
As Zorg said, older games used complicated formats because there wasn't enough memory to play long audio samples.
Nowadays, it's easier to save your low-fi, PC speaker track as a .wav and play that.

Nutte
Prole
Posts: 32
Joined: Sat Feb 27, 2016 1:08 pm

Re: Music like in Nintendo games

Post by Nutte » Tue Apr 26, 2016 8:23 am

I want to make music the old way, compose and play in Love 2D. Becuse my game get a old fasion feeling.

User avatar
master both
Party member
Posts: 256
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Music like in Nintendo games

Post by master both » Tue Apr 26, 2016 10:26 am

You could use a music tracker like MilkyTracker and compose your own chiptune, it is a little difficult to get the hang of, but thats the way music was composed back then. And you don't have to worry about coding a module to run mod/xm/it modules since love support them.

Nutte
Prole
Posts: 32
Joined: Sat Feb 27, 2016 1:08 pm

Re: Music like in Nintendo games

Post by Nutte » Tue Apr 26, 2016 1:57 pm

I want to show how i want it:
sound = love.audio.newSource("music.wav" , os.PCspeaker)
How can i send it to the PC speaker?

User avatar
zorg
Party member
Posts: 2732
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Music like in Nintendo games

Post by zorg » Tue Apr 26, 2016 3:27 pm

Oh. You want to actually play it back there.
You can't.
Not since windows barred access to it (no more beep(frequency, time) function either, it's sad), not to mention that a lot of motherboards / PC-s don't come with a speaker anymore either.
You could only emulate the sounds on your soundcard, and get it through your speakers.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Nutte
Prole
Posts: 32
Joined: Sat Feb 27, 2016 1:08 pm

Re: Music like in Nintendo games

Post by Nutte » Tue Apr 26, 2016 3:35 pm

Thank you, Zorg! But i have test my PC, and it have a PCspeaker. Ivan say i can use OS. execute for that. Its my code right for that?

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests