ChatGPT will make us Job(Home)less


Joined
Mar 11, 2022
Messages
225
Reaction score
29
On my Weekend i was fooling around with ChatGPT. Well, to say "im impressed" is a sheer understatement. Holy sh....

I let it do a couple tasks. From easy PHP to heavy Java and Kotlin. In the middle of it of course also Javascript.

I gave it a task to code an organ which can be played on the computer keyboard. y(german keyboard) to M (white keys), A to l (black keys). Of course it messed up, but unfortunately not that much. This is only V3 (2021) V4 is coming in weeks (which reach a completely new level).

But let's just check out the organ of V3. I never had a hand in it. Just copy and paste. Woooooooooow.
https://jsfiddle.net/kwngjfet/

Or for those who can't wait
Code:
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();

// Define the frequencies of the notes
const notes = {
    "y": 261.63,
    "x": 277.18,
    "c": 293.66,
    "v": 311.13,
    "b": 329.63,
    "n": 349.23,
    "m": 369.99,
    "a": 392.00,
    "s": 415.30,
    "d": 440.00,
    "f": 466.16,
    "g": 493.88,
    "h": 523.25,
    "j": 554.37,
    "k": 587.33,
    "l": 622.25,
    "w": 659.25,
    "e": 698.46,
    "r": 739.99,
    "t": 783.99,
    "z": 830.61,
    "u": 880.00,
    "i": 932.33,
    "o": 987.77,
    "p": 1046.50
};

let oscillators = {};
document.addEventListener("keydown", (event) => {
    if (event.key in notes) {
        if(!(event.key in oscillators)){
            oscillators[event.key] = audioCtx.createOscillator();
            oscillators[event.key].frequency.value = notes[event.key];
            oscillators[event.key].type = "sine";
            oscillators[event.key].connect(audioCtx.destination);
            oscillators[event.key].start();
        }
    }
});

document.addEventListener("keyup", (event) => {
    if (event.key in oscillators) {
        oscillators[event.key].stop();
        delete oscillators[event.key];
    }
});
 
Ad

Advertisements

Joined
Jan 22, 2023
Messages
2
Reaction score
0
Will still take a programmer to query and to understand the code that it prints out, enough to implemet it in a real life scenario, but I'm definitly impressed by it too! I wouldn't go replacing a programming team with it, but would encourage it's use as a tool...maybe.
 
Ad

Advertisements

Joined
Mar 11, 2022
Messages
225
Reaction score
29
@SoftwareDevGirl
Yep. That's why im not that concerned yet, but.... i mean....
The organ example was one of the first picks to check. I have it wrote complex programs since and i am impressed. Especiality by it's capability to react on my imporvement suggestions if it fails the first time or don't do it the way i want it.
For example i can ask it to improve certain functions with more or other params, and it won't forget what it did first and builds it up on that. Wow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top