Sound issues

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.
Post Reply
brozenadenzen
Prole
Posts: 14
Joined: Tue Feb 14, 2012 5:04 pm

Sound issues

Post by brozenadenzen »

Hi, I have a problem with my sound and was hoping you guys can offer some help. I want when I click a button in my main game menu a sound "click" to be played. I have a background music already playing. I am using TEsound for both. For some reason when I click the button the sound plays but there is "hissing" noise. It's not a big deal but it is noticeable and it's there every time for a second after the click. I will put example of my entire code, since it's really erly stage of development and it's nothing much. First piece if my main.lua, and the second is the main menu file.

Code: Select all

require ("Libraries/TEsound");

screenResolutionX = 1366;	--setting variables to so I can use
screenResolutionY = 768;	--them later for tricks
stage = 1;
xClick = 0;
yClick = 0;

love.graphics.setMode(screenResolutionX, screenResolutionY, true, true, 0);			
love.mouse.setVisible(false);														

function love.load() 	--loading all images and sounds
	
	frontMenu = love.graphics.newImage ("FrontMenu.png"); 
	newGame = love.graphics.newImage ("NewGame.png");
	customCursor = love.graphics.newImage ("CustomCursor.png");
	newGameButton = love.graphics.newImage ("NewGameButton.png");
	exitGameButton = love.graphics.newImage ("ExitButton.png");
	loadGameButton = love.graphics.newImage ("LoadGameButton.png");
	encyclopediaGameButton = love.graphics.newImage ("EncyclopediaButton.png");
	optionsGameButton = love.graphics.newImage ("OptionsButton.png");
	creditsGameButton = love.graphics.newImage ("CreditsButton.png");
	backGameButton = love.graphics.newImage ("BackButton.png");
	
	love.filesystem.load ("FrontMenu.lua")();
	
	TEsound.playLooping("MainMenuSound.wav","frontMenuSound");	

end

Code: Select all

function love.draw()
	love.graphics.draw (frontMenu, 0, 0);
	love.graphics.draw (newGameButton, 1000, 150);
	love.graphics.draw (loadGameButton, 1000, 230);
	love.graphics.draw (optionsGameButton, 1000, 300);
	love.graphics.draw (encyclopediaGameButton, 1000, 380);
	love.graphics.draw (creditsGameButton, 1000, 460);
	love.graphics.draw (exitGameButton, 1000, 530);
	love.graphics.draw (customCursor, love.mouse.getX(), love.mouse.getY());

end

function love.update(dt)
	TEsound.tagVolume("all",.5);
	TEsound.cleanup();
	
	function love.mousepressed (x, y, click)
		if click == "l" and stage == 1 and x >= 1000 and x <= 1177 and y >= 150 and y <= 210 then
			local check = 1;
			function love.mousereleased (x1, y1, click1)
				if click1 == "l" and x1 >= 1000 and x1 <= 1177 and y1 >= 150 and y1 <= 210 and check == 1 then 
					TEsound.play ("/Sounds/beep.wav", "clickButton");
					stage = 2;
					love.filesystem.load ("NewGame.lua")();
					check = 0;
				else check = 0;
				end
			end	
		end
		
		if click == "l" and stage == 1 and x >= 1000 and x <= 1177 and y >= 230 and y <= 280 then
			local check = 1;
			function love.mousereleased (x1, y1, click1)
				if click1 == "l" and x1 >= 1000 and x1 <= 1177 and y1 >= 230 and y1 <= 280  and check == 1 then
						stage = 3;
						love.filesystem.load ("LoadGame.lua")();
						check = 0;
				else check = 0;
				end
			end	
		end	
		
		if click == "l" and stage == 1 and x >= 1000 and x <= 1177 and y >= 300 and y <= 360 then
			local check = 1;
			function love.mousereleased (x1, y1, click1)
				if click1 == "l" and x1 >= 1000 and x1 <= 1177 and y1 >= 300 and y1 <= 360 and check == 1 then
						stage = 4;
						love.filesystem.load ("Options.lua")();
						check = 0;
				else check = 0;
				end
			end	
		end	
		
		if click == "l" and stage == 1 and x >= 1000 and x <= 1177 and y >= 380 and y <= 440 then
			local check = 1;
			function love.mousereleased (x1, y1, click1)
				if click1 == "l" and x1 >= 1000 and x1 <= 1177 and y1 >= 380 and y1 <= 440 and check == 1 then
						stage = 5;
						love.filesystem.load ("Encyclopedia.lua")();
						check = 0;
				else check = 0;
				end
			end	
		end	
		
		if click == "l" and stage == 1 and x >= 1000 and x <= 1177 and y >= 460 and y <= 520 then
			local check = 1;
			function love.mousereleased (x, y, click1)
				if click1 == "l" and x >= 1000 and x <= 1177 and y >= 460 and y <= 520 then 
						stage = 6;
						love.filesystem.load ("Credits.lua")();
				end
			end	
		end	
		
		if click == "l" and stage == 1 and x >= 1000 and x <= 1177 and y >= 540 and y <= 600 then
			function love.mousereleased (x, y, click1)
				if click1 == "l" and x >= 1000 and x <= 1177 and y >= 540 and y <= 600 then
						love.event.push("q");
				end
			end
		end	
	end
	
	function love.keyreleased (key)
		if key == "n" and stage == 1 then
			stage = 2;
			love.filesystem.load ("NewGame.lua")();
		end
		if key == "l" and stage == 1 then
			stage = 3;
			love.filesystem.load ("LoadGame.lua")();
		end
		if key == "o" and stage == 1 then
			stage = 4;
			love.filesystem.load ("Options.lua")();
		end
		if key == "e" and stage == 1 then
			stage = 5;
			love.filesystem.load ("Encyclopedia.lua")();
		end
		if key == "c" and stage == 1 then
			stage = 6;	
			love.filesystem.load ("Credits.lua")();
		end
		if key == "q" and stage == 1 then
			love.event.push("q");
		end
	end
end
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Sound issues

Post by kikito »

Try transforming the .wav file to an .ogg file. If I remember correctly, the other sound formats have issues in some versions of LÖVE.
When I write def I mean function.
brozenadenzen
Prole
Posts: 14
Joined: Tue Feb 14, 2012 5:04 pm

Re: Sound issues

Post by brozenadenzen »

A bit funny, but I did that just 1 second before reading your reply, and it worked :) Though the quality of the sound kind of dropped. I might use different background music anyways, never really liked that one to begin with :)
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests