Sunday, December 6, 2009

Mac OSX - Text to Speech Automator Script


A handy automator script to convert text to speech, playing for us the result, then dump to an aiff.  Found the idea on google, and added some tweaks to make it a little more friendly.  Dead simple to build, and if blogger allowed me to host files, I would.

To build your own, open automator, start a custom automator job, and select the following modules:



The key is the variable--this saves the results of the text you enter in step one, and later, becomes the filename of the resulting aiff file in step 4.  Note in step 4 we have created a directory somewhere on our harddrive (mine is /media/samples/wav/speech) to dump all our files.  

Breakdown of how it works
Ask for Text
Here, we are simply asking us to key in what we want our text to speech automator job to pronounce.

Set Value of Variable
We created a new variable "SayText" to store the results of our request above.  You could name the variable anything when you are creating your own version.

Speak Text
This step plays for us the results of our entry, In this step, make sure to select the voice you want to use--and make sure its identical to the next file.  

Text to Audio File
This step saves the text to speech to an aiff file--by re-rendering our text entry in step one to disk. We'll need to make sure our voice is the same as Speak Text above.  With step two, we should have a variable section at the bottom, so make sure to drag the variable "SayText" to the Save As field.  Then select a suitable directory to dump your results--and remember to go back and clear it out occasionally!

Loop
Frequently, text to speech produces bizarre results, so a given line of text will have to be phonetically tweaked to get it to sound correctly.  Looping thru the automator script makes it easy to do so.


Friday, October 30, 2009

Building a better box

I think it would be really fun to build my own drum sequencer.  I lack a lot of the skills to do so, but it looks like there are enough oem kits around where I should be able to hack something together.  If I'm ever going to get this done, I'll need to setup a timeline and phases, and then commit to it.  

Components
Obviously, the sequencer will be made up of the following pieces:
HW - Hardware (cpu, mobo, peripherals, interfaces, etc)
OS - Operating System
SW - Drivers, Sequencer

Phases
I see each component having two phases:
RAP - Rapid Prototyping
PRD - Production Implementation

Cycle
Each phase will have the following cycles:
OEM DSGN - COTS / OEM Selection
OEM ORDR - COTS / OEM Acquisition
OEM INTG - COTS / OEM Integration
DIY DSGN - DIY Designs
DIY BUILD  - DIY part acquisition / component build
DIY IMPL - DIY Design implementation
SYS INTG - Component Integration
 
Why the schedule formality?
Obviously, the benefits of a hobby project is jumping around and breaking schedule.  However, I know if I don't set targets,  I'll never get velocity.  I've done a lot of hobby projects before, and things work best when velocity is reached.  I've done more complicated ones, and they required 100% DIY pieces--they never got finished.  i've got to be realistic, and retrospective as time goes on.

Rapid Prototype Phase Goals
I've got to avoid the traps of past efforts--I need to leverage as much as existing, COTS/OEM/libs as possible.  The rapid prototype phase will focus most on the SW / controller integration piece.  MIdi performance will not be a focus.  At the same time, I do plan on exceeding existing jitter / latency timings--otherwise, what is the point?  So any sw development will need to go through an abstraction layer, so later on, we can tie calls to very high performance, tightly integrated custom libs.  Up front though, if I do that, I'll likely get nowhere fast.

Notional Schedule

Phase
HW
OS
SW
OEM DSGN
RAP
Nov,  2009
Apr, 2010
Feb, 2010
OEM ORDR
RAP
Jan, 2010
Apr, 2010
Sep, 2010
OEM INTG
RAP
Feb, 2010
Apr, 2010
Nov, 2010
DIY DSGN
RAP
Feb, 2010
Jun, 2010
Apr, 2010
DIY BUILD
RAP
Feb, 2010
Jun, 2010
Feb, 2011
DIY IMPL
RAP
Feb, 2010
Jun, 2010
Jun, 2011
SYS INTG
RAP
Jul, 2010
Jul, 2010
Jul, 2011

2 years might seem like a long time, but really it isn't that long at all, sadly.


Thursday, October 29, 2009

Converting BPM to Measures Per Minute

How often have you sat down to record something, and wondered--how many measures will I need at this bpm?  And, what happens to my 7 minute song if I increase/decrease the tempo?

@ 4/4, the following table spells it all out.  This is actually part of a Mac Numbers document which is a little more interactive.  Since I can't upload documents to blogger (BOOO) I figured I'd just walk folks through the basic math.

BPM to Measure Length

