aboutsummaryrefslogtreecommitdiffstats
path: root/thesoundofpeople.scd
blob: f9fc5e1d0136ed2e1e325ed0a48a9ed90a0116c3 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// This file is here to show you how to start The Sound of People. 
// At some point in the future this file can - hopefully - just be run with sclang and The Sound Of People will be managable by GUI completely
// Go to https://opensnp.org/genotypes and download the file you'd like to use. So far only the parsing of 23andme files has been implemented (sorry).
// The instructions below show an example on how to use the file

// Parse a file, write a new one to disk (after this you should recompile your class library/ restart sclang)
(
// parse a new file from opensnp.org
~parser = SNPParser.new("/tmp/1.23andme.9");
// get a SNPDict
~dictionary = ~parser.readFile;
// write the SNPDict to file
~file = SNPFile("/tmp/1.tsop.snp");
~file.writeFile(~dictionary);
)

// Starting the SuperCollider server and reading the file
(
s.waitForBoot({
  // set the file to read from
  ~file = SNPFile("/tmp/1.tsop.snp");
  // read the file
  ~dictionary = ~file.readFile;
  // this is the number of positions you'll be able to play
  ~dictionary.positions;
  // shown meter and server window
  s.meter;
  s.makeWindow;
  // create 8 channel audio setup with 2 hour playtime from the dictionary of SNP objects
  ~audio = SNPAudio.new(~dictionary, 8, 2, true, []);
  // show the GUI
  ~audio.spawnView;
});
)

// play from position 0 to the end
~audio.playFromTo(0);

// play from position 0 to position 200000
~audio.playFromTo(0, 200000);

// pause audio at current position (please wait at least 3 seconds for this to settle!)
~audio.pausePlay;

// resume audio from the current position (after pause)
~audio.resumePlay;

// show current time and position relative to their maximum values
~audio.queryTimeAndPosition;//get current position and time