Author Topic: 2 Suggestions: Audio and DrawingSurface  (Read 2589 times)

TheManInBoots

  • Epically wrote function to declare an int
2 Suggestions: Audio and DrawingSurface
« on: 01 Apr 2020, 00:34 »
Might be both Engine or Editor related, I'll just post it here:

1) This might be long overdue, I'm sure it has been suggested before, but you cannot make audio files louder.
You can only adjust the volume lower. And that is very impractical.
If you have a single audio that is too quiet, you're in for a lot of trouble.
That's a function that would be quite useful.

2) In the Drawing Surface Manipulation I noticed that when you draw a sprite unto the Drawingsurface (using the DrawImage function) the Alphachannels are not properly imported and drawn unto a transparent drawing surface background. The outlines of the transitioning alpha show pink pixels. (And the original png file did not have a pink background at all btw).
The alternative to draw Drawing Surfaces unto Drawing Surfaces also is only very limited because you cannot choose the coordinate where to draw the surface unto. Nor stretch it.
So here the suggestion is to improve Alphachannels for the DrawImage  function and add coordinates and width/height regulation for the DrawSurface function, because their uses are too limited at the moment.

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #1 on: 01 Apr 2020, 00:55 »
2) In the Drawing Surface Manipulation I noticed that when you draw a sprite unto the Drawingsurface (using the DrawImage function) the Alphachannels are not properly imported and drawn unto a transparent drawing surface background. The outlines of the transitioning alpha show pink pixels. (And the original png file did not have a pink background at all btw).

This is not normally supposed to happen, unless there's mistake in sprite import, or sprite and surface formats don't match somewhere. We'd need more information to diagnose the problem, such as properties of the sprite, and what the surface is got from. Please also tell, what do you mean by "transparent drawing surface background", and what commands exactly do you use to draw (what parameters)?


TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #2 on: 01 Apr 2020, 02:59 »
Both sprites I used have been imported from png.

The surface was created from a dynamic sprite, which itself was created from a normal game sprite.

The sprites I use have a transparent background, simply put.
So when I create one sprite as the drawing surface, obviously there are transparent parts in it.

I just use the simple Draw command, just as I mentioned in the first comment:
My drawingsurface is called Basesurface:

Basesurface.DrawImage(300, 300, 22);

300,300 off set.

No complicated parameters.


So, it only recognizes 100 % Transparency, or 0 %.
When I set the parameters:

Basesurface.DrawImage(300, 300, 22, 99);

The entire area that is not 100% transparent in the original sprite becomes pink, because the alpha channel is not differentiated.

Notice that there is no problem whatsoever with it when I draw a surface with the ID 22 sprite as image unto that previous Basesurface.
The halftransparent parts of the original sprite are beautifully depicted without problem that way.
« Last Edit: 01 Apr 2020, 05:43 by TheManInBoots »

Re: 2 Suggestions: Audio and DrawingSurface
« Reply #3 on: 01 Apr 2020, 06:26 »
Might be both Engine or Editor related, I'll just post it here:

1) This might be long overdue, I'm sure it has been suggested before, but you cannot make audio files louder.
You can only adjust the volume lower. And that is very impractical.
If you have a single audio that is too quiet, you're in for a lot of trouble.

How are you "in for a lot of trouble"? Just open the audio in your editor of choice, make it louder, re-import it into the game.

Alllowing AGS to increase the volume of audio would be a terrible idea in my opinion, since most people don't really have a good grasp on how to work with audio and would just turn their clips up to 11, creating horrible clipping and distortion in many cases. If you want to play with volume levels, you need to have a VU meter so you can see what you're actually doing.

In any case, the best practice is to normalize the volume of your tracks to 0.3 dB in your audio editor, and then using the loudest one as reference for setting the global system volume in AGS and matching everything else to that.

TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #4 on: 01 Apr 2020, 06:50 »
You do not need a volume unit meter obviously, and that would be a terrible and artificial way to adjust your audio.

