Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Synthesizing sound with memblocks - Possible?

Author
Message
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 01:20
This is a completely new field for me - but is there any way of creating sound with memblocks?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th May 2013 01:26
yes,but you must save and load them.
you can write it direct as bin file without memblocks.
load from memory or url is not supported as far as i know.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 4th May 2013 01:31
Yes
It'll take you a bit of research and a bit of code writing.
This is something I've often wanted to do, but it is very time consuming.
Basically you'll write the file byte by byte.
Or load the original wav file byte-by-byte into a memblock and alter it.
Good luck I'd love to see it done.
You might want to research bfxr to see how they did it.

Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 01:41
Markus,
I see. So we really need the equivalent of CreateImageFromMemblock - then. I hereby wish for "CreateSoundFromMemblock"

Naphier,

I use bfxr constantly. It's FANTASTIC!

http://www.bfxr.net/

Diggin into this materia is really tempting. But I KNOW i will loose focus and be lost for another week

This sure is something for my future microscope.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 4th May 2013 01:52
I used bfxr to make the sounds for dFenz. I cleaned them up a bit with Audactiy after generating them.

It's not hard to load or save raw data into a file.
You don't really need CreateImageFromMemblock(or CreateSoundFromMemblock) you just need to understand the file structure for a WAV (or JPG or whatever) and write the correct header.

Here's an awesome graphic from Stanford
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
It shows the structure. Just write to a file byte by byte.
Kind of a pain, but once you write the functions for it then it is easy.
I'd be more concerned about what data to put after the header... like what data represents what notes, volume, etc.

Do it!

Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 02:04
Quote: "Here's an awesome graphic from Stanford"

No no! That is too tempting. Don't show me these things.

Thanks!

I never want what I know.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th May 2013 02:28
i already make some good suggestions but they was unwanted :-(
LoadImageEx(GetDataFromFile("File.png"))
LoadImageEx(GetDataFromMemblock(mID))
LoadImageEx(GetDataFromWWW("http://..."))
LoadSoundEx(...)
LoadMemblockEx(GetDataFromFile("File.png"))

here is my vb6 source for creating a wave file:
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 02:46 Edited at: 4th May 2013 18:43
Quote: "i already make some good suggestions but they was unwanted :-("


Markus, that was not my intention. I'm, sorry. You pinpointed EXACTLY what was on my mind. That you cannot create a sound from memory. Because this is what I finally want. I'm exploring ways to do things at runtime - not offline.

But THAT example is a Fantasic Idea. To use images to create sound is really an invigorating concept.

Thank you so much for the Code. I will surely dig into it.

I never want what I know.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th May 2013 10:53
yes, the main problem is that data get only from filesystem
and not anywhere. a file is just a bytearray.
but the reason can be api/lib functions from os behind.

write/load a wavefile is at runtime too but unbeautiful.

i think you want have access to the playing sound buffer and
modify the data in it for realtime sound,true?
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 16:32 Edited at: 4th May 2013 17:37
Quote: "i think you want have access to the playing sound buffer and
modify the data in it for realtime sound,true?"


That is absolutely correct.

I've been testing, experimenting, learning and asking a lot of questions around here lately and I have made myself a neat little game project to learn Agk and coding. It will be all vanilla agk Tier 1. No premade assets. Everything made in runtime.

I know this is the opposite of what is recommended for agk - but I learn a lot while doing it and I'm having fun.

I never want what I know.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 4th May 2013 17:59
Can't wait to see what you come up with! Unfortunately modification of something as complex as a sound file will be extremely resource extensive at runtime. If dll were available in AppGameKit then it may be easier but still very complex and eat up all your CPU cycles!

Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 4th May 2013 18:08
Quote: "but still very complex and eat up all your CPU cycles!"


Not in it the main loop of course. Only in the initialisation of the game. It will probably take some time starting up.

I never want what I know.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th May 2013 18:12
yes, i hate this creative limits too.
all is possible anyway but you waste much lifetime on this way.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 4th May 2013 18:51
This can be a great idea!!!
I agree!
We need this command.

Long life to Steve!
Timshark
16
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 5th May 2013 04:03
I thought a little more about this: If agk gets microphone support I guess they have to add some sort of memory-sound function. or Maybe the recording will just be written direct to file....

Microphone support is an enhancement request in the agk bug board it seems...

I never want what I know.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th May 2013 09:20
Quote: "Microphone support is an enhancement request in the agk bug board it seems..."


I long since stopped holding my breath for that one!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th May 2013 11:46
OT:
Microphone support will be great.
you can make graphics effects with the sound around you,
means loud music.
or with the ms voice input sdk i made voice input commands for the fsx flight sim.

Login to post a reply

Server time is: 2024-05-03 20:46:15
Your offset time is: 2024-05-03 20:46:15