/dpt/ - Daily Programmmmmmming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/drewjohnson2/console-player
en.wikipedia.org/wiki/Pulse-code_modulation
github.com/JadeMatrix/Kani/blob/test_play_song/Source/test_play_song.cpp
github.com/GeorgeSeeger/cli_snake
twitter.com/AnonBabble

Say I have a text file full of tweets from someone. Is there a library or program that can read the file and write new tweets based on the input file? Is there a name for what I'm looking for?

you could use it to create a markov chain and use that to generate similar tweets

So deep learning?

if you want the program to generate new similar tweets a markov chain generator might be what you're looking for

Thanks so much. I'll look into it right now.

dijkstra was an autistic cunt

Would have made a great Sup Forums user.

Working on my iTunes replacement. I've got a single-file program that will play any number of audio files back-to-back. Now I need to take that code and figure out how to restructure it so I can use it to build something that can be paused, adjust volume, dynamically queue songs, crossfade, and scrub.

I guess I could see Dijkstra using a tripcode, spending his days owo'ing and sperging at people using goto.

what are the most usefull applications of Algorithsm that you would use in a software engineering position? determining big O complexity / time? Proving the correctness of an algorithm? Prove that a problem is NP-complete?

I assume knowing the basics like merge / insertion sort etc and the strengths and weaknesses of each

I wonder what future generations will think of any CS geniuses that come from our generation.

>those retards who parroted Djisktra and programmed in js

What language?
What operating system?

I've done a simple audio player in the past too, but without conversion.

What anime would dijkstra watch?

evangelion

writing efficient code

>iTunes
OS X obviously. Yeah I know it's available for Windows, but Windows already has other options (foobar for one). I'm trying to make it native, so Objective-C++. The actual audio handling bit is in C++ though because CoreAudio is a C API. As far as conversion goes, OS X handles format & codec detection & conversion automatically as long as you have the right codecs installed.
>tfw there's a kAudioFormatFLAC defined

>The actual audio handling bit is in C++ though because CoreAudio is a C API
I'm not very good at explaining shit. I don't have to use C++, I could just use Objective-C. But wrapping some internal stuff in C++ like may make potential future porting to native programs on other computers just one tiny bit less painful.

thx, i've got an over the phone interview for a software engineering job coming up soon that focuses on OO languages, algorithms, and systems software

Just use the ffmpeg libs like libavformat/libavcodec, it should be available on most desktop unix and if it's not you can build a paper thin version with only the codecs you need for static linking.

c++ is the best language and visual studio is the best ide

Nah the whole point is to use CoreAudio & Cocoa, platform-independence is bar far a secondary concern.

I disagree.

Good taste desu

I hope whatever you prefer works for you as well as visual studio and c++ works for me. pic related
:)

I like tmux, vim and a shell. I enjoy it. pic related.

haven't done any programming so far on my time off from work

feels great, nice change

I just finished a console MP3 player. Could anyone give me some pointers on how to improve or things i can do to make my code more elegant?

(it only works on mac :^/)

github.com/drewjohnson2/console-player

>using the carrot with the blank face

kek

>MP3
>every single file is MPEG-4 audio

Correction:

Console audio player. Fug

>mewithoutYou
You have good taste.

really makes you think

Thanks senpai

they're my favorite band along with Pinback.

this is a Sup Forums post tho

:^)
Anyways fellow audio player dev, I see you're on OS X, too. What did you use to build it?

a compiler

As for the question, you should add a scanner (or at least a time indicator) to the bottom.

Well, I'm a brainlet so I hope I answer your question correctly:

I used sublime text and a terminal window for writing, the libraries I used were curses, glob, subprocess, and I used a built in mac utility, afplay, for actually playing the audio.

I'd like to get to the point where I can write an actual audio player, but this whole project was basically a UI.

Progress update before bed: as some user suggested, I'm working on type checking for my interpreter. I found that I'll need type information anyway, so I decided to bite the bullet and just work on it now. The language can be used to fairly reliably express ideas (for, while, if, work, as do arrays, functions, and operations through operator overloading), but it looks like I'll be moving away from that now.

I've really wanted to do that, however I'm not sure how to go about it seeing as I used a built in utility called afplay to play the files.

