Writing Worship Music with AI – Recurrent Neural Networks

Over the past few weeks, I’ve been toying around with a type of Artificial Intelligence (AI) called a Recurrent Neural Network (RNN). Since they’ve already been used to cooking recipes, Bible verses, Obama speeches, Mozart Music, Image descriptions, and writing prompts, I thought it would be fun to see what kind of lyrics it would produce if I fed it some popular Christian music.

I’m not sure it could quite pass as contemporvent, but it seems like something you might see in a future Church Hunters episode, and I can guarantee that Challies won’t sing them :).

3 of My Favorite AI-Produced Worship Songs

I will My see in You Sound

When I am heart, I am free
Here’s my heart, You are life
Here’s the life, I am free
You are love is peak my heart, You are life

I am heart, You are life
You are love is love is true
Here’s the wait
I am free

You are life, I am heart, I am free
You are love is heart, You are life
You are love is love is love

When I Am

Here’s the life the reach strong to see
You are love is love is promise
You are life I am true

Here’s the life, You are life
You are life, I am heart, Lord
I am life, You are life

Here’s all the reaches the wait
You are life, I am free
You are life that is love

You are life, Lord
I am heart, You are life

With His Speak

You are love is life
With I am healed the life all the bled
You’re is love is way the life
I am all the dark my heart

I am bread on Your love is
We cry strong place the with merce
You are life is heart, Lord
And strong the life, With all the reach that is pore

Update: Markov Lyrics

After this initial post, I tried another AI/text library that markovify that uses something called a Markov chain to produce text. It doesn’t handle the punctuation (line-by-line) as the RNN libraries I describe below, but the lyrics are a bit more sensible:

What this world needs is not a human right
To see if they were yours all along
You are hope for justice,
Stand firm in the sand, temporary wealth

Walls are falling down
Now the walls are falling down,
storms are closing in
And here I am born again,

Woah, Let the river flow.

How majestic is Your love is moving,
moving among us So we give You all our strength,
With all our sin
The people sing Hosanna Hosanna

in the shelter of the Lord, my God saved the day,
When my world caved to nothing
You came from God above
The Father’s only Son
Saved my soul My Life

Here I am…
King of the world…
I’m famous in my mind
take my time to set me free,

Salvation is here and it is finished.
You can shine on You I can’t live all alone.

How Were These Created?

I’m not really qualified to explain Recurrent Neural Networks (RNN) on a technical level (this is one of the best explanations), but the basic idea is a programmer can feed an RNN some data (sequential information such as images, music, text, etc.), and then the RNN “reads” it all and stores the the patterns in the input source. Based on what it’s learned it starts to be able to guess what’s next. For example, you probably know the next word in “Praise the ____” and, given enough input, an RNN can guess that next word as well.

For this experiment, I fed the Torch-RNN library (using these two installation guides) about 500 songs from the top Christian artist according to Billboard which included Hillsong, Chris Tomlin, Lauren Daigle, Casting Crowns, Mercy Me, Christy Nockels, For King and Country, and a few others.

It took a few hours to process, and then it started producing output like you see above.

Of course, the output doesn’t actually make any real sense. It sounds kind of worship-y, but it’s also complete gibberish. That’s because the RNN doesn’t truly understand or feel what it processed. It doesn’t even know the basic parts of English grammar like subject or verbs or musical concepts like a chorus or a bridge. It’s only intelligent in the sense that it grasps the patterns in the input and, based on probabilities, can generate something like what you fed it.

In this case, it seems to think that the words “life” and “heart” and “live” have a high probability of being in a song.

Limitations aside, the output is tremendously fun, and perhaps more interestingly, RNNs do a good job of demonstrating the difference between the ability to perform a complex mental task (you might call this intelligence) and higher level concepts like understanding, wisdom, or consciousness.

What about the Psalms?

I also wondered what kind of words the RNN would generate if it were fed from another source of comparable Christian content, so I fed it the 150 Psalms from the English Standard Version (ESV).

Here are some of the passages it generated:

10 The LORD all the LORD with the man a saint of the LORD,
and the LORD in the LORD is for the peoples.
11 You have the will the seet the LORD,
and the said the hand of the LORD of the LORD
and string my state and the seard of the LORD,
and be the will the sound and the proins.
15 The LORD is his praise the come of the LORD,
and his sear the rebeath of the LORD will not be the waters,
and and came his stands the reap,
the LORD is a strong the earth of the LORD

and another with few parameters (temperature from .2 to .4) adjusted:

22 The LORD,
and the righteous have seek the LORD with the LORD,
and like of the LORD his praise the will sing and the will of the will from the pries of the will people.
13 He whise in the people in the LORD all the shall not of the LORD,
and the LORD,
and the for my righteous and of the will not the earth;
the LORD and do me who sea have not the will not of the earth of the fainter of the refut the land of the hand of the piens of the will be the righteouss of the LORD in the will not the will not and the revere the will be forther of the LORD with the ining to the word of the LORD,
and the will be are a same

Update: Markov Psalms

15 He sends out his word to Jacob,
his chosen one, stood in the morning. His holy mountain,
2 beautiful in elevation, is the nation whose God is a mere breath!
10 The LORD brings the counsel of the LORD, for the dead?
4 Have they no knowledge, all the ends of the LORD, our Maker!
May prayer be counted as incense before you,
our secret sins in the land; you do not get their fill.
78 Let the insolent oppress me.
14 Satisfy us in the way I should go,
for to you the fear of you,
and let no one to bury them.
4 Even though I walk in the heavens;
your faithfulness answer me, O God, do not get their fill.

Clearly, there are some differences in the patterns.

Remember, the RNN isn’t simply counting words and then spitting them back at the same frequency. Although it does appear this way, the RNN is actually using probability to generate the next most likely character. In this case, if the character is ‘L’ then from the Psalms dataset, the RNN thinks that “L” is  more likely to be followed by “ORD” while in the contemporary songs, it’s more likely to be “ife” or “ove.”

The Psalms also have longer lines. Statistically speaking, this is because the return character occurs less frequently, and the RNN then considers a return less likely after each word.

I hope you have as much fun with this as I did.

“The righteous have seek the LORD with the LORD”


Texas Bible (plugin): Fixing the Second Person Plural Problem One Website at a Time

TExas Bible Example

Download Google Chrome Extension

Try Now at YallVersion.com

KERA, Dallas’s NPR affiliate, covered this: Southern-Style Scripture And Other Technological Leaps Of Faith

Texas Has What English Lacks

As a preteen on my first visit out of the South, I remember hearing giggles from some people on the New York Subway whenever I spoke. Since I grew up in a large city, I knew that I didn’t have a traditional Texas twang, so it took me a while to realize what was so funny – my use of the word “Y’all” to refer to a group of friends.

Fast forward 20 years, and just about any time I teach from the Scriptures I have to point out a place where the English Bible says “you,” but the original Hebrew or Greek indicates you plural rather than you singular. This means the original author was addressing to a group of people, but a modern English reader can’t detect this because in common English we use “you” for both singular (“you are awesome”) and plural (“you are a team”). This often leads modern readers to think “you” refers to him or her as an individual, when in fact it refers to the community of faith.

Here in Texas (and in the Southern US more generally), I tell my audience that we have a perfect equivalent to the original Greek/Hebrew second person plural: “y’all” the contraction of “you all.” This of course always gets me a good laugh. And this is not unique to the Southern US – many other areas of the English speaking world also have spoken forms of you plural such as “you guys,” “yinz,” and “you lot.”

A few weeks ago, I decided to see how many times this happens. It turns out there are at least 4,720 verses (2,698 in the Hebrew Bible and 2,022 in the Greek) with you plural translated as English “you” which could lead a reader to think it is directed at him or her personally rather than the Church as a community.

So I initially set out to develop a plugin for a Bible software project that would convert all “You plurals” to “Y’all” for my Bible project. I liked it so much I decided to create a Google Chrome extension that does the same thing for some popular Bible websites (youversion.com/bible.com, biblegateway.com, biblehub.com).

Texas Bible – Google Chrome Extension

If you’d like to try to the plugin, here’s the URL: Texas Bible Extension

When the plugin is running, here’s what it looks like on YouVersion.com and BibleGateway.com

YouVersion.com example


BibleGateway.com exampleNot Just for Texans

As I mentioned, the Southern US is not the only place to have a spoken version of the second person plural. Pennsylvania (Pittsburgh) has “yinz,” the UK has “you lot,” and many Americans say “you guys” to refer to mixed gender groups. So I made all these selectable allowing you to read the any English version as it would sound read to your regional congregation.

Once the extension is installed in Google Chrome, you can go to the Options area and select which second person plural version you like and see all the variants (some of which I had to make up like the Reflexive rendering of Old English “Ye”).

Texas Bible - Options


Why, Why Did You Make this?

And now here’s the fun part. Why in the world would someone do this? Here’s a few reasons:

1. For Fun and Joy

I enjoy the programming gifts God’s given me, I like to tinker with the Bible, and I like to learn new programming techniques such as making a browser extension which before this I had never tried.

2. Commentary on The Individual vs. The Community

On a more serious note, it seems that since the Protestant Reformation we’ve tended to emphasize the salvation of the individual and, with inverse proportion, downplayed God’s work in the Church as a community of people.

There are, of course, many reasons for this, but I think that two technologies (i.e. human inventions) have exacerbated the issue: (a) The technology of the book which encourages us to encounter Scripture textually in isolation rather than orally in a group; and (b) The technology of the English language (again, a human creation) which doesn’t have an agreed upon second person plural and therefore discards or hides important biblical data.

I can’t do much about the first issue, but the “Texas Bible” extension does work to overcome the second. Here’s a few examples of the human community emphasis in Scripture:

And God said, “Behold, I have given y’all every plant yielding seed that is on the face of all the earth, and every tree with seed in its fruit. Y’all shall have them for food. (Gen 1:29, tESV – Texan ESV)

For I know the plans I have for yinz, declares Yahweh, plans for welfare and not for evil, to give yinz a future and a hope. (Jeremiah 29:11, pESV – Pittsburgh ESV)

…Work out your guys’s salvation with fear and trembling;  for it is God who is at work in you guys, both to will and to work for His good pleasure. (Phil. 2:12-14, usESV)

To me, it’s a very different Bible and one that tells us something important about the the body of Christ.

3. Commentary on Language

You might notice that in the second example above, the term “the LORD” has been switched to “Yahweh.” In English translation, the Hebrew name for God (the four letters YHWH) has been traditionally translated as “the LORD” (usually in small caps) in an effort to revere the name of God and carry on a a tradition of the Jews not to speak his name

However, I find that outside nerdy academic circles almost no one knows that “the LORD” (Yahweh) is different from “the Lord.” What was originally meant as reverence may now actually be unintentionally hiding something important about God himself. This leads to the question: Which is worse, not revering the name of God or not knowing it exists to revere?  In the Chrome extension this is an option, so you get to decide.

I, too, want to revere God and his holy name, and yet I also want to take this chance to point out how powerful language itself is in shaping what we see in the world. Just as Adam formed his world by naming the animals, we continually form and reform our world by what we words we assign to it (are you pro-life or anti-choice?). These words are not simple references or tags, they color what we see… and what we cannot see.

Bible translators, therefore, have an enormously complex task of trying to transfer whole worlds between cultures and inevitably things get “lost in translation.” Hopefully, this plugin will offer some options as to what we read.

4. Commentary on “Text” in the Age of Remixes

Penultimately, I am doing something rather radical here: I am messing with God’s word.

But is it really “God’s Word” which which I am messing? As we’ve said, isn’t a translation already that but also more?

This means I am only taking the work of translation one step further. But what right do I as an individual have to remix, reuse, and change someone else’s hard work? Zondervan/Biblia is free to update the NIV1984 to the NIV2011, but what about me? If I were to publish these changes, I could rightfully be sued. So what have I done exactly?

To answer this question, we must realize that in the Age of the Internet, a “text” is something very different than it was in the Age of Print. Texts are not fixed entities sitting on shelves, reflecting only the notes and highlights that one person has added. On the web, a “text” is something more like an oral story from the age before Print, in that anyone can take, change, and edit the “text,” and then reproduce it.

And yet, I have not even done that. I have only provided the tools to mass produce a change that is stored as data. Ah, what a strange new world in which we live where a “text” is not a “text”!

5. Commentary on Scripture Itself

Finally, I am deeply interested in talking about what exactly Scripture is and how mediums contribute to our understanding of them.

Is the Bible, “a love letter from Jesus” or a storehouse of “timeless truths” captured in chapters and verses? Is it the very words of God dictated through several different men or does it merely record events of revelation? Does it become revelation as we read it and does it have a single meaning in all ages or multiple meanings that expand with the canon? Is it like other books or it is somehow sanctified and holy? Can a nonbeliever study it the same way Christian do, or does the Spirit have an ineffable role in interpretation? Furthermore, is Scripture it something to be studied, proclaimed, and understood, or does it change us as we hear it spoken aloud in a community? Does any of this change if we hear a scroll read aloud, read a printed book in our own room, scan the text on our phones, or hear it on the radio in a closed country?

However you y’all answer these questions, I do hope you y’all like the tool, and it helps you y’all grow closer to the LORD Yahweh!

Powerful, Secure Bible Software for Closed Countries … and You!

(video demo of the software discussed below)

Digital Bible Society

I’d like to an organization that you’ve probably never heard of: Digital Bible Society (DBS). For the last 10 years or so, they’ve been putting together something called Chinese Treasures which was a CD (and later a DVD) full of Chinese language Bibles and theological resources. It was distributed throughout China, and Christians were encouraged to “pirate” the disk (i.e. make copies and redistribute them) as much as possible.

Even 10 years ago, this was a big deal because the Chinese government was largely hostile to Christians not associated with the government church. Now that China is more open, DBS is making some shifts.

First off, CDs are out, SD chips are in (they are super fun to smuggle). Second, other closed countries (that speak languages like Farsi) are new areas of distribution. Third, the focus is not just desktop software, but mobile devices (which are common even in illiterate cultures). Finally, audio and video are often as important as text depending on the culture. The SD chips that DBS puts together have Bibles in a variety of formats (HTML, PDF, ePub, etc.) which means that most devices – from modern laptops to cheap eReaders to basic mobile phones – should be able to do something with the content

The Software (BibleWebApp 2.0): Sofia Bible Browser

About a year ago, the folks at DBS asked if I could take some of the work I’ve done on web-based Bible apps like http://biblewebapp.com/ and make it a part of the suite of applications DBS is developing for their SD chips. It’s labelled “Bible Browser” in the title, but I also call it “Sofia” for short.

Now, there are already lots of amazing Bible website and applications out there today built by wonderful Christian brothers and sisters, so it might seem unnecessary to build yet another Bible application. Each of these has a place in what God is doing in the world, but the software that DBS creates has some special requirements that necessitates something new:

  1. Must be able to run without Internet access
  2. Must be able to run without being “installed”
  3. Must be able to run in any browser on any device

In a country where it’s illegal to follow Christ or ask about Christianity, installing Bible software and accessing Bible website are big no-nos, so this security is absolutely paramount. The best solution we have so far is to create an HTML/JavaScript application that runs on whatever browser the user has installed.

The challenged is that HTML-based applications can be a bit slower than full desktop software (like the awesome apps Logos, Accordance, or SWORD) and since we are designing them to run without Internet access (like the amazing YouVersion or Biblia) they can’t have a powerful server to do things like process search queries. This makes for some interesting programming challenges, but it’s also part of the fun of doing something different to serve the church at large. The app also needs to be able to run on very basic phones with limited HTML/CSS support, another fun challenge.

For those technically inclined, the basic setup is that each chapter of the Bible is a separate HTML file linked together by jQuery Mobile which makes browsing the Bible work really well on basic phones all the way up to iPhone/Android. Then a desktop application reads these same HTML files and uses them to produces the multi-pane application you see in the video above.

Unique Features of Sofia

In addition to the unique focus on an HTML app that runs in the browser off an SD card, there are few unique features of “Sofia.” While the main focus of the application is providing access to the Bible in every language, I’m also building in some powerful original language features for Bible students of all levels:

  • Verse and Word matching – In the desktop version, as you put your mouse over verses and words, the corresponding verse and word in other versions get highlighted, so you can see the relationships and how the word was translated into a given language or English translation.
  • Morphological Highlighting – A feature normally only seen in big packages like Logos, the morphological filter lets you add color codes to
    (1) specific Greek or Hebrew words,
    (2) Greek tenses and noun cases,
    (3) rare words.
    You can choose to a color for the word itself, choose a background color, or underline the word with a color.
  • Media Gallery – We are also adding a number of media rich feature, including images linked to verses, audio versions of the Bible, and even versions of the Jesus Film. Below is an example of images of Nicodemus from John 3. The UI for this might change as we add additional resources like maps.
  • Audio read along – Based on some great work by Weston Ruter, I’m also planning to match up the text of the Bible with the audio down to the version and even word levels.

Special Thanks

Before I say any more about the project, some special thanks are in order because every Bible project builds on the hard work of many others. First, CrossWire, the makers of several amazing open source Bible applications has provided the KJV2006 project which is a version of the KJV with embedded linguistic data (Strong’s numbers) linking the original Greek and Hebrew words with the English translation.

Second, on this demo site, I also have the NET interlinear and NASB interlinear thanks to bible.org and Lockman respectively who’ve generously given me permission to use their data on biblewebapp.com.

Finally, much of the data in the popups, including the strong’s dictionary, was provided by open source data initiatives from the Open Scriptures group especially the work of James TauberDavid Troidl, and Ulrik Sandborg-Petersen.

Where To Get it?

Another great feature of the Digital Bible Society’s work is that they are releasing what I’m building as an open source Bible reader that you can use on your own website (if you have permissions for a particular version). Here are some links:

Please download  it, fork it, contribute, and/or give any feedback here or on github.com.

For every tribe, tongue, and nation!

bib.ly – a Bible Reference Shortener and Linker

Two years ago, I got to go up to Seattle to present at the BibleTech conference put on by the great folks at Logos. I can’t attend this year, but I do have a small tool I’d like to share in honor of the conference starting today – here’s the live feed of the confernce hashtag.

Introducing bib.ly

bib.ly is a new Bible URL shortener and linker that attempts to solve a few tricky issues with Bible references on the web. Here’s what I set out for it to do:

  1. Easy to create Bible URLs – If you’re sharing a Bible verse on Facebook or Twitter, it’s hard to remember exactly how to create a link to a verse. There are several awesome existing services (http://ref.ly, http://esv.tohttp://bible.us/), but bib.ly is probably the easiest to remember (only one character different from the well-known bit.ly).

    To make a link just add any combination of book, chapter, and verse numbers (plus a version) after http://bib.ly/ like so


    The site will also create links for you if you have trouble doing it yourself:

  2. Your friends choose their favorite Bible website (YouVersion, BibleGateway, etc.) – The other Bible reference shorteners out there all tie to a specific Bible reading website (bible.us => youversion.com, ref.ly = logos.com, etc.), but the bib.ly lets the person who clicks on the link decide where they want to go. If you post a link to Mark 5:36, when someone clicks it they’ll see a screen like this where they can choose their favorite site

    Update: The site now shows up to 3 verses of the passage you clicked on (defaults to ESV):

    I considered taking visitors to a default site with an ow.ly-style toolbar at the top of the page, but I personally don’t like those. I think the best solution will be to add a  “remember my choice” checkbox that will automatically take you to your favorite site (see below).

  3. Automatically link verses on your site – Creating short links for Twitter or Facebook is great, but what about if you have a giant list of Bible verses (like DTS’s doctrinal statement which has long lists like Mark 12:26, 36; 13:11; Luke 24:27, 44; John 5:39; Acts 1:16; 17:2–3; 18:28; 26:22–23; 28:23; Rom. 15:4; 1 Cor. 2:13; 10:11; 2 Tim. 3:16; 2 Pet. 1:21)?

    bib.ly also has plugins you can add to automatically link up all Bible references on your site and see the text of the verse just by running your mouse over the link. You can use the WordPress plugin to do it automatically, or if you’re more adventurous you can add the following code to your site:

    <script src="http://code.bib.ly/bibly.min.js"></script>
    <link href="http://code.bib.ly/bibly.min.css" rel="stylesheet" />

    Powered by BibliaThe popups use the Biblia web services from Logos Bible Software.

What’s Next?

Matt Mullenweg (who created WordPress) writes, “if you’re not embarrassed when you ship your first version you waited too long.” I’m definitely embarrassed that I didn’t get to  several features before launching, so if you’re interested here’s what’s coming down the pike:

  1. A checkbox for “remember my favorite site” so that if you love YouVersion.com bib.ly will always take you there or if you prefer Bible.Logos.com bib.ly links will take you there without stopping at bib.ly first.
  2. The text of the current Bible reference will show on a little hovercard when you mouseover a link on your site.. I updated the tool this afternoon so that it does Bible popups. It’s KJV for now, though I hope to add additional versions soon. It supports ESV, NET, and KJV
  3. Non-English languages, more Bible translations, support for apocryphal books.

I have a few other fun ideas, but they’ll  require a fair number of people to start using bib.ly, so please give it a try and send me any feedback you have.

The Table Project: Values Driven Technology?

The Table Project is one of many new socially oriented web platforms being released for churches, and I normally don’t take the time to highlight or discuss all of them, but I want to make special mention of the Table Project based on its introductory video which you can watch here:

Continue reading The Table Project: Values Driven Technology?

2 Bible Experiments: Reading Plans and Instant Search

From time to time, I like to share programming experiments that relate to the digital world. Here, I’ve applied recent Internet memes to Bible tools.

How Long Does it Take to Read the Bible?

The first applies the minisite principle of creating a site that does one very simple thing (like isitraining.com or istwitterdown.net) to the question of how long it takes to read the Bible. Sometimes reading the entire Bible seems daunting, but this should make it seem a bit easier:

How long does it take to read the Bible

Instant Bible Search

Google’s new Instant Search which spawned lots of copies of it like YouTube Instant and iTunes Instant. So I decided to create

Instant Bible Search

It uses Logos‘s Biblia API and takes advantage of their JSONP support (which the ESV API for example does not have). Currently it’s limited to versions of the Bible that Logos can include in their API, but since it’s just for fun that shouldn’t matter too much.

Hope you like them!

ECHO Conference and MediaElement.js

My good friend Nathan Smith and I are giving a little presentation Friday at ECHO Conference. We’re not presenting on media ecology or anything theological, just good old straight forward web development. Nathan and I actually met over email when he was the web developer at Asbury Seminary and I was working at Dallas Theological Seminary.

Conference slides


I’m also releasing the first draft of a little code library that helps developers implement HTML5 <video>. You can click the image below to check it out.


The point of this exercise is that for all the tradeoffs and downsides to technology, we are still called to be makers and creators, and I always want to be a part of that.

“World’s First” Augmented Reality Virtual Communion! (can ≠ should)

Every once in a while I like to do a code commentary where I program something to illustrate a broader point about technology (like the Bible reader or TwitterVoice3D).

This is a demo of a relatively new and very cool technology called “augmented reality.” When I saw a demo for the first time, I imagined there would be some great applications like GE’s Smart Grid demo or this drum kit, but I also wondered when someone would use it for something that is at best silly and at worst inherently wrong.

So I decided to create the “world’s first” augmented reality virtual communion, which fits my criteria of being both downright silly as well as possibly heretical. Please don’t take this too seriously – it’s not meant to engage in complex questions about sacramentology or online church (none of which would actually suggest using this). It’s just a fun example of something that is a technologically can, but not a theological should.

Video Demo

(Built using FLARToolkit and Papervision3D. Sorry for the terrible audio and framerate.)
/ Continue reading “World’s First” Augmented Reality Virtual Communion! (can ≠ should)

Read the Bible: Greek and Hebrew Reading Experiment

Reader's Greek and HebrewFor my BibleTech:2009 presentation (“Technology Is Not Neutral: How Bible Technology Shapes Our Faith“), I created an example site to demonstrate what I like to call “technological minimalism” in Bible software. In my seminary Greek and Hebrew classes, I often relied too heavily on my Bible software during translations and my ability to actually read the text suffered. What I needed was some way to turn off all the cool features and only see the help that I really needed. In my case, I was supposed to have memorized all the Greek works which were used 50 times or more, so I only needed definitions for the more rare words. Unfortunately, there is no way to limit this that I know of in Logos.

Continue reading Read the Bible: Greek and Hebrew Reading Experiment

TwitterVoice3D: Creativity, Chaos, and Order in the Online World

A few weeks ago, I decided that rather than write words about a technology, I would write code using technology that would hopefully communicate in a way words cannot.

Twitter Voice 3D

TwitterVoice3D is an Adobe AIR app that shows all your friends’ tweets randomly strewn over a 3D world and reads the tweets to you using text-to-speech (it was built with Flash and Papervision3D)

Here is a screenshot and a video (sorry for the poor audio quality)


Continue reading TwitterVoice3D: Creativity, Chaos, and Order in the Online World