2021-07-03 02:01:58

You can do sine wave generation or whatever.  There's another example of that in the examples directory.  You generate the basic waveform, shove it in a buffer, and use BufferGenerator.  I'll be offering a better version of that eventually, probably before 1.0 because it's easy.  See this issue for the thing tracking offering proper waveform generation, but the buffer approach is probably sufficient for anything most people here  want if you're willing to do the formulas.

But you can't do microphone streaming in 0.9.  That would require allowing you to stream in already-decoded audio data.  You can pass in already-decoded audio data, but not in a streaming fashion.  You could round-trip through an encoder but that's inefficient.  I'll probably offer it eventually, but honestly no one here has ever implemented voice chat, nor has anyone I know outside of this community, and "stream floats into the library" is just generally not super useful beside that.  I'm not going to chase things I don't need beyond what's planned for 1.0, because if I do I'll never get to do ammo, and ammo is kind of the point.  I will eventually do voice chat and you'll get it then, because if you have an audiogame with HRTF being able to hear your party as you try to fight the evil dragon or whatever is at worst a cool feature and at best something that adds a ton of fun value and ease of group coordination.  But needing me to do that for a legitimate use case is one of those "wow, audiogames just advanced a ton" problems I'd be thrilled to have and not something I expect us to realistically be discussing soon.

My Blog
Twitter: @ajhicks1992

2021-07-04 01:43:41

Ok. I give you 0.9.  Mac, Libsndfile, custom streams, new manual, a bit of other stuff.

Examples are in the repository.  I need to incorporate them into the manual somehow.

On the one hand this took long enough.  On the other hand it's lots of good stuff and we're down to only 3 issues on the 1.0 milestone.

Sorry for the API breakages.  No avoiding them.  As it says my hope is to not do this again before 1.0.

My Blog
Twitter: @ajhicks1992

2021-07-04 02:50:53

Thanks, This update is epic
Also, I think I spotted a bugg, If you plug headphones and unplug them, Playing sounds won't work anymore, I'm not sure if this kind of stuff is expected or not but just thought to put it right here.

2021-07-04 02:57:59

@478
That'll probably be in miniaudio. What platform?

My Blog
Twitter: @ajhicks1992

2021-07-04 03:32:09

It's windows.

2021-07-04 03:37:57

Ok. I'll have to look into this.

For what it's worth please start opening issues against the repository.

My Blog
Twitter: @ajhicks1992

2021-07-04 11:57:04

Thanx camlorn

best regards
never give up on what ever you are doing.

2021-07-04 15:38:01

@477
You, sir, are a wizard! Good work, and thank you very very much!!

-----
I have code on GitHub

2021-07-04 18:24:51

@Camlorn
Is there a way I can use PannedSource with stereo? I digged the manual and didn't find anything that tells if it possible, I need it for ambiences because ambiences mono would sound pretty odd.

2021-07-04 18:27:42

@481, this differs based on each OS, but on Windows check out this page. I don't know if its what your looking for, but you want to detect, for USB/thunderbolt audio devices, whenever they become available and no longer are. For 3.5mm headphones, I don't think you need to do anything.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-07-04 18:51:36

@484
No, you can't.  Panned sources are mono only.  Stereo panned sources are an odd thing that doesn't quite make sense because everyone wants something slightly different.  If you want spatialized ambiance you need to do it by actually really creating objects.

For what it's worth, you'll find that if you rotate your stereo file 90 degrees so that one channel is in front and one channel is in back, the ambiance "collapses" into something mono anyway.  You can't actually spin audio files around without artifacts unless you're using ambisonics, which we don't support and probably won't for a while (plus, making them requires particular expertise that most don't have, and there's other issues).  As soon as you try, you'll discover that the more you rotate it the narrower it sounds.  It's kind of hard for me to explain this well, but basically think of stereo files like a pipe sticking out the sides of your head or something.  It doesn't contain any info about what's actually "in front" of you, so when "in front" becomes to the side there's nothing there and we can't guess it and it's just a big hole in the soundfield.

@485
Miniaudio already does this, and you can ask Wasapi for it by default.  It's not a Synthizer bug and I've read the Miniaudio source before and it's definitely there.  Event detection and all that shouldn't be required unless this is a quite old version of Windows.  I haven't tried to reproduce it yet.

My Blog
Twitter: @ajhicks1992

2021-07-05 16:09:54

Would post on Github, but I'm likely just missing something. In python, Buffer.get_channels is no longer availible. Is this intentional? Is there another way to achieve this?

Trying to free my mind before the end of the world.

2021-07-05 16:21:23

No, that's broken.  It'll be in the next point release, but I'm not doing it now because I'm batching all the things writing official Rust bindings is in the progress of uncovering.