bpm
seconds per measure
Measures per minute
120
2.0
30.00
50
4.8
12.50
51
4.7
12.75
52
4.6
13.00
53
4.5
13.25
54
4.4
13.50
55
4.4
13.75
56
4.3
14.00
57
4.2
14.25
58
4.1
14.50
59
4.1
14.75
60
4.0
15.00
61
3.9
15.25
62
3.9
15.50
63
3.8
15.75
64
3.8
16.00
65
3.7
16.25
66
3.6
16.50
67
3.6
16.75
68
3.5
17.00
69
3.5
17.25
70
3.4
17.50
71
3.4
17.75
72
3.3
18.00
73
3.3
18.25
74
3.2
18.50
75
3.2
18.75
76
3.2
19.00
77
3.1
19.25
78
3.1
19.50
79
3.0
19.75
80
3.0
20.00
81
3.0
20.25
82
2.9
20.50
83
2.9
20.75
84
2.9
21.00
85
2.8
21.25
86
2.8
21.50
87
2.8
21.75
88
2.7
22.00
89
2.7
22.25
90
2.7
22.50
91
2.6
22.75
92
2.6
23.00
93
2.6
23.25
94
2.6
23.50
95
2.5
23.75
96
2.5
24.00
97
2.5
24.25
98
2.4
24.50
99
2.4
24.75
100
2.4
25.00
101
2.4
25.25
102
2.4
25.50
103
2.3
25.75
104
2.3
26.00
105
2.3
26.25
106
2.3
26.50
107
2.2
26.75
108
2.2
27.00
109
2.2
27.25
110
2.2
27.50
111
2.2
27.75
112
2.1
28.00
113
2.1
28.25
114
2.1
28.50
115
2.1
28.75
116
2.1
29.00
117
2.1
29.25
118
2.0
29.50
119
2.0
29.75
120
2.0
30.00
121
2.0
30.25
122
2.0
30.50
123
2.0
30.75
124
1.9
31.00
125
1.9
31.25
126
1.9
31.50
127
1.9
31.75
128
1.9
32.00
129
1.9
32.25
130
1.8
32.50
131
1.8
32.75
132
1.8
33.00
133
1.8
33.25
134
1.8
33.50
135
1.8
33.75
136
1.8
34.00
137
1.8
34.25
138
1.7
34.50
139
1.7
34.75
140
1.7
35.00
141
1.7
35.25
142
1.7
35.50
143
1.7
35.75
144
1.7
36.00
145
1.7
36.25
146
1.6
36.50
147
1.6
36.75
148
1.6
37.00
149
1.6
37.25
150
1.6
37.50
151
1.6
37.75
152
1.6
38.00
153
1.6
38.25
154
1.6
38.50
155
1.5
38.75
156
1.5
39.00
157
1.5
39.25
158
1.5
39.50
159
1.5
39.75
160
1.5
40.00
161
1.5
40.25
162
1.5
40.50
163
1.5
40.75
164
1.5
41.00
165
1.5
41.25
166
1.4
41.50
167
1.4
41.75
168
1.4
42.00
169
1.4
42.25
170
1.4
42.50
171
1.4
42.75
172
1.4
43.00
173
1.4
43.25
174
1.4
43.50
175
1.4
43.75
176
1.4
44.00
177
1.4
44.25
178
1.3
44.50
179
1.3
44.75
180
1.3
45.00
181
1.3
45.25
182
1.3
45.50
183
1.3
45.75
184
1.3
46.00
185
1.3
46.25
186
1.3
46.50



Exercise for the Reader



In my Numbers document (which is GREAT btw, for stuff like this simply beats the pants off Microsoft/Open Office), I have the following tables...the math is very basic, and the following equations should convert quite easily to almost any format.

BPM 
This is a very basic table that converts BPM to Seconds per Measure and Measure Per Minute...
  • BPM (120, an input cell)
  • Notes per beat (4, an input cell)
  • Measure (4, an input cell)
  • Seconds per Measure = Measure / bpm * 60
  • Measure per Minute = 60 / Seconds Per Measure



Song Length -  Input
This is a table we can use to define the basic structure of our song (intro-verse-chorus-verse-outro, for example)
  • BPM = BPM::BPM
  • Intro (min)  = 1 for 1 minute intros
  • Verse (min) = 2 for 2 minute verses
  • Verse Count = 2 for 2 verses
  • Chorus (min) = 1 for 1 minute chorus
  • Chorus Count = 1 for 1 chorus
  • Outro (min) = 1 for 1 minute outro
Song Length - Output
This table calculates how many measures we'll need to meet our song obligations.
  • Measures Per Minute = BPM::Measures per Minute
  • Intro (measures) = Measures Per Minute / Intro (min)
  • Verse (measures) = Measures Per Minute / Verse (min)
  • Chorus (measures) = Measures Per Minute / Chorus (min)
  • Outro (measures) = Measures Per Minute / Outro (min)
  • Song Length (Measures) = Intro (measures) + Verse Count * Verse (measures) + Chorus Count * Chorus(measures) + Outro (measures) 
  • Song Length (Time) = Time(0,intro (min) + verse (min) * verse count + chorus (min) * chorus count + outro (min),0)
Measure Input
Now...what happens if we have a song of X measures, and we want to change the tempo? What will that do to our song length, for example, if we have Y minutes to fill?  This table contains our basic song structure, assuming all verses/choruses are the same.  It should be trivial to change per song if you need to (eg Verse 1, Verse 2, Chorus 1, fill, etc...add whatever parts you need!)


  • BPM = BPM
  • Intro (measures) = 30
  • Verse (measures) = 60
  • Chorus (measures) = 30
  • outro (measures) = 30
Measures Output
Converts measures above into minutes.
  • Seconds Per Measure = BPM::Seconds Per Measure
  • Intro (minutes) = Time(0,0,Intro (measures) * Seconds Per Measure)
  • Verse (minutes) = Time(0,0,Verse (measures) * Seconds Per Measure)
  • Chorus (minutes) = Time(0,0,Chorus (measures) * Seconds Per Measure)
  • Outro (minutes) =  Time(0,0,Outro(measures) * Seconds Per Measure)
Settings this up, note--very easy.  It took a lot longer to type up this blog entry then create the document, as automatic formula copy/paste is a beautiful thing. 


Thats it for a few weeks....