Extended Music Script 3.5

Zhek

Villager
Member
Joined
May 29, 2012
Messages
10
Reaction score
6
First Language
Spanish
Primarily Uses
Extended Music Script 3.5


Introduction

This script allows you to play music formats like psf, spc, mod, it, etc in your game, just like mp3 or midi.

Features

New Features:

- Script compatible with RPG Maker VX Ace

I mostly rewrote the code that's indented. Everything else was written by either Mooshykris or Guillaume777 years ago.

Credit us if you want in your game. Please report any bugs you may encounter to zhek.pvm@gmail.com and I'll try to fix them.

Script allows you to play unusual formats ( .psf, .gym, .spc, it, mod, etc. ) if there is a winamp dll for it

Script works with multiple format/dlls and doesn't require a 'call script' ( just make it play like any BGM )

Script won't give error unless there is a music file requiring dll and dll is not there

How to Use

Make sure Winamp.dll, out_wave.dll and the music dlls are in a folder called 'DLL' in your game folder

If you use in_bass.dll you need to have bass.dll in your game folder.

Copy your music files to the BGM folder ( you can't import them via RPG VX/Ace )

If you use .minipsf don't forget to include the psflib !!

Just use an event to play the music like any regular BGM

The music files won't play in Sound Test, only in the real game

If you want loop music files you need to edit dlls in winamp and copy the configure files to the DLL folder

Script

Code:
#==============================================================================
# Extended Music Script Version 3.5
#------------------------------------------------------------------------------
# Edited by Zhek
# May 28, 2012
#
# New Features:
#   - Script compatible with RPG Maker VX Ace
#
# I mostly rewrote the code that's indented. Everything else was written by
# either Mooshykris or Guillaume777 years ago.
# Credit us if you want in your game.
# Please report any bugs you may encounter to zhek.pvm@gmail.com and I'll try to
# fix them.
#------------------------------------------------------------------------------
# Edited by Mooshykris
# March 6, 2007
#==============================================================================
# Version 2.0 Features:
# The Ability to play USF, MINIUSF, and all In_Cube Files
#==============================================================================
#Original Script:
#------------------------------------------------------------------------------
#Audio formats extension script
#------------------------------------------------------------------------------
# Guillaume777
# 3.1
# 2006/04/28
#==============================================================================
# Version 3.0 :
# -New support for in_bass dll ! You can now play those formats :
# '.XM', '.IT', '.S3M', '.MOD', '.MTM', '.UMX', '.MO3'
# -New support for fading !
# -Improved code, now script is really fast
#
#
# Great improvement of Andreas21 'WimAmp plugins', by Guillaume777 ( 2005 )
# Script allows you to play unusual formats ( .psf, .gym, .spc, it, mod, etc. ) if there is a winamp dll for it
# Script works with multiple format/dlls and doesn't require a 'call script' ( just make it play like any BGM )
# Script won't give error unless there is a music file requiring dll and dll is not there
# Instructions
#
# Make sure Winamp.dll, out_wave.dll and the music dlls are in a folder called 'DLL' in your game folder
# If you use in_bass.dll you need to have bass.dll in your game folder.
# Copy your music files to the BGM folder ( you can't import them via RPG VX/Ace)
# If you use .minipsf don't forget to include the psflib !!
# Just use an event to play the music like any regular BGM
# The music files won't play in Sound Test, only in the real game
# If you want loop music files you need to edit dlls in winamp and copy the configure files to the DLL folder
#
#
# Credits for Winamp class and Winamp.dll to Andreas21 (C) 2004
module G7_AFES_MOD
BGM_DIRECTORY = 'Audio/BGM/' # directory of BGMs
DLL_DIRECTORY = 'DLL/' #directory of dll
OUT_DLL = 'out_wave.dll' #output dll, default = 'out_wave.dll'
WIN_DLL = 'WinAmp.dll' #winamp dll, default = 'winamp.dll'
BGM_EXT = ['.mp3', '.mid', '.ogg', '.wma', '.wave'] #normal extension
PSF_EXT = ['.psf', '.minipsf', '.psf2', '.minipsf2']
GSF_EXT = ['.gsf', '.minigsf']
USF_EXT = ['.usf', '.miniusf']
CUBE_EXT = ['.hps', '.dsp']
SNES_EXT = ['.spc']
GEN_EXT = ['.gym', '.cym']
MOD_EXT = ['.XM', '.IT', '.S3M', '.MOD', '.MTM', '.UMX', '.MO3']

PSF_DLL = 'in_psf.dll'
GSF_DLL = 'in_gsf.dll'
USF_DLL = 'in_usf.dll'
CUBE_DLL = 'in_cube.dll'
SNES_DLL= 'in_snes.dll'
GEN_DLL = 'in_ym.dll'
MOD_DLL = 'in_bass.dll'
end
module RPG
class AudioFile
attr_accessor :file_extension #stores the extension of file
attr_accessor :file_name #stores the real file name
attr_accessor :file_dll #store dll required to play it
end
end
module Audio
@winamp = nil #stores audio player
@winamp_volume = nil #stores volume value
@winamp_playing_bgm = nil #stores music played by winamp
@winamp_bgm_fading = nil #stores if bgm is currently fading or not
@winamp_current_dll = nil # stores current dll used by winamp
@fade_dec = nil #stores how much the volume decrease per frame while fading
def Audio.winamp_bgm_fading
return @winamp_bgm_fading
end
#==============================================================================
# Create winamp system, play music file with winamp, set volume
#==============================================================================
def self.winamp_bgm_play(file_name, volume = 100.0, dll = nil)
if @winamp_current_dll != dll then
  @winamp_current_dll = dll
  @winamp = WinAmp_Plugin_System.new(dll) #new winamp with new dll
end
volume = 255 #convert volume from rmxp to winamp
if volume > 255.0 then volume = 255.0 end
@winamp_playing_bgm = file_name
@winamp.play(file_name)
@winamp_volume = volume
@winamp.setvolume(volume)
end #end def

#==============================================================================
# Initiate the fading, calculates @fade_dec
#==============================================================================
def self.winamp_bgm_fade_init(frames)
if @winamp_playing_bgm != nil then
@fade_dec = @winamp_volume / frames
@winamp_bgm_fading = true
self.winamp_bgm_fade
end
end
#==============================================================================
# Fade volume by @fade_dec
#==============================================================================
def self.winamp_bgm_fade
@winamp_volume += -@fade_dec
@winamp.setvolume(@winamp_volume) #drop in volume for a fade
if @winamp_volume <= 0
self.winamp_bgm_stop
end
end
#==============================================================================
# Stops playing music
#==============================================================================
def self.winamp_bgm_stop
if @winamp_playing_bgm != nil then
@winamp.setvolume(255)
@winamp.stop #stop winamp
end
@winamp_bgm_fading = false
@fade_dec = false
@winamp_volume = nil
@winamp_playing_bgm = nil
end
#==============================================================================
# Uses Win32API and WinAmp.dll to add winamp functions
#==============================================================================
class WinAmp_Plugin_System #This part was done by Andreas21
def initialize(in_dll)
# DLL Pfaht festlegen
dll_directory = G7_AFES_MOD::DLL_DIRECTORY
in_dll = dll_directory + in_dll
out_dll = dll_directory + G7_AFES_MOD::OUT_DLL
winamp_dll = dll_directory + G7_AFES_MOD::WIN_DLL
# 2 API Funktionen die gebraucht werden für das Fenster Handel
@ReadIni = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@FindWindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
# Benötigte DLL Funktionen Laden
@Init_Winamp = Win32API.new winamp_dll, 'Init_Winamp', %w(p p l), 'l'
@Quit_Winamp = Win32API.new winamp_dll, 'Quit_Winamp', '', ''
@Winamp_Play = Win32API.new winamp_dll, 'Winamp_Play', 'p', 'l'
@Winamp_Pause = Win32API.new winamp_dll, 'Winamp_Pause', '', ''
@Winamp_Stop = Win32API.new winamp_dll, 'Winamp_Stop', '', 'l'
@Winamp_OnlyExtensions = Win32API.new winamp_dll, 'Winamp_OnlyExtensions', '', 'p'
@Winamp_OutName = Win32API.new winamp_dll, 'Winamp_OutName', '', 'p'
@Winamp_OutConfig = Win32API.new winamp_dll, 'Winamp_OutConfig', 'l', ''
@Winamp_OutAbout = Win32API.new winamp_dll, 'Winamp_OutAbout', 'l', ''
@Winamp_IsPlaying = Win32API.new winamp_dll, 'Winamp_IsPlaying', '', 'l'
@Winamp_InName = Win32API.new winamp_dll, 'Winamp_InName', '', 'p'
@Winamp_Extensions = Win32API.new winamp_dll, 'Winamp_Extensions', '', 'p'
@Winamp_InConfig = Win32API.new winamp_dll, 'Winamp_InConfig', 'l', ''
@Winamp_InAbout = Win32API.new winamp_dll, 'Winamp_InAbout', 'l', ''
@Winamp_GetFileInfo = Win32API.new winamp_dll, 'Winamp_GetFileInfo', %w(p l), 'p'
@Winamp_InfoBox = Win32API.new winamp_dll, 'Winamp_InfoBox', %w(p l), 'l'
@Winamp_GetLength = Win32API.new winamp_dll, 'Winamp_GetLength', '', 'l'
@Winamp_LengthStr = Win32API.new winamp_dll, 'Winamp_LengthStr', 'l', 'p'
@Winamp_GetOutputTime = Win32API.new winamp_dll, 'Winamp_GetOutputTime', '', 'l'
@Winamp_SetVolume = Win32API.new winamp_dll, 'Winamp_SetVolume', 'l', ''
@Winamp_SetPan = Win32API.new winamp_dll, 'Winamp_SetPan', 'l', ''
@Winamp_setoutputtime = Win32API.new winamp_dll, 'winamp_setoutputtime', 'l', ''
@Winamp_IsPaused = Win32API.new winamp_dll, 'Winamp_IsPaused', '', 'l'
# Winamp Plugin Systen Start
@Init_Winamp.call(in_dll, out_dll, handel)
end
# Play the file. Return 0 if no error happend.
def play(file)
return @Winamp_Play.call(file)
end
# First call pause the sound and the second call unpause it.
def pause
@Winamp_Pause.call()
end
# Stop playing.
def stop
return @Winamp_Stop.call()
end
# Quit WinAmp
def quit
@Quit_Winamp.call()
end
# Return all the supported mediafiles.
def onlyextensions
return @Winamp_OnlyExtensions.call()
end
# Out_DLL Infos
def outname
return @Winamp_OutName.call()
end
# Open the config-dialog of the out-plugin.
def outconfig
@Winamp_OutConfig.call(handel)
end
# Open the about-dialog of the out-plugin
def outabout
@Winamp_OutAbout.call(handel)
end
# Return <>0 if a sound is playing, but doesn't work if in-plugin don't need the out-plugin
def isplaying
return @Winamp_IsPlaying.call()
end
# Return the name of the in-plugin.
def inname
return @Winamp_InName.call()
end
# Return the extentions and the type name of all supported mediafiles
def extensions
return @Winamp_Extensions.call()
end
# Open the config-dialog of the in-plugin.
def inconfig
@Winamp_InConfig.call(handel)
end
# Open the about-dialog of the in-plugin.
def inabout
@Winamp_InAbout.call(handel)
end
# return the title of a file and the length in ms.
def getfileinfo(playfile,length_adr)
return @Winamp_GetFileInfo.call(playfile,length_adr)
end
# Open the file-info-dialog of the in-plugin. Not supported of all pluggins (=the will do nothing)
def infobox(playfile)
return @Winamp_InfoBox.call(playfile,handel)
end
# Returns the length of the playing file in ms.
def getlength
return @Winamp_GetLength.call()
end
# Convert the length to a string. Format: "h:mm:ss".
def lengthstr(length)
return @Winamp_LengthStr.call(length)
end
# Return the current playing position.
def getoutputtime
return @Winamp_GetOutputTime.call()
end
# Set the volume (0 to 255)
def setvolume(volume)
@Winamp_SetVolume.call(volume)
end
# Set the pan (left=-127 to 127=right)
def setpan(pan)
@Winamp_SetPan.call(pan)
end
# Set the playing position position. Not supported of all in-plugins. Can be very slow.
def setoutputtime(time)
@Winamp_setoutputtime.call(time)
end
# Return <>0 if paused.
def ispaused
return @Winamp_IsPaused.call()
end
def handel
game_name = 0.chr * 255
zeichen = @ReadIni.call('Game','Title','',game_name,255,'.\Game.ini')
return @FindWindow.call('RGSS Player',game_name.slice!(0,zeichen))
end #end of init
end #end of class
end #end of module

class RPG::BGM < RPG::AudioFile
#--------------------------------------------------------------------------
# ? Play BGM either normally or by using winamp plugin
#--------------------------------------------------------------------------
def play(pos = 0)
  if @name.empty?
	Audio.bgm_stop
	Audio.winamp_bgm_stop
	@@last = RPG::BGM.new
  else
	@@last = self.clone
	if @file_extension == nil then #stores extension of file
	  @file_extension = self.get_file_extension(@name)
	end
	if @file_name == nil then #stores path and name of file
	  @file_name = G7_AFES_MOD::BGM_DIRECTORY + @name + @file_extension
	end
	 if @file_extension.empty? or G7_AFES_MOD::BGM_EXT.include?(@file_extension) #normal music file
	   Audio.winamp_bgm_stop
	   Audio.bgm_play( @file_name, @volume, @pitch, pos)
	 else #if file required winamp plugin to play
	   Audio.winamp_bgm_stop
	   Audio.bgm_stop
	   if @file_dll == nil then
		 @file_dll = self.get_dll(@file_extension) # get dll required to play file
	   end
	   Audio.winamp_bgm_play(@file_name, @volume, @file_dll) #Play the new audio format
	 end
  end
  Graphics.frame_reset
end
def self.fade(time)
  Audio.bgm_fade(time)
  Audio.winamp_bgm_fade_init(time * (60.0/1000.0)) #line added
  @@last = RPG::BGM.new
end

def self.stop
  Audio.bgm_stop
  Audio.winamp_bgm_stop #line added
  @@last = RPG::BGM.new
end
#--------------------------------------------------------------------------
# ? Returns correct extension of file
#--------------------------------------------------------------------------
def get_file_extension(bgm_name)
file_name= G7_AFES_MOD::BGM_DIRECTORY + bgm_name
extensions = G7_AFES_MOD::BGM_EXT + G7_AFES_MOD::PSF_EXT + G7_AFES_MOD::GSF_EXT + G7_AFES_MOD::USF_EXT + G7_AFES_MOD::CUBE_EXT + G7_AFES_MOD::SNES_EXT + G7_AFES_MOD::GEN_EXT + G7_AFES_MOD::MOD_EXT
file_extension = "" #nil by default
for extension in extensions
if FileTest.exist?(file_name + extension) #if it found extension
file_extension = extension # remember extension
break
end
end
return file_extension
end
#--------------------------------------------------------------------------
# ? Returns dll required to play file with winamp system
#--------------------------------------------------------------------------
def get_dll(file_extension)
  if G7_AFES_MOD::PSF_EXT.include?(file_extension)
	dll = G7_AFES_MOD::PSF_DLL
  elsif G7_AFES_MOD::GSF_EXT.include?(file_extension)
	dll = G7_AFES_MOD::GSF_DLL
  elsif G7_AFES_MOD::USF_EXT.include?(file_extension)
	dll = G7_AFES_MOD::USF_DLL
  elsif G7_AFES_MOD::CUBE_EXT.include?(file_extension)
	dll = G7_AFES_MOD::CUBE_DLL
  elsif G7_AFES_MOD::MOD_EXT.include?(file_extension)
	dll = G7_AFES_MOD::MOD_DLL
  elsif G7_AFES_MOD::SNES_EXT.include?(file_extension)
	dll = G7_AFES_MOD::SNES_DLL
  elsif G7_AFES_MOD::GEN_EXT.include?(file_extension)
	dll = G7_AFES_MOD::GEN_DLL
  else
	dll = nil
  end
return dll
end
end #end class
class Scene_Base
#--------------------------------------------------------------------------
# ? Update the sound level if fading
#--------------------------------------------------------------------------
alias g7_afes_scene_base_update update
def update
  g7_afes_scene_base_update #update normally
  if Audio.winamp_bgm_fading
  Audio.winamp_bgm_fade #lower volume for the frame
  end
end
end
FAQ

I'll be adding questions here as you guys ask them.

Credit and Thanks

- Zhek (me, VX Ace rewrite)

- Mooshykris (Improvements over original version)

- Guillaume777 (Original Script)

Author's Notes

This script has been tested with RPG Maker VX Ace. It might work in VX too, but I haven't tried it yet. Let me know if you use it successfully there!

Dlls needed to make this work are available to download here. I have already included in_psf.dll which is needed to play PSX (.psf, .minipsf) music files. If you want to play other files such as SNES', you need to download in_spc.dll and so on.
 
Last edited by a moderator:

Shablo5

Veteran
Veteran
Joined
May 23, 2012
Messages
608
Reaction score
23
First Language
English
Primarily Uses
Ahhh my finger. Can you put the script in spoilers please?

Anywho, what is your intended effect with this script? What inspired you to make it, and for what purpose? If you don't mind me asking.
 

Zhek

Villager
Member
Joined
May 29, 2012
Messages
10
Reaction score
6
First Language
Spanish
Primarily Uses
Ahhh my finger. Can you put the script in spoilers please?

Anywho, what is your intended effect with this script? What inspired you to make it, and for what purpose? If you don't mind me asking.
Done.

I once found a really nice music formats like .psf (sounds very well in a few kBs) and realised that they could be useful for RPG Maker. This script already worked fine for RPG Maker XP (it was released in 2004, by Guillaume777, don't know whether he's still around the community or not) but I adapted it to VX Ace (because that's the maker I use).
 

Gordon228

Warper
Member
Joined
Jun 14, 2012
Messages
4
Reaction score
0
Primarily Uses
is there any way to update this for the cipamp plugin pack? i would try but i am not skilled in scripting.
 
Last edited by a moderator:

darmakwolf

Villager
Member
Joined
Jan 3, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
Sorry if this is a necro-post or something - but I NEED this script to work... I love SNES SPCs. I remember having this working in XP, I now have VX Ace. My problem is I get a "undefined method 'call' for nil:NilClass" error on line 272, which is where "handel" is defined.



Code:
return @Findwindow.call('RGSS Player',game_name.slice!(0,zeichen))
I think it's just failing to check if there's a nil value with ?nil, but I don't know how to implement that. I have all the proper DLLs in the DLL folder, and I downloaded in_snes.dll and popped that in there. What am I doing wrong? The same thing happens on a clean new project.
 

Internetakias

RPG Maker VX Ace Noob :P
Member
Joined
Aug 26, 2012
Messages
67
Reaction score
8
First Language
Greek
Primarily Uses
Is there any chance of you adding compatibillity for foobar dlls?
 

darmakwolf

Villager
Member
Joined
Jan 3, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
Is there any chance of you adding compatibillity for foobar dlls?
Why not just use the winamp ones? Winamp can play just about any format with plugins. I am still having an issue where I get an error even though all my DLLs are in the right folder. I think I boiled it down to an issue in Windows 7 where FindWindow API from user32 does not initialize properly, causing it to return nil.
 

Solarphantom

A badass
Member
Joined
Dec 31, 2012
Messages
19
Reaction score
9
First Language
English
Primarily Uses
N/A
im gonna need that. lol i have sooo many music files that wont need to be converted anymore.

but how do you get mp3s that wont work in RMVX Ace to work? like im trying to put in a song for the credits, but in the sound test it wont play...
 

darmakwolf

Villager
Member
Joined
Jan 3, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
Solar, the special formats will not play in the actual RPG Maker test-play. The audio will be played in-game, because the script in the game is telling the winamp DLL to play the song. RPG Maker itself can only preview the formats it knows, like MP3 and OGG. You will need to know what song is what, then select it and run the game. They will play in the game.

I wish someone would help me with the error I get though... the script does not work for me even with the DLLs in the right folder and even on a clean project. (Using Windows 7 64-bit)

im gonna need that. lol i have sooo many music files that wont need to be converted anymore.

but how do you get mp3s that wont work in RMVX Ace to work? like im trying to put in a song for the credits, but in the sound test it wont play...
 

darmakwolf

Villager
Member
Joined
Jan 3, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
I'd appreciate someone testing this with .SPC (super nintendo format) files on Windows 7 64-bit edition. I simply cannot get past an error it throws, so I'd like to know if it's just something I'm doing wrong...
 

Mr. Bubble

Makes stuff.
Member
Joined
Mar 1, 2012
Messages
853
Reaction score
163
darmakwolf, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.
 

darmakwolf

Villager
Member
Joined
Jan 3, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
darmakwolf, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.
Sorry! I have to post this - I found out what the problem is, and how anyone in the future can fix this! Look at this line:



Code:
return @Findwindow.call('RGSS Player',game_name.slice!(0,zeichen))
see that? That was the line I always got the error on. It took a LONG time to figure out this simple problem with the script, but I got it! I backtraced every little thing the script does, and boiled it down to "Hmm... where is Findwindow even defined in code?"

well look here:



Code:
@FindWindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
see that? Findwindow... ISN'T defined. FindWindow IS! (Capital W)

literally all I had to do was lower-case it, and it works!!! I hope this helps anyone with this script in the future, because finding this was frustrating. DLLs in my folder are as follows:

in_snes.dll (646 kb)

out_wave.dll (14 kb)

plugin.ini ([sNESamp] Version=30304) (1 kb)

SNESamp.cnt (1 kb)

SNESAMP.HLP (42 kb)

SNESAPU.DLL (48 kb)

unrar.dll (160 kb) - actually DOES provide support for rar'd SPCs!

Winamp.dll (20 kb) (Version 1.0.0.0)

Why this script is awesome: Epic SNES music (there's THOUSANDS of tacks) and they're only a few kilobytes each... lower game file size, more music!!
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
819
Reaction score
319
First Language
Javascript
Primarily Uses
RMMV
Awesome script!  :)   Now I can finally use all my favorite SNES tunes! Thank you for this! BD

Question though, how would I play a .nsf file? These files contain more than one song so I don't really know how to get that to work properly.
The problem is that it just brings up a slider bar and starts with the first song.

This is what it looks like:

Here is what I got so far:

#==============================================================================# Extended Music Script Version 3.5#------------------------------------------------------------------------------# Edited by Zhek# May 28, 2012## New Features:# - Script compatible with RPG Maker VX Ace## I mostly rewrote the code that's indented. Everything else was written by# either Mooshykris or Guillaume777 years ago.# Credit us if you want in your game.# Please report any bugs you may encounter to zhek.pvm@gmail.com and I'll try to# fix them.#------------------------------------------------------------------------------# Edited by Mooshykris# March 6, 2007#==============================================================================# Version 2.0 Features:# The Ability to play USF, MINIUSF, and all In_Cube Files#==============================================================================#Original Script:#------------------------------------------------------------------------------#Audio formats extension script#------------------------------------------------------------------------------# Guillaume777# 3.1# 2006/04/28#==============================================================================# Version 3.0 :# -New support for in_bass dll ! You can now play those formats :# '.XM', '.IT', '.S3M', '.MOD', '.MTM', '.UMX', '.MO3'# -New support for fading !# -Improved code, now script is really fast### Great improvement of Andreas21 'WimAmp plugins', by Guillaume777 ( 2005 )# Script allows you to play unusual formats ( .psf, .gym, .spc, it, mod, etc. ) if there is a winamp dll for it# Script works with multiple format/dlls and doesn't require a 'call script' ( just make it play like any BGM )# Script won't give error unless there is a music file requiring dll and dll is not there# Instructions## Make sure Winamp.dll, out_wave.dll and the music dlls are in a folder called 'DLL' in your game folder# If you use in_bass.dll you need to have bass.dll in your game folder.# Copy your music files to the BGM folder (you can't import them via RPG VX/Ace)# If you use .minipsf don't forget to include the psflib !!# Just use an event to play the music like any regular BGM# The music files won't play in Sound Test, only in the real game# If you want loop music files you need to edit dlls in winamp and copy the configure files to the DLL folder### Credits for Winamp class and Winamp.dll to Andreas21 © 2004module G7_AFES_MODBGM_DIRECTORY = 'Audio/BGM/' # directory of BGMsDLL_DIRECTORY = 'DLL/' #directory of dllOUT_DLL = 'out_wave.dll' #output dll, default = 'out_wave.dll'WIN_DLL = 'WinAmp.dll' #winamp dll, default = 'winamp.dll'BGM_EXT = ['.mp3', '.mid', '.ogg', '.wma', '.wave'] #normal extensionPSF_EXT = ['.psf', '.minipsf', '.psf2', '.minipsf2']GSF_EXT = ['.gsf', '.minigsf']USF_EXT = ['.usf', '.miniusf']CUBE_EXT = ['.hps', '.dsp']SNES_EXT = ['.spc']NES_EXT = ['.nsf']GEN_EXT = ['.gym', '.cym']MOD_EXT = ['.XM', '.IT', '.S3M', '.MOD', '.MTM', '.UMX', '.MO3']PSF_DLL = 'in_psf.dll'GSF_DLL = 'in_gsf.dll'USF_DLL = 'in_usf.dll'CUBE_DLL = 'in_cube.dll'SNES_DLL= 'in_spc.dll'NES_DLL= 'in_nsf.dll'GEN_DLL = 'in_ym.dll'MOD_DLL = 'in_bass.dll'endmodule RPGclass AudioFileattr_accessor :file_extension #stores the extension of fileattr_accessor :file_name #stores the real file nameattr_accessor :file_dll #store dll required to play itendendmodule Audio@winamp = nil #stores audio player@winamp_volume = nil #stores volume value@winamp_playing_bgm = nil #stores music played by winamp@winamp_bgm_fading = nil #stores if bgm is currently fading or not@winamp_current_dll = nil # stores current dll used by winamp@fade_dec = nil #stores how much the volume decrease per frame while fadingdef Audio.winamp_bgm_fadingreturn @winamp_bgm_fadingend#==============================================================================# Create winamp system, play music file with winamp, set volume#==============================================================================def self.winamp_bgm_play(file_name, volume = 100.0, dll = nil)if @winamp_current_dll != dll then @winamp_current_dll = dll @winamp = WinAmp_Plugin_System.new(dll) #new winamp with new dllendvolume = 255 #convert volume from rmxp to winampif volume > 255.0 then volume = 255.0 end@winamp_playing_bgm = file_name@winamp.play(file_name)@winamp_volume = volume@winamp.setvolume(volume)end #end def#==============================================================================# Initiate the fading, calculates @fade_dec#==============================================================================def self.winamp_bgm_fade_init(frames)if @winamp_playing_bgm != nil then@fade_dec = @winamp_volume / frames@winamp_bgm_fading = trueself.winamp_bgm_fadeendend#==============================================================================# Fade volume by @fade_dec#==============================================================================def self.winamp_bgm_fade@winamp_volume += -@fade_dec@winamp.setvolume(@winamp_volume) #drop in volume for a fadeif @winamp_volume <= 0self.winamp_bgm_stopendend#==============================================================================# Stops playing music#==============================================================================def self.winamp_bgm_stopif @winamp_playing_bgm != nil then@winamp.setvolume(255)@winamp.stop #stop winampend@winamp_bgm_fading = false@fade_dec = false@winamp_volume = nil@winamp_playing_bgm = nilend#==============================================================================# Uses Win32API and WinAmp.dll to add winamp functions#==============================================================================class WinAmp_Plugin_System #This part was done by Andreas21def initialize(in_dll)# DLL Pfaht festlegendll_directory = G7_AFES_MOD::DLL_DIRECTORYin_dll = dll_directory + in_dllout_dll = dll_directory + G7_AFES_MOD::oUT_DLLwinamp_dll = dll_directory + G7_AFES_MOD::WIN_DLL# 2 API Funktionen die gebraucht werden für das Fenster Handel@ReadIni = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'@FindWindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'# Benötigte DLL Funktionen Laden@Init_Winamp = Win32API.new winamp_dll, 'Init_Winamp', %w(p p l), 'l'@Quit_Winamp = Win32API.new winamp_dll, 'Quit_Winamp', '', ''@Winamp_Play = Win32API.new winamp_dll, 'Winamp_Play', 'p', 'l'@Winamp_Pause = Win32API.new winamp_dll, 'Winamp_Pause', '', ''@Winamp_Stop = Win32API.new winamp_dll, 'Winamp_Stop', '', 'l'@Winamp_OnlyExtensions = Win32API.new winamp_dll, 'Winamp_OnlyExtensions', '', 'p'@Winamp_OutName = Win32API.new winamp_dll, 'Winamp_OutName', '', 'p'@Winamp_OutConfig = Win32API.new winamp_dll, 'Winamp_OutConfig', 'l', ''@Winamp_OutAbout = Win32API.new winamp_dll, 'Winamp_OutAbout', 'l', ''@Winamp_IsPlaying = Win32API.new winamp_dll, 'Winamp_IsPlaying', '', 'l'@Winamp_InName = Win32API.new winamp_dll, 'Winamp_InName', '', 'p'@Winamp_Extensions = Win32API.new winamp_dll, 'Winamp_Extensions', '', 'p'@Winamp_InConfig = Win32API.new winamp_dll, 'Winamp_InConfig', 'l', ''@Winamp_InAbout = Win32API.new winamp_dll, 'Winamp_InAbout', 'l', ''@Winamp_GetFileInfo = Win32API.new winamp_dll, 'Winamp_GetFileInfo', %w(p l), 'p'@Winamp_InfoBox = Win32API.new winamp_dll, 'Winamp_InfoBox', %w(p l), 'l'@Winamp_GetLength = Win32API.new winamp_dll, 'Winamp_GetLength', '', 'l'@Winamp_LengthStr = Win32API.new winamp_dll, 'Winamp_LengthStr', 'l', 'p'@Winamp_GetOutputTime = Win32API.new winamp_dll, 'Winamp_GetOutputTime', '', 'l'@Winamp_SetVolume = Win32API.new winamp_dll, 'Winamp_SetVolume', 'l', ''@Winamp_SetPan = Win32API.new winamp_dll, 'Winamp_SetPan', 'l', ''@Winamp_setoutputtime = Win32API.new winamp_dll, 'winamp_setoutputtime', 'l', ''@Winamp_IsPaused = Win32API.new winamp_dll, 'Winamp_IsPaused', '', 'l'# Winamp Plugin Systen Start@Init_Winamp.call(in_dll, out_dll, handel)end# Play the file. Return 0 if no error happend.def play(file)return @Winamp_Play.call(file)end# First call pause the sound and the second call unpause it.def pause@Winamp_Pause.call()end# Stop playing.def stopreturn @Winamp_Stop.call()end# Quit WinAmpdef quit@Quit_Winamp.call()end# Return all the supported mediafiles.def onlyextensionsreturn @Winamp_OnlyExtensions.call()end# Out_DLL Infosdef outnamereturn @Winamp_OutName.call()end# Open the config-dialog of the out-plugin.def outconfig@Winamp_OutConfig.call(handel)end# Open the about-dialog of the out-plugindef outabout@Winamp_OutAbout.call(handel)end# Return <>0 if a sound is playing, but doesn't work if in-plugin don't need the out-plugindef isplayingreturn @Winamp_IsPlaying.call()end# Return the name of the in-plugin.def innamereturn @Winamp_InName.call()end# Return the extentions and the type name of all supported mediafilesdef extensionsreturn @Winamp_Extensions.call()end# Open the config-dialog of the in-plugin.def inconfig@Winamp_InConfig.call(handel)end# Open the about-dialog of the in-plugin.def inabout@Winamp_InAbout.call(handel)end# return the title of a file and the length in ms.def getfileinfo(playfile,length_adr)return @Winamp_GetFileInfo.call(playfile,length_adr)end# Open the file-info-dialog of the in-plugin. Not supported of all pluggins (=the will do nothing)def infobox(playfile)return @Winamp_InfoBox.call(playfile,handel)end# Returns the length of the playing file in ms.def getlengthreturn @Winamp_GetLength.call()end# Convert the length to a string. Format: "h:mm:ss".def lengthstr(length)return @Winamp_LengthStr.call(length)end# Return the current playing position.def getoutputtimereturn @Winamp_GetOutputTime.call()end# Set the volume (0 to 255)def setvolume(volume)@Winamp_SetVolume.call(volume)end# Set the pan (left=-127 to 127=right)def setpan(pan)@Winamp_SetPan.call(pan)end# Set the playing position position. Not supported of all in-plugins. Can be very slow.def setoutputtime(time)@Winamp_setoutputtime.call(time)end# Return <>0 if paused.def ispausedreturn @Winamp_IsPaused.call()enddef handelgame_name = 0.chr * 255zeichen = @ReadIni.call('Game','Title','',game_name,255,'.\Game.ini')return @FindWindow.call('RGSS Player',game_name.slice!(0,zeichen))end #end of initend #end of classend #end of moduleclass RPG::BGM < RPG::AudioFile#--------------------------------------------------------------------------# ? Play BGM either normally or by using winamp plugin#--------------------------------------------------------------------------def play(pos = 0) if @name.empty? Audio.bgm_stop Audio.winamp_bgm_stop @@last = RPG::BGM.new else @@last = self.clone if @file_extension == nil then #stores extension of file @file_extension = self.get_file_extension(@name) end if @file_name == nil then #stores path and name of file @file_name = G7_AFES_MOD::BGM_DIRECTORY + @name + @file_extension end if @file_extension.empty? or G7_AFES_MOD::BGM_EXT.include?(@file_extension) #normal music file Audio.winamp_bgm_stop Audio.bgm_play( @file_name, @volume, @pitch, pos) else #if file required winamp plugin to play Audio.winamp_bgm_stop Audio.bgm_stop if @file_dll == nil then @file_dll = self.get_dll(@file_extension) # get dll required to play file end Audio.winamp_bgm_play(@file_name, @volume, @file_dll) #Play the new audio format end end Graphics.frame_resetenddef self.fade(time) Audio.bgm_fade(time) Audio.winamp_bgm_fade_init(time * (60.0/1000.0)) #line added @@last = RPG::BGM.newenddef self.stop Audio.bgm_stop Audio.winamp_bgm_stop #line added @@last = RPG::BGM.newend#--------------------------------------------------------------------------# ? Returns correct extension of file#--------------------------------------------------------------------------def get_file_extension(bgm_name)file_name= G7_AFES_MOD::BGM_DIRECTORY + bgm_nameextensions = G7_AFES_MOD::BGM_EXT + G7_AFES_MOD::pSF_EXT + G7_AFES_MOD::GSF_EXT + G7_AFES_MOD::USF_EXT + G7_AFES_MOD::CUBE_EXT + G7_AFES_MOD::SNES_EXT + G7_AFES_MOD::NES_EXT + G7_AFES_MOD::GEN_EXT + G7_AFES_MOD::MOD_EXTfile_extension = "" #nil by defaultfor extension in extensionsif FileTest.exist?(file_name + extension) #if it found extensionfile_extension = extension # remember extensionbreakendendreturn file_extensionend#--------------------------------------------------------------------------# ? Returns dll required to play file with winamp system#--------------------------------------------------------------------------def get_dll(file_extension) if G7_AFES_MOD::pSF_EXT.include?(file_extension) dll = G7_AFES_MOD::pSF_DLL elsif G7_AFES_MOD::GSF_EXT.include?(file_extension) dll = G7_AFES_MOD::GSF_DLL elsif G7_AFES_MOD::USF_EXT.include?(file_extension) dll = G7_AFES_MOD::USF_DLL elsif G7_AFES_MOD::CUBE_EXT.include?(file_extension) dll = G7_AFES_MOD::CUBE_DLL elsif G7_AFES_MOD::MOD_EXT.include?(file_extension) dll = G7_AFES_MOD::MOD_DLL elsif G7_AFES_MOD::SNES_EXT.include?(file_extension) dll = G7_AFES_MOD::SNES_DLL elsif G7_AFES_MOD::NES_EXT.include?(file_extension) dll = G7_AFES_MOD::NES_DLL elsif G7_AFES_MOD::GEN_EXT.include?(file_extension) dll = G7_AFES_MOD::GEN_DLL else dll = nil endreturn dllendend #end classclass Scene_Base#--------------------------------------------------------------------------# ? Update the sound level if fading#--------------------------------------------------------------------------alias g7_afes_scene_base_update updatedef update g7_afes_scene_base_update #update normally if Audio.winamp_bgm_fading Audio.winamp_bgm_fade #lower volume for the frame endendend
The project is attached. Click here: Custom Music.zip

To change the music press the arrow keys (or move the slider with the mouse) then press the activate key ("enter", "z", etc.) on the glowing orb.
 

Attachments

Last edited by a moderator:

Roxas162

Game Designer
Veteran
Joined
Sep 19, 2013
Messages
33
Reaction score
1
First Language
English
Primarily Uses
How could you script call this cuz i cant get it to appear in my menu
 
Last edited by a moderator:

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,907
Reaction score
450
First Language
April Fools
Primarily Uses
N/A
What about music types like mp3 and sound formats so I don't have to convert every tune I use?

Also Didn't see A DreamCast DLL, GameBoy, NEO-Geo, and many other stuff I may use.

So where do I get music dll files from?
 
Last edited by a moderator:

djDarkX

Retro & Remastered Music Guru
Veteran
Joined
Jan 17, 2013
Messages
2,699
Reaction score
1,893
First Language
Music
Primarily Uses
RMMV
What about music types like mp3 and sound formats so I don't have to convert every tune I use?

Also Didn't see A DreamCast DLL, GameBoy, NEO-Geo, and many other stuff I may use.

So where do I get music dll files from?
Here, but some of the plugins are VERY old, so they may not have accurate sound anymore.
 

WCouillard

Veteran
Veteran
Joined
Nov 24, 2013
Messages
42
Reaction score
13
First Language
English
Primarily Uses
Has anyone had any success looping tracks in-game? Tracks simply fade out and never replay for me.
 

djDarkX

Retro & Remastered Music Guru
Veteran
Joined
Jan 17, 2013
Messages
2,699
Reaction score
1,893
First Language
Music
Primarily Uses
RMMV
You need to configure the plugin inside of Winamp before using it with Ace to ensure the music loops endlessly.
 
Last edited by a moderator:

WCouillard

Veteran
Veteran
Joined
Nov 24, 2013
Messages
42
Reaction score
13
First Language
English
Primarily Uses
I checked in "force loop" in Winamp and copied the plugin over afterward and the music still doesn't loop in Ace. Is there some other way to configure it?
 

djDarkX

Retro & Remastered Music Guru
Veteran
Joined
Jan 17, 2013
Messages
2,699
Reaction score
1,893
First Language
Music
Primarily Uses
RMMV
Did you also copy over any *.ini files associated with the plugin in question?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I have recently discovered a Limit breaker for RPGmaker VXA, needless to say this changes everything.also I really like the changes this website has made.
It seems that my favorite anime page finally kicked the bucket... :,c
work in progres c:
Every RPG and MMO should let you transmog\glamour your gear so you can look the way you want.

Forum statistics

Threads
97,768
Messages
946,828
Members
128,977
Latest member
SorcererRed
Top