My Blog
Twitter: @ajhicks1992

2021-07-05 17:32:37

The headphones thing is specific to soundcards. More specifically, Intel+Realtech. Every time the headphones on my other laptop come unplugged, I have to restart most apps because the audio tries to switch to the next available, my cable, and doesn't switch back.

2021-07-05 18:08:18

yeah. To be honest I'm pretty sure that's going to end up being the case.  I've had Realtek before and it does all sorts of crap like that.  But still: I haven't tried to duplicate, so who knows at this point.  Have been putting my atypically high amount of energy into making Rust bindings instead.

My Blog
Twitter: @ajhicks1992

2021-07-05 18:26:25

why are the rust bindings so necessary? I mean, is making audiogames in it easier now than it was before? Isn't making audiogames in rust kinda like making them in c/c++/other low level languages? You once said one shouldn't jump to low level code unless one needs to, is it the case now? if so, is it worth it? Are audiogames so impacted by performance we need to go that root? Like, with the sighted games I kinda get it, graffics and all that. But is making audiogames in rust feasable now? because if so, I'll double my efforts of learning it.
I'm currently waiting for 1.0 to generate a set of bindings for c#, maybe I'll put it on nuget or something, even though then you'll need to include some c# binding generators and stuff in the CI, probably like you did with the python bindings.
Btw, how long is it before 1.0? is it true that there won't be api breaking changes afterwards?

2021-07-05 18:55:20

@491
First, Rust.  Rust is for Ammo, which is going to push the boundaries of what anyone has done if I succeed.  It's also very popular in sighted game land, and it's not like Synthizer is supposed to be blind-person only.  Rust is fine for audiogames.  It's not like C/C++, you're not going to shoot yourself in the foot.  Ammo is World of Warcraft for the blind: if I succeed it needs to run way more than 5 maps concurrently, and being as I'm going to promote it and not do stupid stuff like fail to write tutorials and make you install old DirectX and do antivirus exceptions I think I can get peaks of 100 players, and you can have 1 player per map, and if you have 100 maps that's 100 maps you have to run.  That's a unique problem as far as audiogames go.  Maybe something like Survive the Wild has pushed that boundary or something, but I bet anyone who has is laggy.

But Rust is not a newbie-friendly language.  You're a newbie as far as I can tell.  Beyond most here, but not at the point where you can go "you know it sounds like it might be fun to make world of warcraft" and have the biggest problem be "shame I only have weekends and art is going to be hard to get".  A lot of the answers around what you should be using and what you can be productive with change once you're at the point where you can build anything and the only limit is time.  Rust isn't like any other mainstream language and it has a lot of unique stuff, but functional programming doesn't frighten me and lifetimes are easy enough and when my language says "I am opinionated, abstract how I want or else" I'm not spending several months readjusting all of my thought processes away from object oriented programming or whatever else.  Plus I have been using it at work continuously for 9 months and have contributed to their compiler so any learning curve that there was is something I got over a long time ago.

If you want to pay the Rust learning cost you can, but I don't see what it gets you.  I see what it gets me.  Maybe you will use it one day, but wait until you have projects that need it.  Unless you really truly enjoy learning technologies, there's no point learning technologies before you have a use for them.  If you were going  to do a systems language Rust is probably what you would want to do, and it's actually less crash-prone than even Python believe it or not.  But it's expensive.

Second: C#.  I'm not going to include bindings generators in CI for you.  If you want that you can run your own CI on the Synthizer repository.  GitHub actions is free.  Python has special status because I need something which is easy to test with, but nothing else is getting that privilege, even code by myself.  The new Rust bindings also live outside the repository.  In general you're supposed to run bindings generators yourself and then commit the code they generate, anyway.

Third: Synthizer is semantic versioning.  1.0 means stable.  If I break things we bump to 2.0 and so on.  I'm not promising no more breaking API changes after 1.0.  I'm only saying that the goal is to try to not have breaking changes between now and 1.0.  There are lots of things I want to add which I'll be doing as I or someone else needs them, but the current goal is to get a stable, non-beta release.

My Blog
Twitter: @ajhicks1992

2021-07-05 19:04:49

What I think would make many run away from rust is the inability to make global variables, I don't mind it my self, But I know many that likes making many global variables, There's static, But good luck having that work with a struct initialization or something.
Thanks for creating the rust binding, I've been waiting for this for a long time, I have a question though, Is using the current github build fine? I mean is it so buggy where I shouldn't need to tuch it or not? I've built it locally and I tried it and it's working grately, But thought to ask

2021-07-05 19:23:19

@493
Frankly, global variables are something that only new programmers use for the most part.  There are ways to make up for the very few legitimate reasons to use them in Rust, but the only reason that audiogames have a lot of global variables is because all of the people doing them are inexperienced.  Outside of these circles, it is universally recognized that global variables are a bad idea, and they do not factor into language choice.

