diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3d4b3f6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +dist: trusty + +language: node_js + +node_js: + - 7 + +addons: + apt: + packages: + - google-chrome-stable + +before_script: + - export CHROME_BIN=chromium-browser + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - sleep 3 diff --git a/README.md b/README.md index efb1660..52dabb2 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # Omnitone: Spatial Audio on the Web +[![Build Status](https://travis-ci.org/GoogleChrome/omnitone.svg?branch=master)](https://travis-ci.org/GoogleChrome/omnitone) + Omnitone is a robust implementation of [FOA (first-order-ambisonic)](https://en.wikipedia.org/wiki/Ambisonics) decoder with binaural rendering written in Web Audio API. Its decoding process is based on multiple gain nodes for ambisonic gain matrix and convolutions for [HRTF](https://en.wikipedia.org/wiki/Head-related_transfer_function) binaural rendering, ensuring the optimum performance. See Omnitone in action: - __[Project Home](https://googlechrome.github.io/omnitone/#home)__ - __[JauntVR Gallery: Music](https://www.jauntvr.com/lobby/MusicLobby)__ - __[Plan8 Ambisonic Player](http://labs.plan8.se/ambisonics-webplayer/)__ + - __[Forge.js](http://forgejs.org/samples/ambisonics)__ The implementation of Omnitone is based on the [Google spatial media](https://github.com/google/spatial-media) specification. The FOA input stream must be configured to ACN channel layout with SN3D normalization. @@ -20,7 +23,7 @@ The implementation of Omnitone is based on the [Google spatial media](https://gi + [FOAPhaseMatchedFilter](#foaphasematchedfilter) + [FOAVirtualSpeaker](#foavirtualspeaker) - [Building](#building) -- [Test](#test) +- __[Test](#test) (NEW in 0.2.1)__ - [Audio Codec compatibility](#audio-codec-compatibility) - [Related Resources](#related-resouces) @@ -280,7 +283,13 @@ npm run build-all # build a minified library and copy static resources. ## Test -Currently there is no sane way of testing web applications built with Web Audio API in the automated setting (e.g. Travis CI). To run unit tests locally, fire up the web server and load the index HTML page in the the `test` directory. +Omnitone uses [Travis](https://travis-ci.org/) and [Karma](https://karma-runner.github.io/1.0/index.html) test runner for continuous integration. (The index HTML page for the local testing is deprecated in v0.2.1.) To run the test suite locally, you have to clone the repository, install dependencies and launch the test runner: + +```bash +npm test +``` + +Note that unit tests require the promisified version of `OfflineAudioContext`, so they might not run on outdate browsers. Omnitone's Travis CI is using the latest stable version of Chrome. ## Audio Codec Compatibility @@ -291,7 +300,6 @@ Omnitone is designed to run any browser that supports Web Audio API, however, it ## Related Resources * [Google Spatial Media](https://github.com/google/spatial-media) -* [VR view](https://developers.google.com/vr/concepts/vrview/) * [Web Audio API](https://webaudio.github.io/web-audio-api/) * [WebVR](https://webvr.info/) diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..4f21d69 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,33 @@ +module.exports = function(config) { + const configuration = { + basePath: '', + frameworks: ['mocha', 'chai'], + files: [ + { pattern: 'build/resources/*.wav', included: false, served: true }, + 'build/omnitone.min.js', + 'test/test-setup.js', + 'test/*.js' + ], + reporters: ['mocha'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: false, + browsers: ['Chrome'], + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + singleRun: true, + concurrency: Infinity + }; + + // For Travis CI. + if (process.env.TRAVIS) { + configuration.browsers = ['Chrome_travis_ci']; + } + + config.set(configuration); +}; diff --git a/package.json b/package.json index 591d9b6..0f07eb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "omnitone", - "version": "0.2.0", + "version": "0.2.1", "description": "Spatial Audio Decoder in Web Audio API", "main": "build/omnitone.js", "keywords": [ @@ -11,15 +11,21 @@ "Web Audio API" ], "devDependencies": { - "copy-webpack-plugin": "^3.0.1", - "webpack": "^1.13.0", "chai": "^3.5.0", - "mocha": "^3.0.0" + "copy-webpack-plugin": "^3.0.1", + "karma": "^1.6.0", + "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^2.0.0", + "karma-mocha": "^1.3.0", + "karma-mocha-reporter": "^2.2.3", + "mocha": "^3.0.0", + "webpack": "^1.13.0" }, "scripts": { "build": "webpack --progress --color", "watch": "webpack --progress --color --watch", - "build-all": "webpack --config webpack.config.all.js --progress --color" + "build-all": "webpack --config webpack.config.all.js --progress --color", + "test": "node_modules/karma/bin/karma start" }, "homepage": "https://github.com/GoogleChrome/omnitone", "bugs": { diff --git a/test/index.html b/test/index.html deleted file mode 100644 index a959cbc..0000000 --- a/test/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Omnitone Unit Tests - - - -
-
-
- - - - - - - - - - - - diff --git a/test/test-convolver.js b/test/test-convolver.js index 94eb3e4..9c139a9 100644 --- a/test/test-convolver.js +++ b/test/test-convolver.js @@ -64,7 +64,7 @@ describe('FOAConvolver', function () { Omnitone.loadAudioBuffers(context, [{ name: 'SH-MaxRe', - url: '../build/resources/sh_hrir_o_1.wav' + url: 'base/build/resources/sh_hrir_o_1.wav' }]).then(function (buffers) { foaSHMaxREBuffer = buffers.get('SH-MaxRe'); done();