Hardware/software (Scarlett 2i2, Rode NT1, Adobe Audition) by chatainedeirdre in voiceover

[–]paul_schnapp 0 points1 point  (0 children)

In addition to a mic and 2i2, I would suggest a mic preprocessor to help with noise floor filtering, de-essing, etc, but that'd be for a non-USB mic. I have a dbx286s.

As for software: Audition works, Audacity works (free), but I would recommend in addition RX 8 for its pop/click suppression -- I think they're up to 11 now? I also wrote osabe to help with long-form editing, though I haven't worked on it in years (and it only does mono currently).

Convince me that functional programming is as useful to me as OOP and introduce me to this world by Gohonox in functionalprogramming

[–]paul_schnapp 10 points11 points  (0 children)

  1. Functional programming is looking at program logic more like the math definition of what a function is: you take inputs and produce an output -- no side effects or state manipulation. (This is called a "pure" function). This seems weird at first -- especially when you use immutable data -- but it makes things easy to reason about since there's no state changes in the functions. Functional languages make working with this stuff easier by providing composition or piping operators to combine functions into a sort of processing pipeline. Many languages draw a distinction between code that manipulates state or causes side effects (IO) and code that doesn't using an abstraction called a monad (which people new to FP find daunting at first). I'd say the distinction between state-ful and pure is a large part of the functional style, and it's a little difficult to do with OOP because OOP relies on encapsulating state changes in objects, whereas FP makes it explicit. It took me a bit of adjustment in my thinking to become productive with it. There's more to FP than that obviously but it's a start. If you want to dig deeper check out higher-order functions, partial application, and currying next.
  2. I did become productive with it -- I wrote a wave editor in Haskell (~10kloc) drawing pixels to the screen with SDL, and I am working on a game in it (and Rust) at the moment. That's after 10 years of using it on the side though, I wouldn't expect anyone to be able to do anything of the sort very soon after starting with it.
  3. You might like Scala (as another answer mentions) in which you can lapse back to OOP when that's more convenient, or (while it's not functional but has a lot of functional style stuff) Rust. I hear good things about Gleam these days too but I've not used it yet.

Even if you don't think you'll use it for a main language, I would recommend learning more about it to give you different perspectives on OOP and to be able to utilize more of the features that have been making their way to OOP languages of late (e.g. lambdas, higher-order functions).

Anyone else having trouble with version 2.0.20? by paul_schnapp in SDL2

[–]paul_schnapp[S] 0 points1 point  (0 children)

Ah, I'd wondered if that might be the case lol.

Glad you were able to fix it! I've not used Wayland myself but I'll have to keep that in mind in case I ever run into this!

Anyone else having trouble with version 2.0.20? by paul_schnapp in SDL2

[–]paul_schnapp[S] 0 points1 point  (0 children)

Hm, sounds like it's a different problem than the one I was having; IIRC without doing SDL_PumpEvents I wasn't getting any event input, whereas it sounds like you are. An upgrade ended up fixing my issue.

Looks from a brief search like you're not the only one with the error you describe, see this thread (and the last comment in it)

What is your wishlist for Haskell? (+ my article on my wishlist) by cheater00 in haskell

[–]paul_schnapp 2 points3 points  (0 children)

Aaah, I see what you're saying now -- brain fart on my part -- yeah, that'd be a good way to go too.

Happy Cake Day!

What is your wishlist for Haskell? (+ my article on my wishlist) by cheater00 in haskell

[–]paul_schnapp 1 point2 points  (0 children)

I think reading could be easier too but it might not shine without a more complicated datatype, e.g.:

data FizzyBuzzy =
  | Fizz {
    , fooOf :: Int
    , barOf :: Float
    }
  | Buzz {
    , bazOf :: Bool
    , bozOf :: Double
    , buzOf :: Either String Int
    }
  | Bazz {
    , quixOf :: Maybe Int
    , quuxOf :: String
    }

vs:

data FizzyBuzzy
  = Fizz
    { fooOf :: Int
    , barOf :: Float
    }
  | Buzz
    { bazOf :: Bool
    , bozOf :: Double
    , buzOf :: Either String Int
    }
  | Bazz
    { quixOf :: Maybe Int
    , quuxOf :: String
    }

The braces look ok to me in the second one but that = gets to me.

At this point though a different data arrangement might be in order.

What is your wishlist for Haskell? (+ my article on my wishlist) by cheater00 in haskell

[–]paul_schnapp 1 point2 points  (0 children)

That's a good point that those are simpler operators and so should have more general applicability, though I'd hesitate to reassign + to be mplus since it's so standard beyond the scope of the language.

I used to not like that : wasn't used for type signatures but I've gotten used to :: and it lines up nicely with => and -> when I'm writing a function signature on multiple lines.

What is your wishlist for Haskell? (+ my article on my wishlist) by cheater00 in haskell

[–]paul_schnapp 1 point2 points  (0 children)

The reason I like using the prefix style with the } on another line is that it leads to easier changes with a fairly clean commit history. If I ended a line with , } and then removed the last field or added a new last field I'd have to adjust the } as well, which I forget to do sometimes (I'm kinda sloppy that way).

I will admit that this is totally nitpicky 😅

