0

Holophonic sound is when a sound is played through headphone with more or less sound in one ear or the other to mimic real sound you hear in real life. With this you can feel like you can actual put a place to where it sounds like its coming from. I was wondering if I could mimic this and edit how much sound comes out of the left and right speaker with different sounds using JavaScript or html 5. If their is another language I would have to learn please tell us what it is. If you can use JavaScript and/or html 5 tell me where I should look to learn it. Thank you for your answer.

AmmarCSE
  • 30,079
  • 5
  • 45
  • 53
Isaac Singer
  • 89
  • 2
  • 5
  • 2
    Dont you simply need to set different volumes for each channel? If so, I think you can look into `panning`. http://stackoverflow.com/questions/18604786/gradually-change-web-audio-api-panner – enhzflep May 17 '15 at 03:25
  • 1
    The common word for "more or less in one ear sound" one is "stereo". The "real life sound" is binaural audio. – Joseph May 17 '15 at 04:05
  • Holophonics was coined by Zuccarelli, and it involves phase-shifting appropriately on each channel, in addition to volume changes. See HTML5 AudioListener, PannerNode, etc if you want to use 3d sound. Depending on your browser's implementation it may or may not use phase shifting, but it will definitely do basic volume and left-right panning for you. – DAG Apr 12 '18 at 18:26
  • HTML5 audio API supports the HRTF algorithm and I've confirmed with headphones that indeed it has true 3d sound. For example you can distinguish between a sound being diagonally in front to the right versus diagonally behind you to the right. It's impressive. – DAG Apr 12 '18 at 20:19

1 Answers1

0

The answer is Yes. If it can be programmed in JavaScript it will be programmed in JavaScript. Also HTML5 would probably play a role with the Audio tag. Both work together to create the interaction.

JavaScript is a very powerful language and it is the most popular open source community at the moment. What that means is there is a large variety of modules to choose from. So you need a tool.

STEP #1: Use tools like NPM or GitHub. My first step for such a question would be to search for your key words on NPM like this:

https://www.npmjs.com/search?q=binaural+holophonic+stereo

Or GitHub and Bower: https://github.com/search?utf8=%E2%9C%93&q=binaural+holophonic+stereo http://bower.io/search/?q=binaural%20holophonic%20stereo

STEP #2: See what is out there...

Surprisingly GitHub and Bower did not return results, but NPM did.

It looks like there are some good things there...

    - web-audio-school
    - audiosynth
    - augiobugger
    - sink

STEP #3 Does it fit you requirements?

The next step is to hit the readme files of each to see if these libraries have the holophonic capabilities that you need.

STEP #4: But fret not if is doesn't exist.

Because of Atwoods Law - everything that can be written in JavaScript, will be written in JavaScript.

At least that is the trend we see is proving itself over the years. I personally know a group of computer music hackers in my city. And I can guarantee that if it has not been done - this is the type of thing that they are looking out for to solve.

OVERVIEW

So, if it is possible (which it sounds like it is) - then rest with some sense of inevitability, that it will turn up on NPM, eventually. And if not - it is you that has the pleasure of creating it, once you've mastered JavaScript modularization methodology. I've seen a few of these technologies surface now through NPM and the like. Web Audio is a specific area of advancement, which you can be on look out for impact with ES6. , WebWorkers might help you eventually.

TECHNICALLY:

Diving in technically - if a library does not exist. It sounds like what is required is - JS interoperability with the headphone hardware interface. Which increasingly is a capability of JS. But you may be slightly ahead of the curve here. It is possible, but the key word that would be missing if it does not exist is - interoperability. The need would be for JS to hardware interface interoperability... Which, by the way, is exactly what JS does really wel. So in concept yes this is reasonable. In implementation - I can't say. It requires a search.

SEARCHING JAVASCRIPT AUDIO API VOLUME (gives great results):

This one from CreativeJS is highly recommended. Start here (study it):

http://creativejs.com/resources/web-audio-api-getting-started/

And of course MDN is always best otherwise: https://developer.mozilla.org/en-US/docs/Web/API/AudioChannels_API/Using_the_AudioChannels_API

This looks important (though maybe related indirectly): http://codetheory.in/controlling-the-volume-of-an-audio-file-in-javascript/

And of course StackOverflow has a great link (maybe similar, with clues): Correct audio volume output decibels using HTML5 / javascript, turn off pre-processing

In conclusion to your question:

  • Yes Definitely learn JavaScript.
  • But also learn the command line tools - bc they get u what u want.
  • Git, NPM, Bower...

All in all, even if you don't finish your holophonic proof of concept - you are learning valuable professional skills. JavaScript is a ripe ecosystem for a hobby deep-dive into Web Audio capabilities. It is a great idea - and if nothing exists... it is up to you to become the creator that gives it to the open-source world.

Community
  • 1
  • 1
Nash Worth
  • 2,524
  • 1
  • 21
  • 28