The most intuitive way is to experience the game live with the audio.
That's when you can decide best where sounds should be louder, more quiet, when it's all mixed together and happening with all the influences of the game in real time.

When you create your game, it might be an organic process. You don't know yet how much audio you will add.
It's impossible to adjust all the audio volume beforehand.
And editing, re-importing an audio because you cannot make it louder, that is not really a beautiful solution.

That people will misuse it cannot be a serious argument you give?
If people want to mess their games up, the volume might be the least of their problems. Should we maybe remove the volume regulator to to turn the audio volume down as well? Because some people turn the volume too low?
Then we could go as far as to remove all audio functionality in AGS because some people do not add their audio properly and mess it up.

Anyways, having a volume up functionality would be way more comfortable and intuitive.
I still think that.
« Last Edit: 01 Apr 2020, 06:52 by TheManInBoots »

Re: 2 Suggestions: Audio and DrawingSurface
« Reply #5 on: 01 Apr 2020, 07:28 »
You do not need a volume unit meter obviously, and that would be a terrible and artificial way to adjust your audio.

Oh ok, so I guess decades and decades of every single audio mixer and audio app having visible volume levels for reference is just a "terrible and artificial way" to do things.

The most intuitive way is to experience the game live with the audio.
That's when you can decide best where sounds should be louder, more quiet, when it's all mixed together and happening with all the influences of the game in real time.

When you create your game, it might be an organic process. You don't know yet how much audio you will add.

It's impossible to adjust all the audio volume beforehand.

That's exactly why you normalize all your audio before importing it into the game and then adjust all clips relative to each other, knowing that you've already hit volume peak and you're not going to need to increase any volumes any further, only lower them.

And editing, re-importing an audio because you cannot make it louder, that is not really a beautiful solution.

So a "beautiful solution" is to just pump up the volume in-engine until it clips? You really have no idea what you're talking about, sorry. The only "beautiful solution" here is to do things right from the start and normalize your clips before importing. If you screw that up, then you're going to have to go back to the source and fix it there, not add duct tape in-engine.

That people will misuse it cannot be a serious argument you give?
If people want to mess their games up, the volume might be the least of their problems. Should we maybe remove the volume regulator to to turn the audio volume down as well? Because some people turn the volume too low?
Then we could go as far as to remove all audio functionality in AGS because some people do not add their audio properly and mess it up.

This is so dumb that I'm not even going to bother addressing it. Next.

Anyways, having a volume up functionality would be way more comfortable and intuitive.
I still think that.

Yeah of course you still think that. You've proven time and again on here that you're incapable of admitting when you're wrong. Hopefully the devs will have a bit more common sense.

blur

    • blur worked on one or more games that won an AGS Award!
    •  
    • blur worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #6 on: 01 Apr 2020, 07:58 »
In any case, the best practice is to normalize the volume of your tracks to 0.3 dB in your audio editor, and then using the loudest one as reference for setting the global system volume in AGS and matching everything else to that.
I used to make live video recordings of theatre and music performances for five years and the above stated statement seems very reasonable to me, although I would suggest to normalize the volume to -0.3dB as zero dB is the absolute maximum volume.

Re: 2 Suggestions: Audio and DrawingSurface
« Reply #7 on: 01 Apr 2020, 08:09 »
In any case, the best practice is to normalize the volume of your tracks to 0.3 dB in your audio editor, and then using the loudest one as reference for setting the global system volume in AGS and matching everything else to that.
I used to make live video recordings of theatre and music performances for five years and the above stated statement seems very reasonable to me, although I would suggest to normalize the volume to -0.3dB as zero dB is the absolute maximum volume.

Yes, that was a typo, sorry! Should have been -0.3 dB, obviously. Good catch! :)

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #8 on: 01 Apr 2020, 09:38 »
Could we keep this conversation calmer please?

