commands to generate sound FX
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
commands to generate sound FX
I'm still looking for something to make sound effects (footsteps , sword clashes , explosions .. NOT MUSIC) to be built into a programming language .. there is a site which has a sound fx generator where you can saqve the sample you've made as a .wav .. but i'm after something to use commands to generate on the fly ..
PureBasic has a program to do it too.. it has been converted to many languages .. but as far as i know only a Purebasic user actually intigrated it into a static library so you could access it from the program as opposed to a file..
The original code that i found was written in C++ by a proffessor at a uni. so that his students didn't have to spend hours making sound effects for their coding assignments
I'll look up the links again latewr if you sant find it.. I think it was called sfxr ..
here is the originals web page
http://www.drpetter.se/project_sfxr.html
here is the link to an old purebasic adaptation for use in code
http://www.purebasic.fr/english/viewtop ... 16&t=30657
I'm sure your up to the challenge
This is as close as i've seen to what i'm after
however instead of inputting the generated data .. I'd also like to input the values for everything needed to generate the sound .. this would then provide multiple commands .. ie: one to generate on the fly .. and one to play the sound from exported data from its generator program..
PureBasic has a program to do it too.. it has been converted to many languages .. but as far as i know only a Purebasic user actually intigrated it into a static library so you could access it from the program as opposed to a file..
The original code that i found was written in C++ by a proffessor at a uni. so that his students didn't have to spend hours making sound effects for their coding assignments
I'll look up the links again latewr if you sant find it.. I think it was called sfxr ..
here is the originals web page
http://www.drpetter.se/project_sfxr.html
here is the link to an old purebasic adaptation for use in code
http://www.purebasic.fr/english/viewtop ... 16&t=30657
I'm sure your up to the challenge
This is as close as i've seen to what i'm after
however instead of inputting the generated data .. I'd also like to input the values for everything needed to generate the sound .. this would then provide multiple commands .. ie: one to generate on the fly .. and one to play the sound from exported data from its generator program..
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: commands to generate sound FX
Hi Blue Steel
A great idea, but also sounds like a ton of work to achieve - would that be value for the time spent? Recorded FX can be played via PB's Sound commands and virtually any FX sound can be found on the internet....... or DIY.
A great idea, but also sounds like a ton of work to achieve - would that be value for the time spent? Recorded FX can be played via PB's Sound commands and virtually any FX sound can be found on the internet....... or DIY.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: commands to generate sound FX
@IdeasVaccum: I'm not sure what Blue Steel would say but I think it would be similar to the following view held by me.IdeasVacuum wrote:Hi Blue Steel
A great idea, but also sounds like a ton of work to achieve - would that be value for the time spent? Recorded FX can be played via PB's Sound commands and virtually any FX sound can be found on the internet....... or DIY.
One advantage to generating effects instead of only playing them is that it requires significantly less memory. A single three second sound effect can take up 150KB of data as a '.wav' file. If the sound data is generated as needed it would require less than 80KB for the generator and the specifications to generate the sound. Additional sound effects could be generated with less than 1KB each. For simple sound effects this results in a significant degree of 'effect' for the memory used.
@Blue Steel: I think the idea is worthwhile and am hoping to devote some serious time to in in the near future. I am interested in hearing any ideas you have regarding this. Those ideas include what sound generation characteristics would be needed, playback features, etc. One aspect that I have to do some research on is being able to use a callback interface to fill a sound buffer as needed during the playback process.
The links you posted formed the basis for the SFX (wav) generator I posted in the Tips & Tricks forum. It already handles many of these features. There needs to be some integration of them though. Pjay's version produced the sound but didn't allow any specifications for it. I really would like the ability to play an effect that includes specifications for duration and distortion (amongst other things) and affect those things to a specific pitch or frequency.
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: commands to generate sound FX
what i'm basicly after is (for those of you who can remember) back in the C64 days you used to poke memory addresses to set pitch , envelope, attack , sustain , reverb, echo, pitch, release . for up to i think it was 4 channels. (4 notes/tones could be played at same time)
From looking at the source code to PJ's and Demivec code it shouldn't be all that hard to use the variables of the produced data and set them when they have to be playid .. either by seperate commands or paremiters to a single create/play sound eg: "cpsound volume,envelope,pitch,attack,release,sustain,echo,reverb" or similar .. utilising the variables that actually do get set in the sound generating program.( yes .. i'd like to be able to set them all.. or have them default just like you can in the sound generator as it is now)
then you could get the generator program to generate these values to copy/paste into your command in your program. and also enable like pj's one did to play the actual data generated etc. all this data could then be stored as a file/ date or hard coded directly or using variables etc
I feel very strongly that a feature like this in a programming language WOULD make it stand out from the rest ( untill they too impliment similar). its something that has been greatly lacking in programming languages.
Yes for the larger more elabourate sound effects .wav , .ogg files could be the way to go. but my suggestion would actually lock the sounds into the program/software so that they can't easily be ripped off by simply copying a file. it would also mean that you could then dake data from any midi pack instriment and use it.. eg: record your own instriment using a midi interface and use that data to be able to play tunes etc.. on your computer.. just like the old ST/fmod trackers do with assigned instriments.
The benifits of this feature way out way the time it would need to impliment in my humble opinion. I've been looking for something like this for many, many years..
From looking at the source code to PJ's and Demivec code it shouldn't be all that hard to use the variables of the produced data and set them when they have to be playid .. either by seperate commands or paremiters to a single create/play sound eg: "cpsound volume,envelope,pitch,attack,release,sustain,echo,reverb" or similar .. utilising the variables that actually do get set in the sound generating program.( yes .. i'd like to be able to set them all.. or have them default just like you can in the sound generator as it is now)
then you could get the generator program to generate these values to copy/paste into your command in your program. and also enable like pj's one did to play the actual data generated etc. all this data could then be stored as a file/ date or hard coded directly or using variables etc
I feel very strongly that a feature like this in a programming language WOULD make it stand out from the rest ( untill they too impliment similar). its something that has been greatly lacking in programming languages.
Yes for the larger more elabourate sound effects .wav , .ogg files could be the way to go. but my suggestion would actually lock the sounds into the program/software so that they can't easily be ripped off by simply copying a file. it would also mean that you could then dake data from any midi pack instriment and use it.. eg: record your own instriment using a midi interface and use that data to be able to play tunes etc.. on your computer.. just like the old ST/fmod trackers do with assigned instriments.
The benifits of this feature way out way the time it would need to impliment in my humble opinion. I've been looking for something like this for many, many years..
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
Re: commands to generate sound FX
Pjay released the source with a nice interface! You can play with every setting, save it, load it and adjust it again:
http://www.purebasic.fr/english/viewtop ... 20#p325120
It's not real time editing but pretty good in my opinion ...
http://www.purebasic.fr/english/viewtop ... 20#p325120
It's not real time editing but pretty good in my opinion ...
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: commands to generate sound FX
I know that.. but it would be great to have it built into the language .. thats why i'm posting this as a "Feature Request and/or Wish list"
I too am only new to PureBasic and have tried and failed to trim it down to the necessities to simply creat and play the sounds via commands (ie: no interface or alike.. no load/save etc.. simply read in the data and play it from a command function etc .. if you follow. Thats why i'd like to see it added ..
BTW i've also asked for a similar feature to be addedinto other programming languages i also use.. ( from the C++ source code.. siting the Pure basic version as examples.. pointing them to the threads on this forum and the original home page for sfxr )
PS: they apear to have already added something like what i want to FLASH and I HATE FLASH.. so i want it in at least one of the languages i use.. and would love to see it in PureBasic .. ok
I too am only new to PureBasic and have tried and failed to trim it down to the necessities to simply creat and play the sounds via commands (ie: no interface or alike.. no load/save etc.. simply read in the data and play it from a command function etc .. if you follow. Thats why i'd like to see it added ..
BTW i've also asked for a similar feature to be addedinto other programming languages i also use.. ( from the C++ source code.. siting the Pure basic version as examples.. pointing them to the threads on this forum and the original home page for sfxr )
PS: they apear to have already added something like what i want to FLASH and I HATE FLASH.. so i want it in at least one of the languages i use.. and would love to see it in PureBasic .. ok
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
-
- Addict
- Posts: 1264
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Re: commands to generate sound FX
+1
I think media commands in general would be useful, including sound creation/manipulation commands.
And also:
I think media commands in general would be useful, including sound creation/manipulation commands.
And also:
Code: Select all
SaveVideo(5,filename,#PB_Video_WebM)
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: commands to generate sound FX
I see that it would have tremendous advantages on small format platforms such as smart phones and the like, but can we code for those with PB? For Windows PCs, most people already have an abundance of RAM and since Win7 has finally made 64bit popular with the masses, available RAM is about to increase dramatically - won't be long before the average PC has 12GB and the enthusiasts have 24GB or more. Using a recording you can have better, more convincing FX, a wide range 'off the shelf' to choose from and DIY is not so difficult for any specials/unique sounds.
What I was trying to suggest before was the development time needed might be better spent on other things. Perhaps PB Users would like to see improvements in cross-platform first, or more support for the Ogre engine, or be less dependent on API commands and so forth. Also, it would seem that PJay/Demivec could deliver on most of the FX requirements, perhaps those guys could produce a (commercial) PB add-on?
It's just my alternative view. As it stands your idea of course has great merit -if we can code for the iPhone etc then it would certainly be a 'no-brainer'.
What I was trying to suggest before was the development time needed might be better spent on other things. Perhaps PB Users would like to see improvements in cross-platform first, or more support for the Ogre engine, or be less dependent on API commands and so forth. Also, it would seem that PJay/Demivec could deliver on most of the FX requirements, perhaps those guys could produce a (commercial) PB add-on?
It's just my alternative view. As it stands your idea of course has great merit -if we can code for the iPhone etc then it would certainly be a 'no-brainer'.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Addict
- Posts: 1264
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Re: commands to generate sound FX
IdeasVacuum,
I know your post wasn't directed to me but I do agree with everything in it. Media commands would be nice but they shouldn't be a priority for PureBasic.
If I was to choose a priority for PB, it would be making the underlying PB codebase as platform-independent as possible, so that support for new platforms could be added more easily. The cross-platform thing is crucial. For example, PB can't make programs for the iPhone, Android etc. and I suspect that will become increasingly a problem, as a lot of software will migrate from standard computers to mobile platforms, taking programmers' salaries with it.
I also think that the Internet should be a focus for PB in the future because, again, a lot of software will migrate from the desktop into the browser. It seems to me that Google's Native Client will become very important in the next 10 years; it's already supported by Firefox, Opera, Chrome and Safari. If I could have one improvement in PureBasic, it would be the ability to program webpages with it!
I know your post wasn't directed to me but I do agree with everything in it. Media commands would be nice but they shouldn't be a priority for PureBasic.
If I was to choose a priority for PB, it would be making the underlying PB codebase as platform-independent as possible, so that support for new platforms could be added more easily. The cross-platform thing is crucial. For example, PB can't make programs for the iPhone, Android etc. and I suspect that will become increasingly a problem, as a lot of software will migrate from standard computers to mobile platforms, taking programmers' salaries with it.
I also think that the Internet should be a focus for PB in the future because, again, a lot of software will migrate from the desktop into the browser. It seems to me that Google's Native Client will become very important in the next 10 years; it's already supported by Firefox, Opera, Chrome and Safari. If I could have one improvement in PureBasic, it would be the ability to program webpages with it!
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Re: commands to generate sound FX
How will it be decided which sound effects get included? Will some users cry if the sound effect they want isn't in the library? What happens if the built-in sword clash doesn't sound the way you want your sword clash to sound? ISTR that the audio effects in the C64 were integrated into one of the chips. Generating these effects on the fly and adding effects such as reverb is going to consume a lot more CPU cycles and make your executable larger than playing back a PCM file. It seems to me this should be an application rather than something built into the language. Perhaps you could come up with a way to encrypt your SFX files and have your program unencrypt them if theft is a concern. Agreed it would take a lot of developer time to do this right; perhaps that is why other programming languages don't offer it.sound effects (footsteps , sword clashes , explosions .. NOT MUSIC)
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: commands to generate sound FX
its not a "Sound Library" its a Sound Generator.. you'd be generating the sounds using sin , square, sawtooth, noise envulopes etc.. setting the attack sustain, pitch , wave length etc.. etc... or use a generator to create the wave and then store it or tell you the values to input..
I'm not thinking of a resource manager.. where you attach sound data files to your app.
no it shouldn't take long at all.. most of the work is already done in Pj's and dem's code.. (Pj's early version had a commend which was in a library to add the commant to play a sound. it should just be a matter of taking it back a step and instead of using the generated data.. use the values to generate that data.. and the sound creation routing in a function or inbuilt command.. and another sub function to play the generated sound.
I'm not thinking of a resource manager.. where you attach sound data files to your app.
no it shouldn't take long at all.. most of the work is already done in Pj's and dem's code.. (Pj's early version had a commend which was in a library to add the commant to play a sound. it should just be a matter of taking it back a step and instead of using the generated data.. use the values to generate that data.. and the sound creation routing in a function or inbuilt command.. and another sub function to play the generated sound.
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: commands to generate sound FX
It probably would not take long for PJay/Demivec to define an add-on because much work is already done, especially if it were to be Windows-only. For PB, the code may well need to be in C and cross-platform, so that would take a bit of time.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Blue Steel
- Enthusiast
- Posts: 132
- Joined: Wed Aug 31, 2005 4:49 pm
- Contact:
Re: commands to generate sound FX
there is a C++ based code available .. and thats what PJ's and Dem's is based on so writting / incorporating it into the basiccode for the compiler shouldn't be that hard either.
Currently using PureBasic 4.51(x86)
http://www.codingmonkeys.com
Covers many languages including PureBasic

Covers many languages including PureBasic