2009-01-01から1年間の記事一覧

ChucK で波形を表示する

ChucK で作業してると波形を直感的に眺められなくて困る…なんてつぶやいてしまうと、ChucK 使うなと怒られそうだが。ChucK のデバッグプリントを使ってコンソールに簡単に波形を表示できるようにしてみた。 fun string display(float gain) { 50 => int MAX_…

ChucK による Fuzz の実装

ChucK の触りかたがぼちぼち分かってきたので簡単なエフェクタを実装してみる。まずは Fuzz から。 SndBuf osc => Gain overdrive => Gain limitter => dac; "lost_control.wav" => osc.read; // <-- 適当な Wave ファイルを指定する 0.5 => float MAX_GAIN;…

ChucK : Language Specification > Operators

ChucK : 言語仕様 > 演算子version: 1.2.x.x (dracula)ChucK - [Language Specification : Operators & Operations] 演算子と演算 あるデータに対する演算は演算子を通して行なわれます。この節では、各種のデータ型に対して演算子がどのように振る舞うのか…

sucks or rocks

ChucK の言語仕様について調べているんだが、このなんとも言えない仕様の汚らしさはどうにかならんものか…。単に俺の目が曇ってるだけなら良いんだけど、(昔の) PHP でも見てるみたいでいやんな気分。ま、VM とコンパイラに分割してあるみたいだし、どうして…

ChucK : Language Specification > Arrays

ChucK : 言語仕様 > 配列version: 1.2.x.x (dracula)ChucK - [Language Specification : Arrays] 配列 配列とは、N 次元の整列した (同じ型の) データの集合を表したものです。 この節では、ChucK において配列がどのように宣言され、また扱われるのかを述べ…

ChucK : Language Specification > Type

ChucK: 言語仕様 > 型version: 1.2.x.x (dracula)ChucK - [Type] 型、値、および変数 ChucK は強い型付けを持った言語であり、コンパイル時に全ての型がチェックされます。しかし、このことは ChucK が静的型の言語であることを意味しません。なぜなら、コン…

ChucK: Language Specification > Overview

ChucK: 言語仕様 > 概要version: 1.2.x.x (dracula) ChucK - [Language Specification : Overview] 概要 ChucK は強く型付され、また強く時間に結びつけられた(strongly-timed)、並列実行が可能なマルチメディアプログラミング言語です。ChucK の処理系は仮…

ChucK のマニュアルを翻訳してみるテスト

ちょっくらオーディオプログラミング言語の ChucK を触ってみているところ。リファレンスにさらっと目を通してはいるものの理解がちょっと怪しい気がするので、気分転換にマニュアルを翻訳してみるテスト。

Project Euler: Problem 19

You are given the following information, but you may prefer to do some research for yourself. * 1 Jan 1900 was a Monday. * Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has …

Project Euler: Problem 36

The decimal number, 585 = 1001001001_(2) (binary), is palindromic in both bases.Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.(Please note that the palindromic number, in either base, may n…

Project Euler: Problem 25

The Fibonacci sequence is defined by the recurrence relation: F(n) = F(n−1) + F(n−2), where F(1) = 1 and F(2) = 1.Hence the first 12 terms will be: F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3 F(5) = 5 F(6) = 8 F(7) = 13 F(8) = 21 F(9) = 34 F(10) =…

Project Euler: Problem 20

数を稼ぐために、ひとまず簡単そうなのから先に潰していく方針に変更。Problem 20。 n! means n * (n - 1) * ... * 3 * 2 * 1Find the sum of the digits in the number 100! http://projecteuler.net/index.php?section=problems&id=20 100! の計算結果に含…

エンドオブ年度

log

先のことを考えただけでこんなにも頭が重くなるのは、どうしてなんだろうな。

Project Euler: Problem 14

Problem 14 をやってなかったのでやってみた。 The following iterative sequence is defined for the set of positive integers: n -> n/2 (n is even) n -> 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following seque…

irrational rational

もう時効っぽいから晒してみよう。必殺仕事請負人で適当に作った課題作品。循環小数(=> 有理数)の計算結果の小数ストリームから循環部分を探すスクリプト。除算の結果を先頭から適当な状態機械に食わせて循環部分とそれ以外の 2 値を返す。コマンドラインか…

Project Euler: Problem 18

By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 5 2 4 6 8 5 9 3That is, 3 + 7 + 4 + 9 = 23.Find the maximum total from top to bottom of the trian…

dumb

log

あたまがはたらいてるきがしない。マンガばっか読んでるのもアレなので、気分転換に Project Euler。

Project Euler: Problem 17

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters…

Project Euler: Problem 16

すぐ解ける問題から飛ばし飛ばしに解いてしまうのはあまり良くないかな…。 2^(15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 2^(1000)? http://projecteuler.net/index.php?section=proble…

Project Euler: Problem 13

Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629…

Project Euler: Problem 12 #1

The sequence of triangle numbers is generated by adding the natural numbers. So the 7^(th) triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...Let us list the factor…