the "I wrote an audio player" was a tad misleading. I basically wrote a UI.

So your language is already inferior

A python thing that can parse LTFS schemas and queue file copies ordered by their position on tape, grouped by tape name. So it says "Insert Tape [Name]" and you put in the LTO, then it copies the requested files to a location.

I'm doing this for work, in the film industry. We will be able to feed the script an ALE of reference clips from Avid, and have the script parse out the tape names or labrolls and find them on the dailies LTOs, copy the shots to our SAN, and generate an AAF linked to those clips so we can load it to the Flame or Davinci Resolve or whatever without having to hunt for them. It's actually coming along quite well; I'm surprised. lol

I think this is pretty darn neat. I like the use of curses. I would like to see it adapted to detect the operating system and use some Windows equivalent for afplay if necessary.

Having homogeneous arrays is a deliberate inferiority, but an inferiority nonetheless.

Writing an "actual audio player" isn't hard at all. You need an interface for an audio device to write PCM data to, you need to learn about PCM and you can use a library for a codec.

That's about it, everything you need to know is on this page.

en.wikipedia.org/wiki/Pulse-code_modulation

Use libavcodec to decode(decompress) your audio data.

Does afplay not have any way to seek through tracks or at least give any indication of the length of the track?

Thanks senpai, feels good man.

I need to definitely look into it. I'm about to have to move away from Macs because I'm an idiot and sold my 2013 model to get a 2016 and it sucks dick hard.

>brainlet
user, pls: I was never able to figure out curses/ncurses, maybe I'll bother with it again some day. But I didn't know afplay existed, I assume it's basically just Apple's piss-poor CoreAudio """"tutorial"""" as a utility. This is what I managed to throw together using it: github.com/JadeMatrix/Kani/blob/test_play_song/Source/test_play_song.cpp . It's just a starting point, as I mentioned before. I decided to start from the bottom-up, which is apparently the opposite of you. Also I'd suggest doing what this user suggests even I won't be following the same advice :^)
Also I'm checking out mewithoutYou right now, not the kind of stuff I usually listen to but it's preddy gud.

You're a saint. Can't wait to look into it.

Not that I'm currently aware of. I read the man file but it doesn't really offer any useful information

That's lame, but by now it looks like you've put in a fair amount of effort. How difficult would it be for you to switch that out with something with more functionality? I'm not very familiar with macOS terminal stuff.

Thanks senpai.

This was my first time fucking with ncurses and the whole project took me about 12 hours total of learning and trial and error.

I initially tried writing it in C but I ran into some platform issues as well as compiler issues so I had to bump up to Python. My ultimate goal is going back and writing in C or C++ someday when I can figure it out.

I highly suggest either Brother, Sister or Pale Horses. Also checkout Pinback, might be more your style.

I'm not sure. It would take some learning another few libraries (API's?) and figuring out exactly what I want to do. If I had to ball park it I would say a week or so.

>max
succs bruh, build yourself a nice desktop PC if you can. mine was so much fun to make, and has lasted me 10 years now.

I don't know why by C++ or C code that looks like this always seems like greek to me. I haven't looked at it long enough I suppose. Another thing to learn!

If afplay is what I'm thinking, it's literally just play song file until over or ^C. Also OS X "terminal stuff" is basically the same as Linux/UNIXlike "terminal stuff."

Yeah, I really do. I was always really happy with my old one but Apple had to fuck me and make the new computers not only suck, but now I can't even dual boot debian like I used to.

This is the future I chose

Damn. If you decide to do that, I'd look into one that can read ID3 tags.

I was referring to libraries for terminal oriented software.

You're right. I tried libraries I found online for playing audio but all of them only supported wav files or mp3.

I need to quit dragging my feet and write my own audio player.

That's the dream, anyways.

This whole project gave me a real appreciation for other console players that people have written. It's amazing, really.

Well if nothing else, at the very least you can say that it was a good learning experience.

It pretty much is, CoreAudio & AudioToolbox feel very old-fashioned. It mixes Hungarian notation with Apple's habit of very long names for things, like CFURLCreateFromFileSystemRepresentation() or kAudioConverterErr_RequiresPacketDescriptionsError.

