It is currently Sun Jan 22, 2017 4:42 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 57 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: SpotFX Lib - Retro Sound Generator
PostPosted: Fri Jan 18, 2008 10:57 pm 
Offline
User
User

Joined: Thu Mar 30, 2006 11:14 am
Posts: 92
**** The latest version (including source code) can be found Here ****

------------------------------------------------------------------------------------------------------------

SpotFX is a tiny retro sound generation library that has just a single command:

CreateSpotFX(Random Seed, SoundVolume (0-127), Mutate#,Sound# to catch to)

Download here:
http://homepage.ntlworld.com/phil.james7/PJ_SpotFX.rar

The main sound creation code was converted from DrPetters excellent SFXR utility.

Usage example:
Code:
;/ SpotFX Test app
OpenWindow(1,0,0,194,62,"PB-SpotFX - PJames 08",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(1))
ButtonGadget(1,2,2,50,18,"Random")
StringGadget(2,54,2,70,18,"0",#PB_String_Numeric)
ButtonGadget(3,126,2,16,18,"-")
ButtonGadget(4,144,2,16,18,"+")
ButtonGadget(5,162,2,30,18,"Play")
ButtonGadget(6,2,22,64,18,"Mutate:0")
StringGadget(7,2,42,190,18,"CreateSpotFX(0,0,0.5,1)")
TextGadget(8,70,24,20,18,"Vol:")
ScrollBarGadget(9,92,22,100,17,0,127,1) : SetGadgetState(9,5)

InitSound()

;/ Set initial volume
Sound_Volume.b = 5
;/

;/ generate intro sound
Seed = 9837320 : Update = 1
;/

Repeat
  EventID=WaitWindowEvent()
  Select EventID
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 1
          RandomSeed(gettickcount_())
          Seed.l =Random(2147483647)
          Mutate = 0 : Update = 1
        Case 2
          If EventType() = #PB_EventType_Change
            Seed = Val(GetGadgetText(2))
            Mutate = 0 : Update = 2
          EndIf
        Case 3
          Seed = Val(GetGadgetText(2))-1
          Mutate = 0 : Update = 1
        Case 4
          Seed = Val(GetGadgetText(2))+1
          Mutate = 0 : Update = 1
        Case 5
          PlaySound(1)
        Case 6
          Mutate+1 : Update=1
        Case 9
          StopSound(1) :  Update = 1
      EndSelect
  EndSelect
  If Update > 0
    Sound_Volume = GetGadgetState(9)
    CreateSpotFX(Seed,Mutate,Sound_Volume,1)
   
    If Update < 2 : SetGadgetText(2,Str(Seed)) : EndIf
    SetGadgetText(6,"Mutate: "+Str(Mutate))
    SetGadgetText(7,"CreateSpotFX("+Str(Seed)+","+Str(Mutate)+","+Str(Sound_Volume)+",1)")
    PlaySound(1)
    Update = 0
  EndIf
Until EventID=#PB_Event_CloseWindow
End


Last edited by pjay on Wed Aug 11, 2010 1:28 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 18, 2008 11:13 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 541
Location: ger
hey! that's great :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 19, 2008 12:09 pm 
Offline
User
User

Joined: Thu Mar 30, 2006 11:14 am
Posts: 92
It's bad form for changing this so quickly, but I was asked to :D

Update: Have implemented a Mutate function; this applies random variances to the underlying variables that create the waveform.
Changed: Sound volume now takes values 0 - 127, rather than a float.

Have also included a snazzier test application:

Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 19, 2008 4:58 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Jul 21, 2006 4:41 am
Posts: 2301
Location: Berlin, Germany
The sounds have really nice arcade style.

Very cool, I'm loving it! :mrgreen:

_________________
Image
Windows 7, 64-Bit, PB v4.51 / Whose Hoff is it anyway?


Last edited by Fluid Byte on Thu Jan 21, 2010 3:02 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 19, 2008 6:33 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 26, 2003 1:11 am
Posts: 1365
love it,great stuff

_________________
SPAMINATOR NR.1


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 19, 2008 7:08 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 05, 2007 12:15 am
Posts: 894
Location: Nuremberg, Germany
Really great stuff! Congratulations :)

_________________
Windows 7 & PureBasic 4.4


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 19, 2008 9:12 pm 
Offline
New User
New User

Joined: Fri Jan 18, 2008 3:48 am
Posts: 2
Location: Devon, UK
That is realy cool :D , can i use the sounds in my own projects?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 31, 2009 8:45 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed May 05, 2004 4:04 pm
Posts: 634
Location: Germany
any chance to get this lib for PB4.30?

_________________
Zip_It V1.1
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 01, 2009 1:50 am 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1960
Location: Germany
walker wrote:
any chance to get this lib for PB4.30?

...i would need it too.

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 01, 2009 2:01 pm 
Offline
User
User

Joined: Thu Mar 30, 2006 11:14 am
Posts: 92
You can find a compatible version here: http://homepage.ntlworld.com/phil.james7/

I've not had time to test it, but it should be fine.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 12:50 am 
Offline
Enthusiast
Enthusiast

Joined: Wed May 05, 2004 4:04 pm
Posts: 634
Location: Germany
thanks a lot... :D :D :D
I'll test it

EDIT

Works great.... thanks again :D

_________________
Zip_It V1.1
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: SpotFX Lib - Retro Sound Generator
PostPosted: Thu Dec 03, 2009 6:30 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1960
Location: Germany
Hi there,
PureBasic 4.40 final is now released. Is it possible that you update your great lib?!

It would be even better if you could release your code so we don't have to ask each time. ;)

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: SpotFX Lib - Retro Sound Generator
PostPosted: Sun Dec 13, 2009 10:08 pm 
Offline
User
User

Joined: Thu Mar 30, 2006 11:14 am
Posts: 92
I'm working away from home at the moment and haven't got the source on me, will try to post next weekend.


Top
 Profile  
Reply with quote  
 Post subject: Re: SpotFX Lib - Retro Sound Generator
PostPosted: Mon Dec 14, 2009 8:52 am 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1960
Location: Germany
Good to know that you are still around here.

Thanks in advance!

_________________
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: SpotFX Lib - Retro Sound Generator
PostPosted: Mon Dec 14, 2009 10:20 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3075
My gosh, I love this application. It's so cool. :D

But I see no way to save the sound to a file?

pjay, is there any chance you would mind posting the source for your library? I would be so infinitely useful for retro games.

_________________
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 57 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye