[obsidian] vault backup: 2024-10-25 14:18:20
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (push) Successful in 3m43s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (push) Successful in 3m43s
				
			This commit is contained in:
		@@ -4,7 +4,6 @@ date: "2023-10-29T18:14:14+0900"
 | 
			
		||||
#programming #music #sound 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[Algorithmic symphonies from one line of code -- how and why?(2011)](http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -18,7 +17,7 @@ Bytebeatは2011年に[[viznut]]がYoutube上の動画で公開し、自身のブ
 | 
			
		||||
 | 
			
		||||
[HTML5 Bytebeat](https://greggman.com/downloads/examples/html5bytebeat/html5bytebeat.html)
 | 
			
		||||
 | 
			
		||||
[Bytebeat Composer](https://sarpnt.github.io/bytebeat-composer)
 | 
			
		||||
[Bytebeat Composer](https://bytebeat.ficial.net/)
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
@@ -32,13 +31,12 @@ Bytebeatは元々次のようなC言語のプログラムで作られてた。
 | 
			
		||||
main(t){for(;;t++)putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
このC言語のコードは極限まで圧縮されているのでもうちょっと丁寧に書くとこうなります。
 | 
			
		||||
このC言語のコードは極限まで圧縮されているのでもうちょっと丁寧に書くとこうなります(大昔のCコンパイラでない限りエラーで落とされる)。
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
int main(int t){
 | 
			
		||||
    for(;;t++){
 | 
			
		||||
    putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);
 | 
			
		||||
    }
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
int main(){
 | 
			
		||||
for(int t=0;;t++) putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -47,7 +45,7 @@ int main(int t){
 | 
			
		||||
macOSでやろうとするなら、`ffmpeg`に付属する`ffplay`で次のようなコードで書ける
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
program | ffplay -f u8 -i pipe:0 -ar 44k -ac 1
 | 
			
		||||
program | ffplay -f u8 -i pipe:0 -ar 8k -ch_layout mono
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
どうせならC言語使わずにデータを生成したいが、シェルスクリプトで直接バイナリを扱うのは死ぬほどだるい(`printf`コマンドや`bc`であれこれすれば不可能でもないが、結局ファイルを一度経由しないと厳しい)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user