Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Sound Synthesizing
- - By Jwosty Date 2011-08-14 04:35
I think a nice addition to Gosu would be a sound synthesizer of any type, so you don't have to get all your sound from files. I am suggesting this because it would be helpful in my project Songbugs in which I have each note sound stored in a file, when instead I could use a Gosu synth.

What some (Ruby) code might look like:

def initialize(somearguments)
  @synthesizer = Gosu::Synthesizer.new(window = @window, soundtype = :guitar)
end

def play(freq = 440)
  @sampleinstance = @synthesizer.play(hertzpitch = freq, durationsecs = 0.5)
end


...or something like that. What do you guys think?
Parent - - By Spooner Date 2011-08-14 14:19
Well, you can already modify a sound's pitch on playback. The problem with stuff like soundtype = :guitar is that everyone's belief in what a guitar sounds like is different. If you want synthed sounds, there are an unlimited number of places on the Internet to grab them or you can make them yourself with bfxr.

If you need to create synth tunes, perhaps a dedicated MIDI gem is what you want?
Parent - By Jwosty Date 2011-08-15 14:02
Yeah that last thing is exactly what I need. Also I could just change the pitch of one master file so i don't have to use 8 different ones... Thank you!
Parent - - By jlnr (dev) Date 2011-08-14 22:17
I think it wouldn't be a good addition for Gosu because it's really a rather special thing. I think you should look for synthie library and just write to a temporary file that you feed to Gosu afterwards. If it turns out to be really useful, Gosu could add support for loading files from memory. Much like RMagick can be used to create images from code, and Gosu can load those from memory.
Parent - By Jwosty Date 2011-08-15 14:01
Ah okay. Thanks!
Parent - By Jwosty Date 2011-08-15 14:11
Also, does Gosu need the file to be present until the object using it is gone? Because I found a ruby gem called Synthsize that can write generated sounds to a file, and I was thinking that I could delete the temp sound file immediately after I make a new Sample.
Up Topic Gosu / Gosu Exchange / Sound Synthesizing

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill