Zebbi's Recent Forum Activity

  • > Maybe Gigatron has some ideas? ??

    >

    Zebbi

    Yes, i will soon drop shader fx and start with Plugin and Behaviour coding.

    All problem have their solution, i believe this.

    Really? What kind of implementation do you have in mind? Does webaudio have some sort of realtime audio render/stream to disk functionality?

  • Maybe Gigatron has some ideas? 🤓

  • Since you're limited to HTML5's APIs, I don't think you'll be able to do anything crazy like interact directly with a soundcard.

    I searched and these examples of capturing HTML5 audio, you may be able to interface with one of these libraries or examples.

    http://www.html5rocks.com/en/tutorials/ ... dia/intro/

    http://stackoverflow.com/questions/1641 ... io-to-file

    These should at least give you an idea of what kinda limitations there are. I haven't done any called to external JS code from within Construct2, but I'm sure you could find help to figure that out.

    Thanks for that, it's quite funny cod I would have thought since you can use webcam interaction and stuff, it might be easily possible. Instead of capturing there sound card, is there a way of streaming the audio from the output of the game to a file?

  • I'd like to be able to record the audio output of my game to the user's hard-drive without using microphones or preferably the windows mixer, but actually stream the audio data to a file and save it. If that's not possible, can it be done via recording the user's soundcard audio?

  • The timer frequency = 60/bpm, so at a freq of 0.5s, which is in the code, 0.5 = 60/bpm, bmp = 60/0.5 = 120bpm. If you think it out, the frequency is a beat every 1/2 second, so that's 2 beats per second, times 60 seconds, which is 120 bpm.

    bpm are generally considered 1/4 notes, so for 1/8 notes, divide the timer freq by 2, so 120bpm would be a freq of 0.25.

    I had a few bugs in my sample, so I've cleaned those up and added a start button. The trick is just to start at beat -1, so that it leads into that first beat.

    http://www.blackhornettechnologies.com/ ... Beat2.capx

    blackhornet I've come up with a hack that works very well for what I required, do you mind if I send you, you can see what you think to it, maybe it might be of use to you?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The timer frequency = 60/bpm, so at a freq of 0.5s, which is in the code, 0.5 = 60/bpm, bmp = 60/0.5 = 120bpm. If you think it out, the frequency is a beat every 1/2 second, so that's 2 beats per second, times 60 seconds, which is 120 bpm.

    bpm are generally considered 1/4 notes, so for 1/8 notes, divide the timer freq by 2, so 120bpm would be a freq of 0.25.

    I had a few bugs in my sample, so I've cleaned those up and added a start button. The trick is just to start at beat -1, so that it leads into that first beat.

    http://www.blackhornettechnologies.com/ ... Beat2.capx

    Okay, so with this, it places a marker on the visual beat, but I'm trying to wait until the moving blue box gets to a beat and THEN it plays the loop, is there a way of modifying this to get that to work easily?

  • Has nothing to do with 'dt'. Just use a Timer and get the percentage of it's period to see if the click goes left or right.

    http://www.blackhornettechnologies.com/ ... eBeat.capx

    blackhornet

    What bpm does the BeatFrequency correlate to?

  • You simply need to access the Time and dt values. I'm going to describe this in a general coding fashion here. You basically want to check on each frame if you're hitting a beat or not:

    At the start of the gameplay session, you store

    beatsPerMinute = retrieveBpmFromSong(currentSong);
    beatsPerSecond = beatsPerMinute/60;
    startTIme = Time;
    currentTime = startTime;
    secondsPerBeat = 1/beatsPerSecond;
    lastBeatTime = 0;[/code:hkifgpqj]
    
    On every frame, you want to get your current time, and check if it's approximately a multiple of your bpm. I you have hit a bit in the past secondsPerBeat though, you don't want the game to take it in account again in the next frame:
    
    [code:hkifgpqj]currentTime += dt;
    if(currentTime - lastBeatTime < secondsPerBeat)
    {
    if( 0.8 * secondsPerBeat < curentTime % beatsPerSecond < 1.2 * secondsPerBeat)
    {
    lastBeatTime = currentTime; // you trigger some visual thing, store values, whatever. At least, you know that this frame's timing is a beat. You can check the player's precision against it.
    }
    }[/code:hkifgpqj]
    
    It's a bit late, I'll try to make something like that directly on construct later!
    Cheers,
    Nathan
    

    Valerien I'd like to use this to sync loops to the nearest 8th note, so you can play a loop or a one-shot and it won't play/start looping until the timer is on an 8th note division, could this be used for doing that?

  • Yeah but what I want is you click to play a loop, it waits until the timer arrives at a division (say 8th note) and then starts. Should I do it with something like a global, and when I click to play a loop it turns the global to 1 and if the global is 1 and the time is a precise division, turn global to 0 and play loop? What expression should I use to test if the timer is currently on a division of the timer? Also, this would have to be compatable with different tempos rather than just, say, 120bpm (which is easy cos it's division of a realtime minute)

  • So, if I click "play loop" in my game, how do I use that to wait until the next division to play the loop?

  • I want to build a sample player and when you click a sound it "quantizes" the playback point to the next nearest division of the beat, so, if I've set the lengths of my sounds up correctly, they should all start correctly and stay in time with each other. Is there a good way of doing this with dt?

  • I'm actually working on a step sequencer. The formula I came up with is:

    240/(noteLength*tempo)

    noteLength is the denominator of the note, so a 1/4 note would = 4, a 1/2 note would =2...

    tempo is bpm

    a beat is considered a 1/4 note

    So, as per above, 240/(4*138) = 0.435 seconds between notes.

    Put another way, to see how long 138 beats take, 138 * 0.0.435 = 60 seconds; that is 138 bpm take 60 seconds to play.

    You can use the Timer behaviour to time the beats/notes.

    Did you manage to finish this, blackhornet ?

Zebbi's avatar

Zebbi

Member since 20 Jan, 2014

None one is following Zebbi yet!

Connect with Zebbi

Trophy Case

  • 10-Year Club
  • x3
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

12/44
How to earn trophies