Skip to content

Instantly share code, notes, and snippets.

#include "../JuceLibraryCode/JuceHeader.h"
int main ()
{
var json = JSON::parse("{\"a\":[ {\"b\":[1,2,3,4,5]}, {\"c\":[6,7,8,9]} ] }");
std::cout << static_cast<int>(json["a"][0]["b"][4]) << std::endl; // 5
return 0;
}
@fukuroder
fukuroder / xaml.ps1
Last active August 30, 2015 14:00
XAML in Windows PowerShell
Add-Type -AssemblyName presentationframework
[xml]$xaml = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="100" Width="200" ResizeMode="NoResize">
<Grid>
<Button Name="button1" Content="XAML"/>
</Grid>
</Window>
@fukuroder
fukuroder / lowpass_filter.ps1
Last active March 3, 2017 15:45
Low-pass filter with Windows PowerShell
# create lowpass filter
function create_lowpass_filter(
[double]$samplerate,
[double]$cutoff_freq,
[double]$resonance)
{
# a0 + a1*z^-1 + a2*z^-2
# H(z) = ------------------------
# 1 + b1*z^-1 + b2*z^-2
$s = [Math]::Tan($cutoff_freq*3.14159265/$samplerate)
# -*- coding: utf-8 -*-
import scipy.io, numpy as np, numpy.linalg as nl
name = 'hcircuit'
eps = 1.0e-3
# read matrix and vector
print '#A:', scipy.io.mminfo(name + '.mtx.gz')
print '#b:', scipy.io.mminfo(name + '_b.mtx.gz')
A = scipy.io.mmread(name + '.mtx.gz').tocsr()
@fukuroder
fukuroder / elixir_wav_read_test.exs
Last active August 29, 2015 14:08
ElixirでWAVファイルを読み込む(ヘッダのみ)
#
# elixir_wav_read_test.exs
#
# Created by fukuroda (https://github.com/fukuroder)
#
# >elixir elixir_wav_read_test.exs
use Bitwise
@fukuroder
fukuroder / ocaml_alsa_test.ml
Last active August 29, 2015 14:08
OCamlでWAVファイル読み込んでALSAで再生するテスト
(*
* ocaml_alsa_test.ml
*
* Created by fukuroda (https://github.com/fukuroder)
*)
(* sudo apt-get install libalsa-ocaml-dev *)
(* ocamlfind ocamlopt -o ocaml_alsa_test ocaml_alsa_test.ml -package alsa -linkpkg *)
@fukuroder
fukuroder / alsa_filter_test.cpp
Last active August 29, 2015 14:05
Raspberry Piにナノコンつなげてflac再生してフィルタをかける
/*
* alsa_filter_test.cpp
*
* Created by fukuroda (https://github.com/fukuroder)
*/
// g++ alsa_filter_test.cpp -std=c++0x -O3 -lasound -lsndfile
#include<alsa/asoundlib.h> // sudo apt-get install libasound2-dev
#include<sndfile.h> // sudo apt-get install libsndfile1-dev
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>SoundCloud + Web Audio API test</title>
<script src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
<script src='http://connect.soundcloud.com/sdk.js'></script>
<script>
$(function(){
// default URL
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>local wave file streaming test</title>
<script src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
<script>
$(function(){
// HTML5 audio
@fukuroder
fukuroder / alsa_flac_test.cpp
Last active August 29, 2015 14:05
Raspberry PiでFLACファイル再生するテスト
/*
* alsa_flac_test.cpp
*
* Created by fukuroda (https://github.com/fukuroder)
*/
// g++ alsa_flac_test.cpp -std=c++0x -O3 -lasound -lsndfile
#include<alsa/asoundlib.h> // sudo apt-get install libasound2-dev
#include<sndfile.h> // sudo apt-get install libsndfile1-dev