<commit_before>//: [TOC](Table%20Of%20Contents) | [Previous](@previous) | [Next](@next)
//:
//: ---
//:
//: ## clip
//: ### This is an example of building a sound generator from scratch
import XCPlayground
import AudioKit

let audiokit = AKManager.sharedInstance
let bundle = NSBundle.mainBundle()
let file = bundle.pathForResource("PianoBassDrumLoop", ofType: "wav")
let player = AKAudioPlayer(file!)
player.looping = true
let fm = AKFMOscillator(table: AKTable(.Sine, size: 4096), baseFrequency: 100,  amplitude:0.1)
let sine = AKP.sine(frequency: 0.3.ak)
let limitSine = AKP.scale(sine, minimumOutput: 0.ak, maximumOutput: 1.ak)

//let clip = AKP.clip(AKP.input, limit: limitSine)
let cutoff = AKP.scale(sine, minimumOutput:  0.ak, maximumOutput:  22050.ak)
let clip = AKP.lowPassFilter(AKP.input, cutoffFrequency: cutoff)
let effect = AKP.effect(player, operation: clip)

audiokit.audioOutput = effect
audiokit.start()
player.play()
while true {
//    fm.baseFrequency.randomize(220, 880)
//    fm.carrierMultiplier.randomize(0, 4)
//    fm.modulationIndex.randomize(0, 5)
//    fm.modulatingMultiplier.randomize(0, 0.3)
//    fm.amplitude.randomize(0, 0.3)
    usleep(UInt32(randomInt(0...160000)))
}

//: [TOC](Table%20Of%20Contents) | [Previous](@previous) | [Next](@next)<commit_msg>Restoring playground page from accidental commit<commit_after>//: [TOC](Table%20Of%20Contents) | [Previous](@previous) | [Next](@next)
//:
//: ---
//:
//: ## clip
//: ### This is an example of building a sound generator from scratch
import XCPlayground
import AudioKit

let audiokit = AKManager.sharedInstance
let bundle = NSBundle.mainBundle()
let file = bundle.pathForResource("PianoBassDrumLoop", ofType: "wav")
let player = AKAudioPlayer(file!)
player.looping = true
let fm = AKFMOscillator(table: AKTable(.Sine, size: 4096), baseFrequency: 100,  amplitude:0.1)
let sine = AKP.sine(frequency: 0.3.ak)
let limitSine = AKP.scale(sine, minimumOutput: 0.ak, maximumOutput: 1.ak)

let clip = AKP.clip(AKP.input, limit: limitSine)
let effect = AKP.effect(player, operation: clip)

audiokit.audioOutput = effect
audiokit.start()
player.play()
while true {
//    fm.baseFrequency.randomize(220, 880)
//    fm.carrierMultiplier.randomize(0, 4)
//    fm.modulationIndex.randomize(0, 5)
//    fm.modulatingMultiplier.randomize(0, 0.3)
//    fm.amplitude.randomize(0, 0.3)
    usleep(UInt32(randomInt(0...160000)))
}

//: [TOC](Table%20Of%20Contents) | [Previous](@previous) | [Next](@next)
{'fraction_non_alphanumeric': 0.1613424989890821, 'fraction_numerical': 0.03962798220784472, 'mean_word_length': 4.766899766899767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '538626', 'n_tokens_mistral': 999, 'n_tokens_neox': 894, 'n_words': 188}