It is technically possible to support volume increase past 100% of course, whether that's easy or not to do depends on what our backend library supports, in the worst case we might have to write our own filter.
Having a system of audio filters has been also a request before.

On the other hand, I also doubt such feature should be used in upping your clip volume to match others.
Editing sounds in a proper audio software - that is perfectly normal and valid way, and always advised, because it gives you more precise control over what you do. I am saying this, having not a very big experience in gamedev, but also larger experience programming software that worked with audio for radio and DJ stations.

EDIT: It's true that you cannot know which sounds do you import and how they mix beforehand. In my games I used this amateurish approach: choose couple of most prominent clips (most common sound effects, and a music track), edit them to the volume you find good, and then use these clips as "anchors" for comparison whenever you import anything else. (So, I actually simply compared new clips with these "anchor" ones in the sound edit software)

Programmable volume boost in game is meant primarily for special effects (sound distortion under certain conditions, for example). Of course, it still may (and, I guess, will) be used to normalize sounds, but possible misuse is not something you may fully avoid, so we will have to explain good practices in the manual.


PS.
Anyways, having a volume up functionality would be way more comfortable and intuitive.
I still think that.

I'd like to note: everyone has something he or she is more comfortable with, but when we develop a game engine and tools we choose to rely on the known best practices, which are backed by experience in the industry. It's not feasible to cover every single personal approach, because in that case the engine will become a monster with inconsistent behavior. If in the end you won't find a method you like in supported features, and won't want to switch to using the suggested methods, then the remaining solution would be to create (or ask someone to) an editor or engine plugin for personal use.
« Last Edit: 01 Apr 2020, 11:35 by Crimson Wizard »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #9 on: 01 Apr 2020, 15:59 »
PPS. I don't know if this is necessary, but just in case someone reading this thread needs this, I wanted to elaborate why using over 100% volume in scripts is not a best idea for leveling your sounds.

This is the sound wave of an audio clip (a screenshot is taken from "Audacity" program):




The sound wave is depicted by series of numbers, which graphically are represented as columns. The larger the number, the higher column is. The larger the number (and higher the column), the louder this piece of sound is too. The actual clip may consist of series of pieces with very varied values. This creates a meaningful sound.

When you increase these numbers the sound gets louder, decreasing them makes it less loud. But to keep the sound "meaningful" (or maybe I should say "consistent"), you have to increase or dicrease all of these pieces altogether, consistently.

The problem here comes from the upper limit. It is imposed by data format, but also may be by whatever software, drivers and devices you have, I think.
As soon as you reach that limit, these sound columns will be clipped. Because they have different heights, initially, they won't be clipped all at once, but only ones that reached the limit. As you increase volume further, more pieces of this sound wave will be clipped. Eventually, you would get a plain "block" instead of a soundwave:





So, it is because of this clipping, the sound gradually becomes distorted until it is no longer meaningful clip or song, but just a noise.

Thing is, when you are doing this in a audio editing software, you can see the sound wave and can visually control what's going on (and maybe even receive warnings from the program). But when you are amplifying volume in the game script, you don't see that, and have to rely on your ears. Every person have their own hearing, and sometimes you may miss these distortions, or perhaps check only small part of the clip, not realizing other part became damaged.

This is, in a nutshell, why it is advised to amplify sound volume in a audio editing program first.

« Last Edit: 01 Apr 2020, 16:01 by Crimson Wizard »

TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #10 on: 01 Apr 2020, 16:31 »
I'd like to note: everyone has something he or she is more comfortable with, but when we develop a game engine and tools we choose to rely on the known best practices,
It's not only for being more comfortable, I genuinely think it helps to do better audio mixing live in the game.
I doubt that people who are not even able to set a proper volume regulation will be able to do any of the audio assimilation techniques mentioned above.
And I believe there are a lot of private people as well who use AGS to create games, who do not have the same approach as big game companies with an entire team to create games.