>libraries for terminal oriented software
Same as everywhere else, stdio & ncurses

Yeah then go with something that supports a bunch of codecs and gives you a unified interface to linear PCM data, like libavcodec or CoreAudio.

Send me the typechecker once its stable, I'll try to break it.

The second I saw bitshifting I started scratching my head. For some reason that's a beast I haven't quite been able to beat yet.

I'll post it here when it is. But it'll take a few more days at least.

>last update a month ago
>name, email in the source code
I doubt that you made this desu
Also, configuration should be separate from the source code (eg the music folders)

That's why you use the ffmpeg stuff. libavformat handles almost every container format you can encounter, libavcodec handles almost every AV compression algorithm you will encounter.

The output of the decoder(audio data decompression) is PCM data, you just need to output it to the right place in a supported PCM format. By right format I mean that your audio device may only handle certain types of PCM data.

You can do it yourself with e.g. ALSA/pulseaudio on linux, or that subsystem(I forget the name) that came from ancient DirectX on windows. I don't use OS X but it obviously has it's own interface.

You can also use libao from Xiph.Org(also known for opus/vorbis, flac) for a portable interface to the system audio.

Oops, you caught me!

Send an email to me, I'll get back to you ;)

I forgot to mention, the ffmpeg libs have very limited docs(only doxygen generated stuff). Use them for reference but you should start by looking at the programs in doc/examples in the ffmpeg source tree.

Thanks senpai, I'll look into it!

lmao user is jealous

okay well that's something for now I guess, at least tomorrow I can get back to actually programming

Does building this graph actually serve a purpose?

presumably it will help him build a program

How though? It seems for something this simple the regular top-down approach would be much simpler.

Basically, I've already familiarized myself with the tools CoreAudio/AudioToolbox supply for playing audio files. I just needed to organize them into a system I can use to build the player I want. Apple's documentation leaves a lot as an "exercise for the reader."

Programming is for dummies. I know this because I'm stupid. Does this make mathematicians especially stupid?

How does your stupid mind come to the conclusion that programmers and mathematicians are stupid because you're stupid?

To. 64061859
stupid people can still do basic 1st grade math, just like stupid people can learn HTML and Python. It doesn't take away from the people doing non-brainlet things.

>just like stupid people can learn HTML and Python
And Haskell, and Idris, judging by this thread. Damn... He might have a point.

>And Haskell, and Idris
Most people here dropped out of Idris when they found they couldn't be lazy shitters like they are with haskell. And Haskell brings plenty of frustration.

>I don't understand therefore Idris is better

>i'm more than happy to put up with tedium, so clearly i'm not stupid
I don't think this statement would pass the type-checker.

I meant in general with people learning haskell here, not my personal opinion. Personally I think Haskell is a giant mess though, that Idris mostly remedies.
Explicitness != tedium
Dependent types demand it, which is why liquid haskell is also a mess.

Your all stupid, lets all aggree that I'am the only non-stupid person here.

>Dependent types demand it, which is why liquid haskell is also a mess.
except
1) they don't
and
2) it isn't

See OP's pic

>let's have types that depend on other types but make everything auto and implicit so my annotations give 0 information
But hey, look how terse they are!

>Explicitness != tedium
Explicitness always equals tedium. That should be plainly obvious, but I guess not for the sort of people who use Idris, which just further backs up my point.

Dijkstra was a cunt, see .

Don't trust the dutch jew.

Being too implicit can cause more tedium trying to reason about things, and refactoring them. At that point, type annotation may as well be optional.
Why do people refuse to think in anything but the short term?

user it really is remarkable how you can be so foolish

>Why do people refuse to think in anything but the short term?
That actually applies to Idris users more than it applies to me, but that's besides the point. Do you acknowledge that explicitness is always tedious?

>namecalling instead of a refute
every time.

Don't exaggerate, everything's fine until the smug cartoons show up.

i'm sorry for you but you just seem to have the dumbest ideas

I made snake whilst on a train ride today

Pls r8 & h8 (>inb4 ruby)

github.com/GeorgeSeeger/cli_snake

filtered

>evangelion
so, literal shit you say?