«Turning real music into 8-bit music» by codepool

on 27 Apr'17 15:57 in 8bitchiptunepitchanalysis

Migration from the old SourceForge wiki.

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
// By Dan Stowell

// Someone asked me if it was possible to turn any MP3 automatically into 8-bit chiptune music. Well, yes and no...

s.boot;
(
SynthDef("help_mp3_01", { |bufnum = 0|
   var son, pitch, amp, wibble;
   son = DiskIn.ar(2, bufnum).mean;
   pitch = Tartini.kr(son)[0];
   amp = Amplitude.ar(son);
   pitch = Median.kr(5, pitch); // smooth
   pitch = pitch.min(10000).max(10); // limit
   pitch = pitch.cpsmidi.round.midicps; // coerce
   wibble = Pulse.ar(pitch, 0.2, amp * 2); // resynthesise
   wibble = FreeVerb.ar(wibble, 0.3, 0.1, 0.9); // bit of reverb just to taste
   Out.ar(0, wibble.dup);
}).memStore;
)

// Choose your MP3... some will work well and most will work badly.
// Oh and you'll need the MP3 Quark.
m = MP3("../mp3s/Gimme A Pig Foot And A Bottle Of Beer.mp3");
m.start;
b = Buffer.cueSoundFile(s, m.fifo, 0, 2);
// Off we go:
x = Synth("help_mp3_01", [\bufnum, b.bufnum], addAction:\addToTail);

// Please remember to tidy up after yourself:
x.free;
b.close; b.free;
m.finish;


// More waffle plus a recorded example at
// http://www.mcld.co.uk/blog/blog.php?235
raw 1134 chars (focus & ctrl+a+c to copy)
reception
comments