-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
31 lines (25 loc) · 780 Bytes
/
example.php
File metadata and controls
31 lines (25 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* Created by PhpStorm.
* User: pdietrich
* Date: 29.10.2017
* Time: 00:32
*/
use Codesound\Player;
use Codesound\Sequence;
use Codesound\SoundDumper;
include __DIR__.'/vendor/autoload.php';
// all notes of a major scale (Yes, the white keys of a piano when doing C Major)
$range = [0, 2, 4, 5, 7, 9, 11, 12];
$alleMeineEntchen = [0, 2, 4, 5, [7, 1 / 2], [7, 1 / 2], 9, 9, 9, 9, [7, 1 / 2], [null, 1 / 2], 9, 9, 9, 9, [7, 1 / 2]];
/*
$sequence = Sequence();
foreach ($range as $index) {
$note = new Note($index);
$sequence->add($note);
}
*/
$sequence = Sequence::fromTuples($alleMeineEntchen);
$player = new Player($sequence);
$dumper = new SoundDumper();
$dumper->dump($player, __DIR__.'/lala.ul', __DIR__.'/lala.wav');