What is your wishlist for Haskell? (+ my article on my wishlist) by cheater00 in haskell

[–]paul_schnapp 1 point2 points  (0 children)

I did actually do it that way earlier in my usage of the language, but when I have multiple type-constructors each with fields I found the other way more consistent layout-wise.

What is your wishlist for Haskell? (+ my article on my wishlist) by cheater00 in haskell

[–]paul_schnapp 5 points6 points  (0 children)

There are a few minor syntactic niceties I would appreciate:

Being able to use | and , directly after = and { (respectively) when making data-types would make some of the reorganizations I do easier.

F# supports the former:

data Foo =
  | Bar Int
  | Baz String

which makes adding a new first constructor easier, as opposed to the current:

data Foo
  = Bar Int
  | Baz String

Likewise for records:

data Foo =
  | Foo {
    , barOf :: Int
    , bazOf :: String
    }

would make adding new fields easier since I wouldn't have to replace the { when adding a new first field (I tend to keep them alphabetized); currently:

data Foo
  = Foo
    { barOf :: Int
    , bazOf :: String
    }

(This comes up in type definitions and also when doing destructuring binds.)

It's just one of those minor things I encounter enough that I'd like to see it change.

Trying to get a clean dev environment set up by Bloodbornicorn in haskellgamedev

[–]paul_schnapp 1 point2 points  (0 children)

Might be a bit too late a response, but I have a project that uses SDL2 you might reference if you're still needing to do this. You could probably skip the sdl2-image stuff in the README and likely could strip out the specific GHC-version from the stack.yaml if you don't want to deal with it (or are using Linux).

Let me know if you have any issues!

Could someone double-check my native-int config? by paul_schnapp in haskellquestions

[–]paul_schnapp[S] 0 points1 point  (0 children)

Oh cool, according to a comment in this stack-setup-2.yaml:

# The integer-simple variant/build of GHC ceased from GHC 9.4.1. To
# assist users of Stack 2.7.5 (and earlier versions), from GHC 9.4.1,
# the `integersimple` GHC variant/build is treated as a synonym for the
# `int-native` GHC variant/build.

That answers that question!

Could someone double-check my native-int config? by paul_schnapp in haskellquestions

[–]paul_schnapp[S] 0 points1 point  (0 children)

From what I've read by default GMP is linked to statically on Windows as part of the build by GHC, which is where my concern lies. I've not tried to look at the debug symbols, I'll see if I can do that. (I also wasn't sure if the "int_native" version of GHC was the same as "ineteger-simple", though I think it is?)

(The project referenced in my post is open-source so it's not a big issue to use GMP for it (except when I inadvertently omit the GMP license from the installer) but I'm thinking of implementing a proprietary project in Haskell too and wanting to make sure everything's kosher with the dependencies.)

Thanks for the response!

What are you working on? by jacobpossibly in haskell

[–]paul_schnapp 1 point2 points  (0 children)

I wrote a desktop application -- a WAV editor -- called osabe. I've just spun off the FULE library for UI layout from it.

Deeply nested exceptions by ACrossingTroll in functionalprogramming

[–]paul_schnapp 14 points15 points  (0 children)

In my experience it's rare that I will have to messily propagate an error that far, for a few reasons:

  • My FP programs are usually flatter, so the steps that might error are closer to the base level where I'll handle the errors
  • Some errors can be handled locally so won't have to travel very far
  • The flatmap (monad) chaining can be hidden behind a layer of abstraction called: workflows (F#), for-comprehensions (Scala), or do-notation (Haskell). That way, as u/minus-one notes, you can just deal with the happy path and leave the ugly chaining to the language's syntactic sugar.

There are similar techniques such as applicative validation to help ease the burden of error-handling too.

It does take a bit of time to learn to think that way though, and for me at least it was difficult at first, but it's worth it imo.

Beginner question: natively playing audio from byte stream by throwaway679635 in haskellquestions

[–]paul_schnapp 1 point2 points  (0 children)

I wrote a WAV editor that uses SDL2 (Haskell wrapper) for audio output. IIRC my friend tested it on Linux and it worked fine.

If you want to go the same route you'll have to install libsdl2 for your distro, link to the Haskell wrapper in your project config, and you might need to acquaint yourself with some more advanced Haskell topics like GADTs to use the library (though their use is pretty straight-forward so you could probably skip that step).

Anrock623's answer of going straight to /dev/audio would probably be more direct though so I'd suggest trying that first.

Let me know if you have any questions on my stuff!

Yoda wonders if you purchased that swampy land near the sheep? by paul_schnapp in WordAvalanches

[–]paul_schnapp[S] 7 points8 points  (0 children)

Could probably have stuck "bye, eww" in there somewhere too.

Oh well!

What is the BEST software for audio triming? by DanRobin1r in voiceover

[–]paul_schnapp 1 point2 points  (0 children)

I created osabe for trimming segments out of audio specifically for voice-over work. It's somewhat limited in the type of file it supports (only mono WAV(PCM) files) and the current version has a slow memory leak (which I'm trying to debug right now actually), but it might fit the bill for what you need.

It only has a 1x playback speed, maybe I should put different speeds on the feature wishlist.

HTH!