So if the suggestion comes up multiple times, of course only then then it might be worth considering to add it.
Not just for me.
I might be off in my assumption on if other people would also find this function useful, but the backlash I had for merely making a suggestion (that would be very useful to me and improve my audio mixing personally), is completely inappropriate and ridiculous.
At least you want to encourage people to say what they think. You can still decide afterwards if it's a bad idea or not, without making a fuss about it.

Thanks for the illustrations, that makes it clearer.
Of course I understand why the clipping could be a potential danger for adding a volume increase function.
Let me know if you have more insights on the DrawingSurface function, Crimson Wizard. There is so much cool stuff you can do with it, if there is a way to fix this.
« Last Edit: 01 Apr 2020, 16:55 by TheManInBoots »

TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #11 on: 01 Apr 2020, 16:58 »
You do not need a volume unit meter obviously, and that would be a terrible and artificial way to adjust your audio.

Oh ok, so I guess decades and decades of every single audio mixer and audio app having visible volume levels for reference is just a "terrible and artificial way" to do things.

It seemed like you were talking about actual real life metal VU meters. In-app volume meters are useful obviously.
Best meter is still your ear.
« Last Edit: 01 Apr 2020, 17:00 by TheManInBoots »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #12 on: 01 Apr 2020, 17:03 »
Let me know if you have more insights on the DrawingSurface function, Crimson Wizard. There is so much cool stuff you can do with it, if there is a way to fix this.

Right, I am planning to set up the test example and see what happens there, although maybe more information will be required, can't tell right now. I'll be back at it soon.

Re: 2 Suggestions: Audio and DrawingSurface
« Reply #13 on: 01 Apr 2020, 17:12 »
the backlash I had for merely making a suggestion (that would be very useful to me and improve my audio mixing personally), is completely inappropriate and ridiculous.

Oh, don't even try to get away with that "I'm just a poor victim here" crap. In my very first reply to this thread I said I thought it would be a bad idea and gave logical arguments as to why, and your immediate reaction was "weLL mAyBE wE sHoULd rEmOvE aLL aUdIo fUnctIOnaLiTy fRoM AGS tHEn hUH". You didn't get slapped because you were "merely making a suggestion", but because you acted like a brat. Period.

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #14 on: 01 Apr 2020, 17:17 »
Every ear is different. And your earing changes with age, just mentioning it in case you don't know this. By giving an example, our amplifier occasionally goes wankers and starts emiting a loud high pitch. I can hear it, my son can hear it, my husband can't hear it. Which means if he's starts using it I often have to go and tell him it's "piiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiii...." again.  :-\

Also, from my experience with using audio files, it's a bad idea to adjust the volume for individual files. Just normalize with audacity and don't adjust. When you add sliders to let the players adjust the volume for their individual preferences those clips will miss their setting and gain the new setting for the channel... I guess you could program each clip's volume to always have the same relationship, but think that's way much more work than just leveling your sounds in the first place.
There are those who believe that life here began out there...

Re: 2 Suggestions: Audio and DrawingSurface
« Reply #15 on: 01 Apr 2020, 20:08 »
Every ear is different. And your earing changes with age, just mentioning it in case you don't know this. By giving an example, our amplifier occasionally goes wankers and starts emiting a loud high pitch. I can hear it, my son can hear it, my husband can't hear it. Which means if he's starts using it I often have to go and tell him it's "piiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiii...." again.  :-\

Yup. And not just your ears, but your audio setup too. My current speakers have a listed range of 60-20000 Hz, which means there's a whole range between 20 and 60 Hz that I am literally unable to hear due to my speakers' physical limitations. If those frequencies are present in my music, my equipment simply won't be able to reproduce them (I would need a subwoofer for that), which in turns means I can't trust my ears, and that I depend on the visual elements such as graphic waveforms or VU meters to see if there are any dominating frequencies under 60 Hz that would screw up the mix if someone with a subwoofer were to play the same track. Therefore, knowing how to read and use your instruments and tools is essential, since in many cases they can "see" stuff that neither your ears nor your equipment can.



TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #16 on: 01 Apr 2020, 20:22 »
Right...
You guys done yet?
I know it's a rough time for all of us at the moment, but could we go back to topic?
No one's holding you back to adjust your audio the way you want in case you didn't notice. You can do whatever you want. Do your - 0.3db thing. Be happy. It's fine. I'm not agitated, I don't know why you are.

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #17 on: 01 Apr 2020, 20:36 »
Right...
You guys done yet?
I know it's a rough time for all of us at the moment, but could we go back to topic?

Excuse me... but what is the topic to go back to? People are discussing whether it's a good way to adjust audio by amplicating volume in game script, as proposed in the first post. Was not that a topic? or at least part of it.

This thread suggests to add a certain feature in the engine, so it's important to know why we are doing this and what implications and misuse potential it may have. It's also not uncommon for people to ask to add something, thinking that will solve certain problem, while the solution lies elsewhere; that happened multiple times before, so we try to get to the bottom of each issue.
« Last Edit: 01 Apr 2020, 20:50 by Crimson Wizard »

Snarky

  • Global Moderator
  • Global Moderator
  • Mittens Lord
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #18 on: 02 Apr 2020, 11:16 »
Right, and I think it does point to a problem in AGS. If the solution is to normalize each track (basically "make it as loud as possible") externally (I feel there are some further complications to that advice that, for example with a set of speech files, where depending on the presence or absence of peaks in the volume, normalizing each track individually could cause the perceived volume to fluctuate, but this gets into other territory), you need a way to adjust the mix in AGS by turning down the volume on certain tracks. But as Cassie says:

Also, from my experience with using audio files, it's a bad idea to adjust the volume for individual files. Just normalize with audacity and don't adjust. When you add sliders to let the players adjust the volume for their individual preferences those clips will miss their setting and gain the new setting for the channel... I guess you could program each clip's volume to always have the same relationship, but think that's way much more work than just leveling your sounds in the first place.

It gets quite complicated if you want to have some overall volume adjustment while some tracks are set to not play at 100%, because AGS doesn't distinguish between the "natural," pre-set volume of the track and any further volume adjustments you make to the channel, and also because of the AudioChannel/AudioClip model, where there's no state linked to a particular "instance of a playing clip" (so if you for example add a "natural volume" property, it would have to go on the AudioChannel, and then you have to make sure it expires/is overwritten when the clip stops playing on that channel).

TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #19 on: 02 Apr 2020, 15:59 »
Sorry, if there's more to discuss about the volume function, no problem, I thought it was generally considered not important.

With back to topic I meant drawingsurfaces.
Remarks like 'brat' made me doubt the constructive intent of the previous comments regarding volume.

OK, back to volume then:

I was not discussing adding an audio mixer to AGS Cassiebsg, so people with auditory impairment will still have to do the mixing externally. It's unrelated to my suggestion.

If you normalized your audio to - 0.3dB maximum volume and adjusted all audio to that volume, it can still happen that when all the sound is mixed together, there are sounds that are not loud enough when played together with the other sounds. Depending on the frequencies and nature of the sound, some sounds sound completely clear and fine when played by themselves, but when mixed together with other sounds of the same volume, they get completely covered up. And then you would have to make all the other sounds more quiet, instead of simply turning that one sound up. Or obviously instead of doing that you will just turn the volume up in the audio editor, export and re-import it. But you will have to guess the right volume. And if you guessed wrong, do the entire process again. Or you turn the volume too loud in the audio editor just to be safe (which might cause clipping).Or you try to recreate the complete audio scene with all sounds in the audio editor. And do that for every sound that is not right. That again sounds like a lot of work to me compared to having an inbuilt volume up.
And honestly, if you create something really new and you're being really creative, you don't know from the beginning what you're going to create. And you might add audio incrementally, and it will improve your creative process this way, and the end result will be better if you have an organic creative process. And for that process a volume up would be useful.

Sure, of course you need good enough loudspeakers to use your ears as judgement, Laura.

Wouldn't it be possible to use the same method as for turning the volume down in channels?
« Last Edit: 02 Apr 2020, 22:12 by TheManInBoots »

Snarky

  • Global Moderator
  • Global Moderator
  • Mittens Lord
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #20 on: 02 Apr 2020, 20:43 »
If you normalized your audio to - 0.3dB maximum volume […] And then you would have to make all the other sounds more quiet, instead of simply turning that one sound up. Or obviously instead of doing that you will just turn the volume up in the audio editor, export and re-import it. But you will have to guess the right volume.

No, you can't really do that, because if the sound is normalized to -0.3 dB it's already (almost) as loud as it can get without clipping. You could play around with boosting only certain frequencies to make it appear louder, or boost the volume around the peaks (compression), but simply increasing the volume (amplitude) will cause clipping to some extent.

Wouldn't it be possible to use the same method as for turning the volume down in channels?

I'm not sure exactly what method you're referring to, but it would be possible to make it so that turning the volume of one sound above 100 actually just automatically reduces the volume of all the other sounds.

I'd think of it as having a game-wide property: MaxVolume, that is initially set to 100. And the actual volume that each clip is played at is the proportion of their volume level to this value (so Volume:50 is 50/100, or 0.5 of max). But if you set the volume of a clip above 100, let's say 120, the MaxVolume will automatically be increased to that value, and the effective volume of all clips is recalculated (so now Volume:50 is 50/120, or 0.42 of max).

You could object that this would suddenly make the volume of other things go down in the middle of the game, but you could make MaxVolume available in the editor, and set it yourself to the appropriate value so the volume is consistent throughout the game.

It would also be possible to code something like this up as a module.

Edit: Or there's the zero-coding approach: instead of playing all sounds at 100% volume by default, set the default volume to 50% and use that as your baseline for the audio mixing, which gives you room to boost the volume of particular clips if you need.
« Last Edit: 02 Apr 2020, 20:49 by Snarky »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #21 on: 02 Apr 2020, 21:44 »
@TheManInBoots, so , regarding the DrawImage/Surface problem.

I've read your last comment on that, and I still need to confirm something:

1. The game colour depth is 32-bit, correct (double checking)?
2. There's an option in General Settings - Visuals - Sprite alpha rendering style, is it set to "Proper Alpha Blending"?
3. What are sprite colour depths (I assume 32-bit too but double checking again), they are both imported with alpha channel preserved, and when you say that sprites have "transparent background", you mean it's alpha transparency, and not "magic pink" color in both of them?
4. When you created DynamicSprite from existing sprite (to use for Basesurface), did you provide preserveAlphaChannel parameter?

EDIT: Forgot to ask, but probably not important
5. which version of AGS were you using?
6. where is the final sprite applied to (room object?).


And another thing -
Notice that there is no problem whatsoever with it when I draw a surface with the ID 22 sprite as image unto that previous Basesurface.
The halftransparent parts of the original sprite are beautifully depicted without problem that way.

Again, to make sure I understand correctly, you did following:
- Get DrawingSurface from sprite 22; I assume you create a dynamic sprite from 22 first to do so?
- used Basesurface.DrawSurface( surface from 22 ) with some transparency parameter.


I'd like to underline, that DrawImage is already expected to do everything correctly if sprites have alpha transparency. So possibly what happened there is either mistake in your game or mistake in the engine.



UPDATE:
DrawSurface method is a separate issue here. I guess that this function is useful when you don't have an original sprite and surface comes from room background or similar thing. In that case you are stuck with this limited function, or have to copy surface onto a DynamicSprite first, which is an extra step and extra resource. So this request seem logical.

