<commit_before>/** Author: <NAME> */

package main

// typedef unsigned char Uint16;
// void AudioCallback(void *userdata, Uint16 *stream, int len);
import "C"
import (
	log "github.com/Sirupsen/logrus"
	"time"

	"github.com/outrightmental/go-atomix"
	"github.com/veandco/go-sdl2/sdl"
)

const (
	sampleHz   = 44100
	numSamples = 4096
)

func main() {
	if err := sdl.Init(sdl.INIT_AUDIO); err != nil {
		log.WithFields(log.Fields{
			"error": err,
		}).Fatal("Cannot init SDL")
		return
	}
    defer func() {
        if r := recover(); r != nil {
			log.WithFields(log.Fields{
				"recover": r,
			}).Warn("Player Recovered")
        }
		sdl.PauseAudio(true)
		atomix.Teardown()
		sdl.Quit()
    }()

	var (
		step = 125 * time.Millisecond
		loops = 4
	)

	var (
		p808  = "assets/sounds/percussion/808/"
		kick1 = p808 + "kick1.wav"
		kick2 = p808 + "kick2.wav"
		snare = p808 + "snare.wav"
		marac = p808 + "maracas.wav"
	)

	atomix.Debug(true)
	atomix.Configure(sdl.AudioSpec{
			Freq:     sampleHz,
			Format:   sdl.AUDIO_S16,
			Channels: 1,
			Samples:  numSamples,
		})
	atomix.StartAt(time.Now().Add(1 * time.Second))

	t := 1 * time.Second // padding before music
	for n := 0; n < loops; n++ {
        atomix.SetFire(kick2, t,            0, 1.0, 0)
        atomix.SetFire(marac, t + 2 *step,  0, 0.5, 0)
        atomix.SetFire(snare, t + 4 *step,  0, 0.8, 0)
        atomix.SetFire(marac, t + 6 *step,  0, 0.5, 0)
        atomix.SetFire(kick1, t + 7 *step,  0, 0.9, 0)
        atomix.SetFire(marac, t + 8 *step,  0, 0.5, 0)
        atomix.SetFire(kick1, t + 10 *step, 0, 0.9, 0)
        atomix.SetFire(snare, t + 12 *step, 0, 0.8, 0)
        atomix.SetFire(marac, t + 14 *step, 0, 0.5, 0)
		t += 16 * step
	}

	spec := atomix.Spec()
	sdl.OpenAudio(spec, nil)
	sdl.PauseAudio(false)
	log.WithFields(log.Fields{
		"spec": spec,
	}).Info("SDL OpenAudio > Atomix")

	time.Sleep(t + 1 * time.Second) // padding after music
}<commit_msg>that's a funky 808 jam if i say so<commit_after>/** Author: <NAME> */

package main

// typedef unsigned char Uint16;
// void AudioCallback(void *userdata, Uint16 *stream, int len);
import "C"
import (
	log "github.com/Sirupsen/logrus"
	"time"

	"github.com/outrightmental/go-atomix"
	"github.com/veandco/go-sdl2/sdl"
)

const (
	sampleHz   = 44100
	numSamples = 4096
)

func main() {
	if err := sdl.Init(sdl.INIT_AUDIO); err != nil {
		log.WithFields(log.Fields{
			"error": err,
		}).Fatal("Cannot init SDL")
		return
	}
    defer func() {
        if r := recover(); r != nil {
			log.WithFields(log.Fields{
				"recover": r,
			}).Warn("Player Recovered")
        }
		sdl.PauseAudio(true)
		atomix.Teardown()
		sdl.Quit()
    }()

	var (
		step = 125 * time.Millisecond
		loops = 4
	)

	var (
		p808  = "assets/sounds/percussion/808/"
		kick1 = p808 + "kick1.wav"
		kick2 = p808 + "kick2.wav"
		marac = p808 + "maracas.wav"
		snare = p808 + "snare.wav"
		hitom = p808 + "hightom.wav"
		clhat = p808 + "cl_hihat.wav"
	)

	atomix.Debug(true)
	atomix.Configure(sdl.AudioSpec{
			Freq:     sampleHz,
			Format:   sdl.AUDIO_S16,
			Channels: 1,
			Samples:  numSamples,
		})
	atomix.StartAt(time.Now().Add(1 * time.Second))

	t := 1 * time.Second // padding before music
	for n := 0; n < loops; n++ {
        atomix.SetFire(kick2, t,            0, 1.0, 0)
        atomix.SetFire(marac, t + 1 *step,  0, 0.5, 0)
        atomix.SetFire(clhat, t + 2 *step,  0, 0.5, 0)
        atomix.SetFire(marac, t + 3 *step,  0, 0.5, 0)
        atomix.SetFire(snare, t + 4 *step,  0, 0.8, 0)
        atomix.SetFire(marac, t + 5 *step,  0, 0.5, 0)
        atomix.SetFire(clhat, t + 6 *step,  0, 0.5, 0)
        atomix.SetFire(kick2, t + 7 *step,  0, 0.9, 0)
        atomix.SetFire(hitom, t + 8 *step,  0, 0.5, 0)
        atomix.SetFire(marac, t + 9 *step,  0, 0.5, 0)
        atomix.SetFire(hitom, t + 10 *step,  0, 0.5, 0)
        atomix.SetFire(marac, t + 11 *step,  0, 0.5, 0)
        atomix.SetFire(snare, t + 12 *step, 0, 0.8, 0)
        atomix.SetFire(kick1, t + 13 *step,  0, 0.9, 0)
        atomix.SetFire(hitom, t + 14 *step, 0, 0.5, 0)
        atomix.SetFire(marac, t + 15 *step,  0, 0.5, 0)
		t += 16 * step
	}

	spec := atomix.Spec()
	sdl.OpenAudio(spec, nil)
	sdl.PauseAudio(false)
	log.WithFields(log.Fields{
		"spec": spec,
	}).Info("SDL OpenAudio > Atomix")

	time.Sleep(t + 1 * time.Second) // padding after music
}
{'fraction_non_alphanumeric': 0.1683896163565357, 'fraction_numerical': 0.056283023202389156, 'mean_word_length': 2.5427176566314076, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6492646', 'n_tokens_mistral': 2134, 'n_tokens_neox': 1844, 'n_words': 431}