My Blog
Twitter: @ajhicks1992

2021-07-05 19:52:00

@493, to add to what Camlorn said, Rust does in fact allow you to use global variables. Its just a lot stricter about what you can do with them. You need a synchronization mechanism on them if you want to safely access them, which is a good thing. You can use static mut but that's not safe and from what I know its being removed sometime in the future.
Point being: there are very, very few times when static variables are necessary. I use them in my embedded programming in my kernel but only in very specific circumstances when a struct wouldn't work. But even then I'm pretty sure there are better ways I could do things.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-07-06 14:51:58

hy there!
@492: OK then, if it's for your future project thingi, then meh, I see where performance is necessary considering the scale of the thing you're trying to build. Tbh, besides you and probably ethin, I don't see anyone in this community being able to pull it off, unless there's a massive collaboration between all the members of this forum to make something like that, something certainly unpresidented and not likely to happen for a very long time, if ever.
yes, you are definitely right when saying I'm basically a newbie, I certainly have a lot to learn before I can get a decent enough job. Thing is, I'm still at that faze where I want to learn technologies and languages just because it's fun, because I want to be forced to think outside the box of what I learned before, even though I think in an abstract way about the job certainly, but not as much as the fun of it, the brain exercise so to speak.
However, the gotcha with this is that I'm still unsure of what I want to do professionally. I mean, I find syber security related work interesting, however I still find a lot of many unrelated things and frameworks and whatnot interesting and, therefore, am trying to learn them. It's not that I'm failing at it, or I don't think so anyways, however I think I need to learn some specific thing and focuse on it, this I know a bit of everything is not gonna help me if I don't know something very well.
About global variables, I stopped using them within around 6 months of coding, I just felt they are making my code cluttered, I didn't know then about harder to maintain, and was wandering if it could be done another way. Interestingly enough, once I came across some of the concepts of oop to the most basic level, I didn't find them hard at all, actually felt almost like that's the only way and the golden way to write code ever invented since the first cpu and all that.
So yeah, I want to learn rust at, maybe only to an intermediate level, you guessed it, kinda just because I like learning languages and technology, always see interesting potential in them, like the newly gaining in popularity flutter with dart as it's language of choice.

2021-07-06 15:24:32

Don't underestimate how valuable being what I call a generalist is.  Being a generalist factored into my current job.

But I will say that a lot of the answers I give here are tailored to the audience in the sense that how I would do it isn't how you should, and what I value probably isn't what you value.  In terms of *me* making a game, doing it in Python or Rust is probably about the same amount of effort once it's big enough to be even remotely challenging by my definition of challenging.  But I'm coming from a unique place in so far as people you can find in this community: real-world non-game experience, have been doing this for like 10 or 15 years, and so on.  I have done work things that are harder than Ammo should prove to be if we discount the social aspects and some of the "well no one has ever done this and we have no idea how the UI should work" sorts of things.

My Blog
Twitter: @ajhicks1992

2021-07-10 15:38:04

Hi all. So i am not sure on weither i am using synthizer the right way, but this is for a menu class. If i put the normal file path to the background music file, it plays in the menu. How ever as soon as I want to use this code it tells me "resource not found."
import synthizer


class menu:
    def __init__(self):
        self.options=[]
        self.music=""
        self.gen=synthizer.BufferGenerator(globals.ctx)
        self.buf=synthizer.Buffer.from_file(self.music)
        self.gen.buffer=self.buf
        self.src=synthizer.DirectSource(globals.ctx)
        self.src.add_generator(self.gen)
Can any one please help me?

best regards
never give up on what ever you are doing.

2021-07-10 17:14:10

You're setting self.music to the empty string, then using self.music a few lines later, where it is the empty string.

I assume that you intended to make music a parameter to the constructor or something.  In any case, before asking questions try printing the arguments to functions before calling them to check what they are.

My Blog
Twitter: @ajhicks1992

2021-07-10 23:44:27

Hi Camlorn,

The philosophy of this library is very nice: a system ready for anything in sound.

I have two  question:

Usually we need to write stream API for large audio files. Is this built in?

Another, while reading this thread, you said that you were waiting for the development/stable of dr_ogg to be finished. Again, there is stb_vorbis, which consists of a single file. It's an old library but as far as I know the Ogg specification hasn't been changed since 2005.
Why don't you use this?

One note, BGT used stb_ogg I think.

Sory my off-topic addition, I don't know anything about panBB and am unfamiliar with the forum culture.
How can I be notified when new entries are made in the threads I wrote?
Does everyone control matters?

Sometimes they reply to me and I see them after 1-2 weeks.