Something that bothers me, is that one will have to create DrawingSurface in order to paint room background somewhere first. So it's still one redundant step. I think, in the future it may be better to have a way of referencing room backgrounds and other similar non-standard images, directly, just like you reference sprite with slot ID. One of the options here is to actually assign a sprite ID to the room frame(s) and its masks. And maybe even handle these as regular sprites internally. Then everything will just go through DrawImage with no need to have duplicate methods.
« Last Edit: 03 Apr 2020, 00:27 by Crimson Wizard »

TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #22 on: 04 Apr 2020, 00:23 »
No, you can't really do that, because if the sound is normalized to -0.3 dB it's already (almost) as loud as it can get without clipping.
Oh yes, I got that wrong.
I probably confused normalizing with mixing somewhere in there.
Edit: Or there's the zero-coding approach: instead of playing all sounds at 100% volume by default, set the default volume to 50% and use that as your baseline for the audio mixing, which gives you room to boost the volume of particular clips if you need.
That's a really great idea! Something I can implement right away, which will give me the playroom I need. It's good practice in pre-mastering to set all audio to -6dB to create more playroom for mastering, so setting the volume to 50% (depending on how AGS works with volume, if that's half the energy level, it would mean to -3dB) would do almost exactly that!
Thanks for the idea!

I'm not sure exactly what method you're referring to, but it would be possible to make it so that turning the volume of one sound above 100 actually just automatically reduces the volume of all the other sounds. [...] (so now Volume:50 is 50/120, or 0.42 of max).
That's exactly what I would be looking for.

You could object that this would suddenly make the volume of other things go down in the middle of the game
I would envision a module like that to register the maximum value used in the entire game from the very beginning on, and adjusting all audio right from the beginning to it.
Or maybe you can feed the module the maximum value manually with a function after you "mastered" all audio files, so all volume is correctly adjusted constantly.

Given the dampened enthusiasm I received for this suggestion I expect I will have to create this module myself.
Your module proposal, would it be possible using only standard channel functions, such as they are mentioned e.g. in the manual?
If I wanted to create the same thing, but so that you can actually change the default volume value of the audio file to more than 100 directly in it's property grid, would I have to learn how to create plugins?
Just theoretically, if I wanted to add a function that is able to read the actual dB level of the audio file in AGS, it would be over a plugin as well, correct?


Crimson Wizard,

It's one item of your checklist exactly.
When I imported the DynamicSprite from existing sprite I did not check preserveAlphaChannel as true.
That's the reason it did not work.
I assume you won't need too much information anymore.
But just a few details:
1-3: Check! Yes for all.
5:3.5.0.23
6: yes, on object.

For drawingsurface:
I created Basesurface from Dynamic Sprite, which was created from sprite 1.
Then I drew unto Basesurface the DrawingSurface called Imagesurface, which I created from a DynamicSprite, which again was created from Sprite 22. The original sprite 22 contained half transparent parts, so I did not add an additional alpha channel.

If you're for any reason still curious I can obviously tell you more.
That makes this part of the thread  possibly more suited for Beginner's Technical.
But I really thank you for your help!

One of the options here is to actually assign a sprite ID to the room frame(s) and its masks. And maybe even handle these as regular sprites internally. Then everything will just go through DrawImage with no need to have duplicate methods.

Sounds great! And useful
« Last Edit: 09 Apr 2020, 18:38 by TheManInBoots »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #23 on: 04 Apr 2020, 00:38 »
It's one item of your checklist exactly.
When I imported the DynamicSprite from existing sprite I did not check preserveAlphaChannel as true.
That's the reason it did not work.

I feared it's the case.

Actually, I am now thinking to change the default value of preserveAlphaChannel to true for the next version, because it makes more sense this way, as it is not a common thing when you want to strip alpha transparency when cloning your sprite.

TheManInBoots

  • Epically wrote function to declare an int
Re: 2 Suggestions: Audio and DrawingSurface
« Reply #24 on: 04 Apr 2020, 00:57 »
Yeah... seems more intuitive that way!
« Last Edit: 09 Apr 2020, 00:55 by TheManInBoots »